diff --git a/licenses/QCA.txt b/licenses/QCA.txt new file mode 100644 index 0000000000..68890f0f0c --- /dev/null +++ b/licenses/QCA.txt @@ -0,0 +1,45 @@ +Copyright (c) 2013-2017 Qualcomm Atheros, Inc. + +All rights reserved. + +Redistribution and use in binary forms, without +modification, are permitted (subject to the limitations in the +disclaimer below) provided that the following conditions are met: + +* Redistributions 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. + +* Neither the name of Qualcomm Atheros, Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +* No Reverse engineering, decompiling, decrypting, or disassembling of + this software is permitted. + +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. NO LICENSES OR OTHER RIGHTS, +WHETHER EXPRESS, IMPLIED, BASED ON ESTOPPEL OR OTHERWISE, ARE GRANTED +TO ANY PARTY'S PATENTS, PATENT APPLICATIONS, OR PATENTABLE INVENTIONS +BY VIRTUE OF THIS LICENSE OR THE DELIVERY OR PROVISION BY QUALCOMM +ATHEROS, INC. OF THE SOFTWARE. + +IN NO EVENT SHALL THE COPYRIGHT OWNER OR ANY CONTRIBUTOR BE LIABLE FOR +ANY 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 REGARDLESS OF ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF OR RESULTING FROM THE USE OF THE +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY +EVENT, THE TOTAL AGGREGATE LIABILITY THAT MAY BE IMPOSED ON QUALCOMM +ATHEROS, INC. FOR ANY DIRECT DAMAGES ARISING UNDER OR RESULTING FROM +THIS AGREEMENT OR IN CONNECTION WITH ANY USE OF THE SOFTWARE SHALL NOT +EXCEED A TOTAL AMOUNT OF US$5.00. + +IF ANY OF THE ABOVE PROVISIONS ARE HELD TO BE VOID, INVALID, +UNENFORCEABLE, OR ILLEGAL, THE OTHER PROVISIONS SHALL CONTINUE IN FULL +FORCE AND EFFECT. + diff --git a/packages/audio/alsa-utils/scripts/soundconfig b/packages/audio/alsa-utils/scripts/soundconfig index adf3b863e9..8c71e90c37 100755 --- a/packages/audio/alsa-utils/scripts/soundconfig +++ b/packages/audio/alsa-utils/scripts/soundconfig @@ -140,6 +140,10 @@ else mixer $card 'FRDDR_B SRC 1 EN' on mixer $card 'SPDIFOUT SRC SEL' 'IN 1' mixer $card 'SPDIFOUT Playback' on + +# Amlogic GX HDMI and S/PDIF + mixer $card 'AIU HDMI CTRL SRC' 'I2S' + mixer $card 'AIU SPDIF SRC SEL' 'SPDIF' fi exit 0 diff --git a/packages/linux-drivers/mali-bifrost/package.mk b/packages/linux-drivers/mali-bifrost/package.mk index acd4690379..a5fe88607b 100644 --- a/packages/linux-drivers/mali-bifrost/package.mk +++ b/packages/linux-drivers/mali-bifrost/package.mk @@ -2,8 +2,8 @@ # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mali-bifrost" -PKG_VERSION="61bf5319dfd266b72a96c9c2d518dbbde8514d66" # BX301A01B-SW-99002-r16p0-01rel0 -PKG_SHA256="b21d840586f24638d76d5a9684b812a4cb9415006f320a34db6f8b389cfb0a1c" +PKG_VERSION="af7c8d8bcdedd792a8d101d3a11876bb8bcbe3da" # BX301A01B-SW-99002-r16p0-01rel0 +PKG_SHA256="712ba83f28bf687e2147f0f586678421b0d2cb5620423e93e7b7c9ddf35c1da5" PKG_ARCH="arm aarch64" PKG_LICENSE="GPL" PKG_SITE="https://developer.arm.com/products/software/mali-drivers/bifrost-kernel" diff --git a/packages/linux-firmware/meson-firmware/firmwares/any.dat b/packages/linux-firmware/meson-firmware/firmwares/any.dat deleted file mode 100644 index 1eacf246f2..0000000000 --- a/packages/linux-firmware/meson-firmware/firmwares/any.dat +++ /dev/null @@ -1 +0,0 @@ -meson/* diff --git a/packages/linux-firmware/meson-firmware/package.mk b/packages/linux-firmware/meson-firmware/package.mk deleted file mode 100644 index 3df2c4acb1..0000000000 --- a/packages/linux-firmware/meson-firmware/package.mk +++ /dev/null @@ -1,43 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) - -PKG_NAME="meson-firmware" -PKG_VERSION="edd24b481293b93814494508cd4952b67f15acb3" -PKG_SHA256="2092c71a5eb106725784dadcc2cfea7be60254539a41fafebf311235283259e4" -PKG_LICENSE="GPLv2" -PKG_SITE="https://github.com/LibreELEC/meson-firmware" -PKG_URL="https://github.com/LibreELEC/meson-firmware/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_LONGDESC="meson-firmware: Amlogic microcode firmware for the V4L2 mem2mem vdec driver" -PKG_TOOLCHAIN="manual" - -makeinstall_target() { - FW_TARGET_DIR=$INSTALL/$(get_full_firmware_dir) - - if find_file_path config/$PKG_NAME.dat; then - FW_LISTS="${FOUND_PATH}" - else - FW_LISTS="${PKG_DIR}/firmwares/any.dat ${PKG_DIR}/firmwares/${TARGET_ARCH}.dat" - fi - - for fwlist in ${FW_LISTS}; do - [ -f ${fwlist} ] || continue - while read -r fwline; do - [ -z "${fwline}" ] && continue - [[ ${fwline} =~ ^#.* ]] && continue - [[ ${fwline} =~ ^[[:space:]] ]] && continue - - for fwfile in $(cd ${PKG_BUILD} && eval "find ${fwline}"); do - [ -d ${PKG_BUILD}/${fwfile} ] && continue - - if [ -f ${PKG_BUILD}/${fwfile} ]; then - mkdir -p $(dirname ${FW_TARGET_DIR}/${fwfile}) - cp -Lv ${PKG_BUILD}/${fwfile} ${FW_TARGET_DIR}/${fwfile} - else - echo "ERROR: Firmware file ${fwfile} does not exist - aborting" - exit 1 - fi - done - done < ${fwlist} - done -} diff --git a/packages/linux-firmware/qca-firmware/package.mk b/packages/linux-firmware/qca-firmware/package.mk new file mode 100644 index 0000000000..adfef0329f --- /dev/null +++ b/packages/linux-firmware/qca-firmware/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="qca-firmware" +PKG_VERSION="39d025c6d52085c529568c4e110ca6d0b290fef6" +PKG_SHA256="7af9e815f0cc5136819c9f7e02c548ea736d34c9a67ca065e5a693f4fdadb312" +PKG_LICENSE="QCA" +PKG_URL="https://github.com/LibreELEC/qca-firmware/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="qca-firmware: WiFi/BT firmware for QCA9377 SDIO modules" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_firmware_dir) + cp -a ath10k $INSTALL/$(get_full_firmware_dir) + cp -a qca $INSTALL/$(get_full_firmware_dir) +} diff --git a/packages/linux-firmware/qca-firmware/system.d/qca-firmware.service b/packages/linux-firmware/qca-firmware/system.d/qca-firmware.service new file mode 100644 index 0000000000..c294cd3868 --- /dev/null +++ b/packages/linux-firmware/qca-firmware/system.d/qca-firmware.service @@ -0,0 +1,13 @@ +[Unit] +Description=QCA Bluetooth Firmware Service +ConditionPathExists=/dev/ttyAML1 + +[Service] +Type=simple +RemainAfterExit=yes +ExecStart=/usr/bin/hciattach -n -s 115200 /dev/ttyAML1 qca 2000000 +Restart=always +RestartSec=2 +StartLimitInterval=0 +LimitNPROC=1 +TimeoutStopSec=1s diff --git a/packages/linux-firmware/qca-firmware/udev.d/80-qca-firmware.rules b/packages/linux-firmware/qca-firmware/udev.d/80-qca-firmware.rules new file mode 100644 index 0000000000..98d4ade1be --- /dev/null +++ b/packages/linux-firmware/qca-firmware/udev.d/80-qca-firmware.rules @@ -0,0 +1,6 @@ +######################################################## +# udev rules file for loading QCA9377 bluetooth firmware +######################################################## + +ACTION=="add", SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x0271", ATTRS{device}=="0x0701", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="qca-firmware.service" diff --git a/packages/linux/package.mk b/packages/linux/package.mk index 0137811656..1c9e7c24c6 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -16,8 +16,8 @@ PKG_PATCH_DIRS="$LINUX" case "$LINUX" in amlogic) - PKG_VERSION="4d856f72c10ecb060868ed10ff1b1453943fc6c8" # 5.3.0 - PKG_SHA256="d3d49f2f7c06dd5acfd0f3337690e10eb2a3401be12154d470b41c255e603b3b" + PKG_VERSION="98d54f81e36ba3bf92172791eba5ca5bd813989b" # 5.6-rc4 + PKG_SHA256="93d86760f8c2bc694c3a0ac6ceaa78034fe7d4026221d8480cd9696074d59a46" PKG_URL="https://github.com/torvalds/linux/archive/$PKG_VERSION.tar.gz" PKG_SOURCE_NAME="linux-$LINUX-$PKG_VERSION.tar.gz" PKG_PATCH_DIRS="amlogic" diff --git a/packages/linux/patches/amlogic/amlogic-0001-FROMGIT-drm-bridge-dw-hdmi-Use-automatic-CTS-generat.patch b/packages/linux/patches/amlogic/amlogic-0001-FROMGIT-drm-bridge-dw-hdmi-Use-automatic-CTS-generat.patch deleted file mode 100644 index 8967aeef74..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0001-FROMGIT-drm-bridge-dw-hdmi-Use-automatic-CTS-generat.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 4169a8c1d272251a1897ca3072ec9b27a04e90dc Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 12 Jun 2019 10:51:47 +0200 -Subject: [PATCH 001/187] FROMGIT: drm/bridge: dw-hdmi: Use automatic CTS - generation mode when using non-AHB audio - -When using an I2S source using a different clock source (usually the I2S -audio HW uses dedicated PLLs, different from the HDMI PHY PLL), fixed -CTS values will cause some frequent audio drop-out and glitches as -reported on Amlogic, Allwinner and Rockchip SoCs setups. - -Setting the CTS in automatic mode will let the HDMI controller generate -automatically the CTS value to match the input audio clock. - -The DesignWare DW-HDMI User Guide explains: - For Automatic CTS generation - Write "0" on the bit field "CTS_manual", Register 0x3205: AUD_CTS3 - -The DesignWare DW-HDMI Databook explains : - If "CTS_manual" bit equals 0b this registers contains "audCTS[19:0]" - generated by the Cycle time counter according to specified timing. - -Cc: Jernej Skrabec -Cc: Maxime Ripard -Cc: Jonas Karlman -Cc: Heiko Stuebner -Cc: Jerome Brunet -Signed-off-by: Neil Armstrong -Tested-by: Jernej Skrabec -Reviewed-by: Jernej Skrabec -Tested-by: Douglas Anderson -Signed-off-by: Andrzej Hajda -Link: https://patchwork.freedesktop.org/patch/msgid/20190612085147.26971-1-narmstrong@baylibre.com -(cherry-picked from fdbdcc83ffd7d00265a531e71f1d166566c09d66 - git://anongit.freedesktop.org/drm/drm-misc) ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 +++++++++++++++-------- - 1 file changed, 30 insertions(+), 15 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index c6490949d9db..218a7b2308f7 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -508,8 +508,14 @@ static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts, - /* nshift factor = 0 */ - hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3); - -- hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) | -- HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); -+ /* Use automatic CTS generation mode when CTS is not set */ -+ if (cts) -+ hdmi_writeb(hdmi, ((cts >> 16) & -+ HDMI_AUD_CTS3_AUDCTS19_16_MASK) | -+ HDMI_AUD_CTS3_CTS_MANUAL, -+ HDMI_AUD_CTS3); -+ else -+ hdmi_writeb(hdmi, 0, HDMI_AUD_CTS3); - hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2); - hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1); - -@@ -579,24 +585,33 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi, - { - unsigned long ftdms = pixel_clk; - unsigned int n, cts; -+ u8 config3; - u64 tmp; - - n = hdmi_compute_n(sample_rate, pixel_clk); - -- /* -- * Compute the CTS value from the N value. Note that CTS and N -- * can be up to 20 bits in total, so we need 64-bit math. Also -- * note that our TDMS clock is not fully accurate; it is accurate -- * to kHz. This can introduce an unnecessary remainder in the -- * calculation below, so we don't try to warn about that. -- */ -- tmp = (u64)ftdms * n; -- do_div(tmp, 128 * sample_rate); -- cts = tmp; -+ config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID); - -- dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n", -- __func__, sample_rate, ftdms / 1000000, (ftdms / 1000) % 1000, -- n, cts); -+ /* Only compute CTS when using internal AHB audio */ -+ if (config3 & HDMI_CONFIG3_AHBAUDDMA) { -+ /* -+ * Compute the CTS value from the N value. Note that CTS and N -+ * can be up to 20 bits in total, so we need 64-bit math. Also -+ * note that our TDMS clock is not fully accurate; it is -+ * accurate to kHz. This can introduce an unnecessary remainder -+ * in the calculation below, so we don't try to warn about that. -+ */ -+ tmp = (u64)ftdms * n; -+ do_div(tmp, 128 * sample_rate); -+ cts = tmp; -+ -+ dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n", -+ __func__, sample_rate, -+ ftdms / 1000000, (ftdms / 1000) % 1000, -+ n, cts); -+ } else { -+ cts = 0; -+ } - - spin_lock_irq(&hdmi->audio_lock); - hdmi->audio_n = n; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0001-FROMLIST-drm-panfrost-Don-t-try-to-map-on-error-faul.patch b/packages/linux/patches/amlogic/amlogic-0001-FROMLIST-drm-panfrost-Don-t-try-to-map-on-error-faul.patch new file mode 100644 index 0000000000..3cdc8f27ac --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0001-FROMLIST-drm-panfrost-Don-t-try-to-map-on-error-faul.patch @@ -0,0 +1,77 @@ +From 42f3bbd03e5f991da0e42d827addc859f3b9b117 Mon Sep 17 00:00:00 2001 +From: Tomeu Vizoso +Date: Mon, 24 Feb 2020 02:01:13 +0000 +Subject: [PATCH 001/146] FROMLIST: drm/panfrost: Don't try to map on error + faults + +If the exception type isn't a translation fault, don't try to map and +instead go straight to a terminal fault. + +Otherwise, we can get flooded by kernel warnings and further faults. + +Signed-off-by: Tomeu Vizoso +Signed-off-by: Rob Herring +--- + drivers/gpu/drm/panfrost/panfrost_mmu.c | 44 +++++++++++-------------- + 1 file changed, 19 insertions(+), 25 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c +index 3107b0738e40..5d75f8cf6477 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c +@@ -601,33 +601,27 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data) + source_id = (fault_status >> 16); + + /* Page fault only */ +- if ((status & mask) == BIT(i)) { +- WARN_ON(exception_type < 0xC1 || exception_type > 0xC4); +- ++ ret = -1; ++ if ((status & mask) == BIT(i) && (exception_type & 0xF8) == 0xC0) + ret = panfrost_mmu_map_fault_addr(pfdev, i, addr); +- if (!ret) { +- mmu_write(pfdev, MMU_INT_CLEAR, BIT(i)); +- status &= ~mask; +- continue; +- } +- } + +- /* terminal fault, print info about the fault */ +- dev_err(pfdev->dev, +- "Unhandled Page fault in AS%d at VA 0x%016llX\n" +- "Reason: %s\n" +- "raw fault status: 0x%X\n" +- "decoded fault status: %s\n" +- "exception type 0x%X: %s\n" +- "access type 0x%X: %s\n" +- "source id 0x%X\n", +- i, addr, +- "TODO", +- fault_status, +- (fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"), +- exception_type, panfrost_exception_name(pfdev, exception_type), +- access_type, access_type_name(pfdev, fault_status), +- source_id); ++ if (ret) ++ /* terminal fault, print info about the fault */ ++ dev_err(pfdev->dev, ++ "Unhandled Page fault in AS%d at VA 0x%016llX\n" ++ "Reason: %s\n" ++ "raw fault status: 0x%X\n" ++ "decoded fault status: %s\n" ++ "exception type 0x%X: %s\n" ++ "access type 0x%X: %s\n" ++ "source id 0x%X\n", ++ i, addr, ++ "TODO", ++ fault_status, ++ (fault_status & (1 << 10) ? "DECODER FAULT" : "SLAVE FAULT"), ++ exception_type, panfrost_exception_name(pfdev, exception_type), ++ access_type, access_type_name(pfdev, fault_status), ++ source_id); + + mmu_write(pfdev, MMU_INT_CLEAR, mask); + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-clk-meson-g12a-fix-hifi-typo-in-mali-parent_.patch b/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-clk-meson-g12a-fix-hifi-typo-in-mali-parent_.patch deleted file mode 100644 index 3e08e4bcc1..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-clk-meson-g12a-fix-hifi-typo-in-mali-parent_.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0d38ee3d8b2f937e774b0072711fe6b49fc66cd0 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Fri, 24 May 2019 11:15:32 +0200 -Subject: [PATCH 002/187] FROMGIT: clk: meson: g12a: fix hifi typo in mali - parent_names - -Replace hihi by hifi in the mali parent_names of the g12a SoC family. - -Fixes: 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller") -Signed-off-by: Alexandre Mergnat -Acked-by: Neil Armstrong -Reviewed-by: Martin Blumenstingl -Signed-off-by: Jerome Brunet -(cherry picked from commit b6297d9e078a4127fb608ede4d0944855dde667d - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/g12a.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c -index db1c4ed9d54e..7bc5566b66f7 100644 ---- a/drivers/clk/meson/g12a.c -+++ b/drivers/clk/meson/g12a.c -@@ -2888,7 +2888,7 @@ static struct clk_regmap g12a_hdmi = { - */ - - static const char * const g12a_mali_0_1_parent_names[] = { -- IN_PREFIX "xtal", "gp0_pll", "hihi_pll", "fclk_div2p5", -+ IN_PREFIX "xtal", "gp0_pll", "hifi_pll", "fclk_div2p5", - "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7" - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-drm-lima-update-register-info.patch b/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-drm-lima-update-register-info.patch new file mode 100644 index 0000000000..e1ced805e5 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-drm-lima-update-register-info.patch @@ -0,0 +1,30 @@ +From 72475ec15080b4a976c3815261723a91bb9a755b Mon Sep 17 00:00:00 2001 +From: Qiang Yu +Date: Thu, 16 Jan 2020 21:11:53 +0800 +Subject: [PATCH 002/146] FROMGIT: drm/lima: update register info + +From Mali r10p0 kernel driver source code. + +Reviewed-by: Vasily Khoruzhick +Tested-by: Andreas Baierl +Signed-off-by: Qiang Yu +Link: https://patchwork.freedesktop.org/patch/msgid/20200116131157.13346-2-yuq825@gmail.com +--- + drivers/gpu/drm/lima/lima_regs.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/lima/lima_regs.h b/drivers/gpu/drm/lima/lima_regs.h +index ace8ecefbe90..0124c90e0153 100644 +--- a/drivers/gpu/drm/lima/lima_regs.h ++++ b/drivers/gpu/drm/lima/lima_regs.h +@@ -239,6 +239,7 @@ + #define LIMA_MMU_STATUS_REPLAY_BUFFER_EMPTY BIT(4) + #define LIMA_MMU_STATUS_PAGE_FAULT_IS_WRITE BIT(5) + #define LIMA_MMU_STATUS_BUS_ID(x) ((x >> 6) & 0x1F) ++#define LIMA_MMU_STATUS_STALL_NOT_ACTIVE BIT(31) + #define LIMA_MMU_COMMAND 0x0008 + #define LIMA_MMU_COMMAND_ENABLE_PAGING 0x00 + #define LIMA_MMU_COMMAND_DISABLE_PAGING 0x01 +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-clk-meson-axg-audio-migrate-to-the-new-paren.patch b/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-clk-meson-axg-audio-migrate-to-the-new-paren.patch deleted file mode 100644 index d742eaf591..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-clk-meson-axg-audio-migrate-to-the-new-paren.patch +++ /dev/null @@ -1,534 +0,0 @@ -From 2ae77fa279fc6bf3006d0d28b3c809cb3f09813e Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:40:23 +0200 -Subject: [PATCH 003/187] FROMGIT: clk: meson: axg-audio: migrate to the new - parent description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. A recent patch [0] -allows parents to be specified without string names or with device-tree -clock name by using a new assignment structure. - -Migrate to the new way by using .parent_hws where possible (when parent -clocks are localy declared in the controller) and use .parent_data -otherwise. - -Remove clk input helper and all bypass clocks (declared in probe function) -which are no longer used since we are able to use device-tree clock name -directly. - -[0] commit fc0c209c147f ("clk: Allow parents to be specified without string names") - -Signed-off-by: Alexandre Mergnat -[jbrunet@baylibre.com: remove CLK_SET_RATE_PARENT from mst muxes] -Signed-off-by: Jerome Brunet -(cherry picked from commit 282420eed23f237963f2033b2f2bedb90fbcc5e1 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/Kconfig | 1 - - drivers/clk/meson/axg-audio.c | 261 ++++++++++++++++------------------ - 2 files changed, 120 insertions(+), 142 deletions(-) - -diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig -index a6b20e123e0c..ee0b84b6b329 100644 ---- a/drivers/clk/meson/Kconfig -+++ b/drivers/clk/meson/Kconfig -@@ -86,7 +86,6 @@ config COMMON_CLK_AXG - config COMMON_CLK_AXG_AUDIO - tristate "Meson AXG Audio Clock Controller Driver" - depends on ARCH_MESON -- select COMMON_CLK_MESON_INPUT - select COMMON_CLK_MESON_REGMAP - select COMMON_CLK_MESON_PHASE - select COMMON_CLK_MESON_SCLK_DIV -diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c -index 8028ff6f6610..741df7e955ca 100644 ---- a/drivers/clk/meson/axg-audio.c -+++ b/drivers/clk/meson/axg-audio.c -@@ -15,7 +15,6 @@ - #include - - #include "axg-audio.h" --#include "clk-input.h" - #include "clk-regmap.h" - #include "clk-phase.h" - #include "sclk-div.h" -@@ -24,7 +23,7 @@ - #define AUD_SLV_SCLK_COUNT 10 - #define AUD_SLV_LRCLK_COUNT 10 - --#define AUD_GATE(_name, _reg, _bit, _pname, _iflags) \ -+#define AUD_GATE(_name, _reg, _bit, _phws, _iflags) \ - struct clk_regmap aud_##_name = { \ - .data = &(struct clk_regmap_gate_data){ \ - .offset = (_reg), \ -@@ -33,13 +32,13 @@ struct clk_regmap aud_##_name = { \ - .hw.init = &(struct clk_init_data) { \ - .name = "aud_"#_name, \ - .ops = &clk_regmap_gate_ops, \ -- .parent_names = (const char *[]){ _pname }, \ -+ .parent_hws = (const struct clk_hw *[]) { &_phws.hw }, \ - .num_parents = 1, \ - .flags = CLK_DUTY_CYCLE_PARENT | (_iflags), \ - }, \ - } - --#define AUD_MUX(_name, _reg, _mask, _shift, _dflags, _pnames, _iflags) \ -+#define AUD_MUX(_name, _reg, _mask, _shift, _dflags, _pdata, _iflags) \ - struct clk_regmap aud_##_name = { \ - .data = &(struct clk_regmap_mux_data){ \ - .offset = (_reg), \ -@@ -50,13 +49,13 @@ struct clk_regmap aud_##_name = { \ - .hw.init = &(struct clk_init_data){ \ - .name = "aud_"#_name, \ - .ops = &clk_regmap_mux_ops, \ -- .parent_names = (_pnames), \ -- .num_parents = ARRAY_SIZE(_pnames), \ -+ .parent_data = _pdata, \ -+ .num_parents = ARRAY_SIZE(_pdata), \ - .flags = CLK_DUTY_CYCLE_PARENT | (_iflags), \ - }, \ - } - --#define AUD_DIV(_name, _reg, _shift, _width, _dflags, _pname, _iflags) \ -+#define AUD_DIV(_name, _reg, _shift, _width, _dflags, _phws, _iflags) \ - struct clk_regmap aud_##_name = { \ - .data = &(struct clk_regmap_div_data){ \ - .offset = (_reg), \ -@@ -67,15 +66,27 @@ struct clk_regmap aud_##_name = { \ - .hw.init = &(struct clk_init_data){ \ - .name = "aud_"#_name, \ - .ops = &clk_regmap_divider_ops, \ -- .parent_names = (const char *[]) { _pname }, \ -+ .parent_hws = (const struct clk_hw *[]) { &_phws.hw }, \ - .num_parents = 1, \ - .flags = (_iflags), \ - }, \ - } - - #define AUD_PCLK_GATE(_name, _bit) \ -- AUD_GATE(_name, AUDIO_CLK_GATE_EN, _bit, "audio_pclk", 0) -- -+struct clk_regmap aud_##_name = { \ -+ .data = &(struct clk_regmap_gate_data){ \ -+ .offset = (AUDIO_CLK_GATE_EN), \ -+ .bit_idx = (_bit), \ -+ }, \ -+ .hw.init = &(struct clk_init_data) { \ -+ .name = "aud_"#_name, \ -+ .ops = &clk_regmap_gate_ops, \ -+ .parent_data = &(const struct clk_parent_data) { \ -+ .fw_name = "pclk", \ -+ }, \ -+ .num_parents = 1, \ -+ }, \ -+} - /* Audio peripheral clocks */ - static AUD_PCLK_GATE(ddr_arb, 0); - static AUD_PCLK_GATE(pdm, 1); -@@ -100,14 +111,20 @@ static AUD_PCLK_GATE(power_detect, 19); - static AUD_PCLK_GATE(spdifout_b, 21); - - /* Audio Master Clocks */ --static const char * const mst_mux_parent_names[] = { -- "aud_mst_in0", "aud_mst_in1", "aud_mst_in2", "aud_mst_in3", -- "aud_mst_in4", "aud_mst_in5", "aud_mst_in6", "aud_mst_in7", -+static const struct clk_parent_data mst_mux_parent_data[] = { -+ { .fw_name = "mst_in0", }, -+ { .fw_name = "mst_in1", }, -+ { .fw_name = "mst_in2", }, -+ { .fw_name = "mst_in3", }, -+ { .fw_name = "mst_in4", }, -+ { .fw_name = "mst_in5", }, -+ { .fw_name = "mst_in6", }, -+ { .fw_name = "mst_in7", }, - }; - - #define AUD_MST_MUX(_name, _reg, _flag) \ - AUD_MUX(_name##_sel, _reg, 0x7, 24, _flag, \ -- mst_mux_parent_names, CLK_SET_RATE_PARENT) -+ mst_mux_parent_data, 0) - - #define AUD_MST_MCLK_MUX(_name, _reg) \ - AUD_MST_MUX(_name, _reg, CLK_MUX_ROUND_CLOSEST) -@@ -129,7 +146,7 @@ static AUD_MST_MCLK_MUX(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL); - - #define AUD_MST_DIV(_name, _reg, _flag) \ - AUD_DIV(_name##_div, _reg, 0, 16, _flag, \ -- "aud_"#_name"_sel", CLK_SET_RATE_PARENT) \ -+ aud_##_name##_sel, CLK_SET_RATE_PARENT) \ - - #define AUD_MST_MCLK_DIV(_name, _reg) \ - AUD_MST_DIV(_name, _reg, CLK_DIVIDER_ROUND_CLOSEST) -@@ -150,7 +167,7 @@ static AUD_MST_SYS_DIV(pdm_sysclk, AUDIO_CLK_PDMIN_CTRL1); - static AUD_MST_MCLK_DIV(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL); - - #define AUD_MST_MCLK_GATE(_name, _reg) \ -- AUD_GATE(_name, _reg, 31, "aud_"#_name"_div", \ -+ AUD_GATE(_name, _reg, 31, aud_##_name##_div, \ - CLK_SET_RATE_PARENT) - - static AUD_MST_MCLK_GATE(mst_a_mclk, AUDIO_MCLK_A_CTRL); -@@ -168,7 +185,7 @@ static AUD_MST_MCLK_GATE(spdifout_b_clk, AUDIO_CLK_SPDIFOUT_B_CTRL); - /* Sample Clocks */ - #define AUD_MST_SCLK_PRE_EN(_name, _reg) \ - AUD_GATE(mst_##_name##_sclk_pre_en, _reg, 31, \ -- "aud_mst_"#_name"_mclk", 0) -+ aud_mst_##_name##_mclk, 0) - - static AUD_MST_SCLK_PRE_EN(a, AUDIO_MST_A_SCLK_CTRL0); - static AUD_MST_SCLK_PRE_EN(b, AUDIO_MST_B_SCLK_CTRL0); -@@ -178,7 +195,7 @@ static AUD_MST_SCLK_PRE_EN(e, AUDIO_MST_E_SCLK_CTRL0); - static AUD_MST_SCLK_PRE_EN(f, AUDIO_MST_F_SCLK_CTRL0); - - #define AUD_SCLK_DIV(_name, _reg, _div_shift, _div_width, \ -- _hi_shift, _hi_width, _pname, _iflags) \ -+ _hi_shift, _hi_width, _phws, _iflags) \ - struct clk_regmap aud_##_name = { \ - .data = &(struct meson_sclk_div_data) { \ - .div = { \ -@@ -195,7 +212,7 @@ struct clk_regmap aud_##_name = { \ - .hw.init = &(struct clk_init_data) { \ - .name = "aud_"#_name, \ - .ops = &meson_sclk_div_ops, \ -- .parent_names = (const char *[]) { _pname }, \ -+ .parent_hws = (const struct clk_hw *[]) { &_phws.hw }, \ - .num_parents = 1, \ - .flags = (_iflags), \ - }, \ -@@ -203,7 +220,7 @@ struct clk_regmap aud_##_name = { \ - - #define AUD_MST_SCLK_DIV(_name, _reg) \ - AUD_SCLK_DIV(mst_##_name##_sclk_div, _reg, 20, 10, 0, 0, \ -- "aud_mst_"#_name"_sclk_pre_en", \ -+ aud_mst_##_name##_sclk_pre_en, \ - CLK_SET_RATE_PARENT) - - static AUD_MST_SCLK_DIV(a, AUDIO_MST_A_SCLK_CTRL0); -@@ -214,8 +231,8 @@ static AUD_MST_SCLK_DIV(e, AUDIO_MST_E_SCLK_CTRL0); - static AUD_MST_SCLK_DIV(f, AUDIO_MST_F_SCLK_CTRL0); - - #define AUD_MST_SCLK_POST_EN(_name, _reg) \ -- AUD_GATE(mst_##_name##_sclk_post_en, _reg, 30, \ -- "aud_mst_"#_name"_sclk_div", CLK_SET_RATE_PARENT) -+ AUD_GATE(mst_##_name##_sclk_post_en, _reg, 30, \ -+ aud_mst_##_name##_sclk_div, CLK_SET_RATE_PARENT) - - static AUD_MST_SCLK_POST_EN(a, AUDIO_MST_A_SCLK_CTRL0); - static AUD_MST_SCLK_POST_EN(b, AUDIO_MST_B_SCLK_CTRL0); -@@ -224,8 +241,8 @@ static AUD_MST_SCLK_POST_EN(d, AUDIO_MST_D_SCLK_CTRL0); - static AUD_MST_SCLK_POST_EN(e, AUDIO_MST_E_SCLK_CTRL0); - static AUD_MST_SCLK_POST_EN(f, AUDIO_MST_F_SCLK_CTRL0); - --#define AUD_TRIPHASE(_name, _reg, _width, _shift0, _shift1, _shift2, \ -- _pname, _iflags) \ -+#define AUD_TRIPHASE(_name, _reg, _width, _shift0, _shift1, _shift2, \ -+ _phws, _iflags) \ - struct clk_regmap aud_##_name = { \ - .data = &(struct meson_clk_triphase_data) { \ - .ph0 = { \ -@@ -247,7 +264,7 @@ struct clk_regmap aud_##_name = { \ - .hw.init = &(struct clk_init_data) { \ - .name = "aud_"#_name, \ - .ops = &meson_clk_triphase_ops, \ -- .parent_names = (const char *[]) { _pname }, \ -+ .parent_hws = (const struct clk_hw *[]) { &_phws.hw }, \ - .num_parents = 1, \ - .flags = CLK_DUTY_CYCLE_PARENT | (_iflags), \ - }, \ -@@ -255,7 +272,7 @@ struct clk_regmap aud_##_name = { \ - - #define AUD_MST_SCLK(_name, _reg) \ - AUD_TRIPHASE(mst_##_name##_sclk, _reg, 1, 0, 2, 4, \ -- "aud_mst_"#_name"_sclk_post_en", CLK_SET_RATE_PARENT) -+ aud_mst_##_name##_sclk_post_en, CLK_SET_RATE_PARENT) - - static AUD_MST_SCLK(a, AUDIO_MST_A_SCLK_CTRL1); - static AUD_MST_SCLK(b, AUDIO_MST_B_SCLK_CTRL1); -@@ -266,7 +283,7 @@ static AUD_MST_SCLK(f, AUDIO_MST_F_SCLK_CTRL1); - - #define AUD_MST_LRCLK_DIV(_name, _reg) \ - AUD_SCLK_DIV(mst_##_name##_lrclk_div, _reg, 0, 10, 10, 10, \ -- "aud_mst_"#_name"_sclk_post_en", 0) \ -+ aud_mst_##_name##_sclk_post_en, 0) \ - - static AUD_MST_LRCLK_DIV(a, AUDIO_MST_A_SCLK_CTRL0); - static AUD_MST_LRCLK_DIV(b, AUDIO_MST_B_SCLK_CTRL0); -@@ -277,7 +294,7 @@ static AUD_MST_LRCLK_DIV(f, AUDIO_MST_F_SCLK_CTRL0); - - #define AUD_MST_LRCLK(_name, _reg) \ - AUD_TRIPHASE(mst_##_name##_lrclk, _reg, 1, 1, 3, 5, \ -- "aud_mst_"#_name"_lrclk_div", CLK_SET_RATE_PARENT) -+ aud_mst_##_name##_lrclk_div, CLK_SET_RATE_PARENT) - - static AUD_MST_LRCLK(a, AUDIO_MST_A_SCLK_CTRL1); - static AUD_MST_LRCLK(b, AUDIO_MST_B_SCLK_CTRL1); -@@ -286,19 +303,29 @@ static AUD_MST_LRCLK(d, AUDIO_MST_D_SCLK_CTRL1); - static AUD_MST_LRCLK(e, AUDIO_MST_E_SCLK_CTRL1); - static AUD_MST_LRCLK(f, AUDIO_MST_F_SCLK_CTRL1); - --static const char * const tdm_sclk_parent_names[] = { -- "aud_mst_a_sclk", "aud_mst_b_sclk", "aud_mst_c_sclk", -- "aud_mst_d_sclk", "aud_mst_e_sclk", "aud_mst_f_sclk", -- "aud_slv_sclk0", "aud_slv_sclk1", "aud_slv_sclk2", -- "aud_slv_sclk3", "aud_slv_sclk4", "aud_slv_sclk5", -- "aud_slv_sclk6", "aud_slv_sclk7", "aud_slv_sclk8", -- "aud_slv_sclk9" -+static const struct clk_parent_data tdm_sclk_parent_data[] = { -+ { .hw = &aud_mst_a_sclk.hw, }, -+ { .hw = &aud_mst_b_sclk.hw, }, -+ { .hw = &aud_mst_c_sclk.hw, }, -+ { .hw = &aud_mst_d_sclk.hw, }, -+ { .hw = &aud_mst_e_sclk.hw, }, -+ { .hw = &aud_mst_f_sclk.hw, }, -+ { .fw_name = "slv_sclk0", }, -+ { .fw_name = "slv_sclk1", }, -+ { .fw_name = "slv_sclk2", }, -+ { .fw_name = "slv_sclk3", }, -+ { .fw_name = "slv_sclk4", }, -+ { .fw_name = "slv_sclk5", }, -+ { .fw_name = "slv_sclk6", }, -+ { .fw_name = "slv_sclk7", }, -+ { .fw_name = "slv_sclk8", }, -+ { .fw_name = "slv_sclk9", }, - }; - - #define AUD_TDM_SCLK_MUX(_name, _reg) \ - AUD_MUX(tdm##_name##_sclk_sel, _reg, 0xf, 24, \ - CLK_MUX_ROUND_CLOSEST, \ -- tdm_sclk_parent_names, 0) -+ tdm_sclk_parent_data, 0) - - static AUD_TDM_SCLK_MUX(in_a, AUDIO_CLK_TDMIN_A_CTRL); - static AUD_TDM_SCLK_MUX(in_b, AUDIO_CLK_TDMIN_B_CTRL); -@@ -310,7 +337,7 @@ static AUD_TDM_SCLK_MUX(out_c, AUDIO_CLK_TDMOUT_C_CTRL); - - #define AUD_TDM_SCLK_PRE_EN(_name, _reg) \ - AUD_GATE(tdm##_name##_sclk_pre_en, _reg, 31, \ -- "aud_tdm"#_name"_sclk_sel", CLK_SET_RATE_PARENT) -+ aud_tdm##_name##_sclk_sel, CLK_SET_RATE_PARENT) - - static AUD_TDM_SCLK_PRE_EN(in_a, AUDIO_CLK_TDMIN_A_CTRL); - static AUD_TDM_SCLK_PRE_EN(in_b, AUDIO_CLK_TDMIN_B_CTRL); -@@ -322,7 +349,7 @@ static AUD_TDM_SCLK_PRE_EN(out_c, AUDIO_CLK_TDMOUT_C_CTRL); - - #define AUD_TDM_SCLK_POST_EN(_name, _reg) \ - AUD_GATE(tdm##_name##_sclk_post_en, _reg, 30, \ -- "aud_tdm"#_name"_sclk_pre_en", CLK_SET_RATE_PARENT) -+ aud_tdm##_name##_sclk_pre_en, CLK_SET_RATE_PARENT) - - static AUD_TDM_SCLK_POST_EN(in_a, AUDIO_CLK_TDMIN_A_CTRL); - static AUD_TDM_SCLK_POST_EN(in_b, AUDIO_CLK_TDMIN_B_CTRL); -@@ -344,8 +371,9 @@ static AUD_TDM_SCLK_POST_EN(out_c, AUDIO_CLK_TDMOUT_C_CTRL); - .hw.init = &(struct clk_init_data) { \ - .name = "aud_tdm"#_name"_sclk", \ - .ops = &meson_clk_phase_ops, \ -- .parent_names = (const char *[]) \ -- { "aud_tdm"#_name"_sclk_post_en" }, \ -+ .parent_hws = (const struct clk_hw *[]) { \ -+ &aud_tdm##_name##_sclk_post_en.hw \ -+ }, \ - .num_parents = 1, \ - .flags = CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT, \ - }, \ -@@ -359,19 +387,29 @@ static AUD_TDM_SCLK(out_a, AUDIO_CLK_TDMOUT_A_CTRL); - static AUD_TDM_SCLK(out_b, AUDIO_CLK_TDMOUT_B_CTRL); - static AUD_TDM_SCLK(out_c, AUDIO_CLK_TDMOUT_C_CTRL); - --static const char * const tdm_lrclk_parent_names[] = { -- "aud_mst_a_lrclk", "aud_mst_b_lrclk", "aud_mst_c_lrclk", -- "aud_mst_d_lrclk", "aud_mst_e_lrclk", "aud_mst_f_lrclk", -- "aud_slv_lrclk0", "aud_slv_lrclk1", "aud_slv_lrclk2", -- "aud_slv_lrclk3", "aud_slv_lrclk4", "aud_slv_lrclk5", -- "aud_slv_lrclk6", "aud_slv_lrclk7", "aud_slv_lrclk8", -- "aud_slv_lrclk9" -+static const struct clk_parent_data tdm_lrclk_parent_data[] = { -+ { .hw = &aud_mst_a_lrclk.hw, }, -+ { .hw = &aud_mst_b_lrclk.hw, }, -+ { .hw = &aud_mst_c_lrclk.hw, }, -+ { .hw = &aud_mst_d_lrclk.hw, }, -+ { .hw = &aud_mst_e_lrclk.hw, }, -+ { .hw = &aud_mst_f_lrclk.hw, }, -+ { .fw_name = "slv_lrclk0", }, -+ { .fw_name = "slv_lrclk1", }, -+ { .fw_name = "slv_lrclk2", }, -+ { .fw_name = "slv_lrclk3", }, -+ { .fw_name = "slv_lrclk4", }, -+ { .fw_name = "slv_lrclk5", }, -+ { .fw_name = "slv_lrclk6", }, -+ { .fw_name = "slv_lrclk7", }, -+ { .fw_name = "slv_lrclk8", }, -+ { .fw_name = "slv_lrclk9", }, - }; - --#define AUD_TDM_LRLCK(_name, _reg) \ -- AUD_MUX(tdm##_name##_lrclk, _reg, 0xf, 20, \ -- CLK_MUX_ROUND_CLOSEST, \ -- tdm_lrclk_parent_names, 0) -+#define AUD_TDM_LRLCK(_name, _reg) \ -+ AUD_MUX(tdm##_name##_lrclk, _reg, 0xf, 20, \ -+ CLK_MUX_ROUND_CLOSEST, \ -+ tdm_lrclk_parent_data, 0) - - static AUD_TDM_LRLCK(in_a, AUDIO_CLK_TDMIN_A_CTRL); - static AUD_TDM_LRLCK(in_b, AUDIO_CLK_TDMIN_B_CTRL); -@@ -386,39 +424,51 @@ static AUD_TDM_LRLCK(out_c, AUDIO_CLK_TDMOUT_C_CTRL); - AUD_MUX(tdm_##_name, _reg, 0x7, _shift, 0, _parents, \ - CLK_SET_RATE_NO_REPARENT) - --static const char * const mclk_pad_ctrl_parent_names[] = { -- "aud_mst_a_mclk", "aud_mst_b_mclk", "aud_mst_c_mclk", -- "aud_mst_d_mclk", "aud_mst_e_mclk", "aud_mst_f_mclk", -+static const struct clk_parent_data mclk_pad_ctrl_parent_data[] = { -+ { .hw = &aud_mst_a_mclk.hw }, -+ { .hw = &aud_mst_b_mclk.hw }, -+ { .hw = &aud_mst_c_mclk.hw }, -+ { .hw = &aud_mst_d_mclk.hw }, -+ { .hw = &aud_mst_e_mclk.hw }, -+ { .hw = &aud_mst_f_mclk.hw }, - }; - - static AUD_TDM_PAD_CTRL(mclk_pad_0, AUDIO_MST_PAD_CTRL0, 0, -- mclk_pad_ctrl_parent_names); -+ mclk_pad_ctrl_parent_data); - static AUD_TDM_PAD_CTRL(mclk_pad_1, AUDIO_MST_PAD_CTRL0, 4, -- mclk_pad_ctrl_parent_names); -- --static const char * const lrclk_pad_ctrl_parent_names[] = { -- "aud_mst_a_lrclk", "aud_mst_b_lrclk", "aud_mst_c_lrclk", -- "aud_mst_d_lrclk", "aud_mst_e_lrclk", "aud_mst_f_lrclk", -+ mclk_pad_ctrl_parent_data); -+ -+static const struct clk_parent_data lrclk_pad_ctrl_parent_data[] = { -+ { .hw = &aud_mst_a_lrclk.hw }, -+ { .hw = &aud_mst_b_lrclk.hw }, -+ { .hw = &aud_mst_c_lrclk.hw }, -+ { .hw = &aud_mst_d_lrclk.hw }, -+ { .hw = &aud_mst_e_lrclk.hw }, -+ { .hw = &aud_mst_f_lrclk.hw }, - }; - - static AUD_TDM_PAD_CTRL(lrclk_pad_0, AUDIO_MST_PAD_CTRL1, 16, -- lrclk_pad_ctrl_parent_names); -+ lrclk_pad_ctrl_parent_data); - static AUD_TDM_PAD_CTRL(lrclk_pad_1, AUDIO_MST_PAD_CTRL1, 20, -- lrclk_pad_ctrl_parent_names); -+ lrclk_pad_ctrl_parent_data); - static AUD_TDM_PAD_CTRL(lrclk_pad_2, AUDIO_MST_PAD_CTRL1, 24, -- lrclk_pad_ctrl_parent_names); -- --static const char * const sclk_pad_ctrl_parent_names[] = { -- "aud_mst_a_sclk", "aud_mst_b_sclk", "aud_mst_c_sclk", -- "aud_mst_d_sclk", "aud_mst_e_sclk", "aud_mst_f_sclk", -+ lrclk_pad_ctrl_parent_data); -+ -+static const struct clk_parent_data sclk_pad_ctrl_parent_data[] = { -+ { .hw = &aud_mst_a_sclk.hw }, -+ { .hw = &aud_mst_b_sclk.hw }, -+ { .hw = &aud_mst_c_sclk.hw }, -+ { .hw = &aud_mst_d_sclk.hw }, -+ { .hw = &aud_mst_e_sclk.hw }, -+ { .hw = &aud_mst_f_sclk.hw }, - }; - - static AUD_TDM_PAD_CTRL(sclk_pad_0, AUDIO_MST_PAD_CTRL1, 0, -- sclk_pad_ctrl_parent_names); -+ sclk_pad_ctrl_parent_data); - static AUD_TDM_PAD_CTRL(sclk_pad_1, AUDIO_MST_PAD_CTRL1, 4, -- sclk_pad_ctrl_parent_names); -+ sclk_pad_ctrl_parent_data); - static AUD_TDM_PAD_CTRL(sclk_pad_2, AUDIO_MST_PAD_CTRL1, 8, -- sclk_pad_ctrl_parent_names); -+ sclk_pad_ctrl_parent_data); - - /* - * Array of all clocks provided by this provider -@@ -868,54 +918,6 @@ static int devm_clk_get_enable(struct device *dev, char *id) - return 0; - } - --static int axg_register_clk_hw_input(struct device *dev, -- const char *name) --{ -- char *clk_name; -- struct clk_hw *hw; -- int err = 0; -- -- clk_name = kasprintf(GFP_KERNEL, "aud_%s", name); -- if (!clk_name) -- return -ENOMEM; -- -- hw = meson_clk_hw_register_input(dev, name, clk_name, 0); -- if (IS_ERR(hw)) { -- /* It is ok if an input clock is missing */ -- if (PTR_ERR(hw) == -ENOENT) { -- dev_dbg(dev, "%s not provided", name); -- } else { -- err = PTR_ERR(hw); -- if (err != -EPROBE_DEFER) -- dev_err(dev, "failed to get %s clock", name); -- } -- } -- -- kfree(clk_name); -- return err; --} -- --static int axg_register_clk_hw_inputs(struct device *dev, -- const char *basename, -- unsigned int count) --{ -- char *name; -- int i, ret; -- -- for (i = 0; i < count; i++) { -- name = kasprintf(GFP_KERNEL, "%s%d", basename, i); -- if (!name) -- return -ENOMEM; -- -- ret = axg_register_clk_hw_input(dev, name); -- kfree(name); -- if (ret) -- return ret; -- } -- -- return 0; --} -- - static const struct regmap_config axg_audio_regmap_cfg = { - .reg_bits = 32, - .val_bits = 32, -@@ -963,29 +965,6 @@ static int axg_audio_clkc_probe(struct platform_device *pdev) - return ret; - } - -- /* Register the peripheral input clock */ -- hw = meson_clk_hw_register_input(dev, "pclk", "audio_pclk", 0); -- if (IS_ERR(hw)) -- return PTR_ERR(hw); -- -- /* Register optional input master clocks */ -- ret = axg_register_clk_hw_inputs(dev, "mst_in", -- AUD_MST_IN_COUNT); -- if (ret) -- return ret; -- -- /* Register optional input slave sclks */ -- ret = axg_register_clk_hw_inputs(dev, "slv_sclk", -- AUD_SLV_SCLK_COUNT); -- if (ret) -- return ret; -- -- /* Register optional input slave lrclks */ -- ret = axg_register_clk_hw_inputs(dev, "slv_lrclk", -- AUD_SLV_LRCLK_COUNT); -- if (ret) -- return ret; -- - /* Populate regmap for the regmap backed clocks */ - for (i = 0; i < ARRAY_SIZE(aud_clk_regmaps); i++) - aud_clk_regmaps[i]->map = map; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-drm-lima-add-lima_vm_map_bo.patch b/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-drm-lima-add-lima_vm_map_bo.patch new file mode 100644 index 0000000000..5ec5f96e6e --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-drm-lima-add-lima_vm_map_bo.patch @@ -0,0 +1,81 @@ +From afbc6ad4851f6df5e6e0befa8d3fe8d664e688e7 Mon Sep 17 00:00:00 2001 +From: Qiang Yu +Date: Thu, 16 Jan 2020 21:11:54 +0800 +Subject: [PATCH 003/146] FROMGIT: drm/lima: add lima_vm_map_bo + +For dynamically mapping added backup memory of lima_bo to vm. +This is a preparation for adding heap buffer support. + +Reviewed-by: Vasily Khoruzhick +Tested-by: Andreas Baierl +Signed-off-by: Qiang Yu +Link: https://patchwork.freedesktop.org/patch/msgid/20200116131157.13346-3-yuq825@gmail.com +--- + drivers/gpu/drm/lima/lima_vm.c | 42 ++++++++++++++++++++++++++++++++++ + drivers/gpu/drm/lima/lima_vm.h | 1 + + 2 files changed, 43 insertions(+) + +diff --git a/drivers/gpu/drm/lima/lima_vm.c b/drivers/gpu/drm/lima/lima_vm.c +index 840e2350d872..2e513841de6c 100644 +--- a/drivers/gpu/drm/lima/lima_vm.c ++++ b/drivers/gpu/drm/lima/lima_vm.c +@@ -277,3 +277,45 @@ void lima_vm_print(struct lima_vm *vm) + } + } + } ++ ++int lima_vm_map_bo(struct lima_vm *vm, struct lima_bo *bo, int pageoff) ++{ ++ struct lima_bo_va *bo_va; ++ struct sg_dma_page_iter sg_iter; ++ int offset = 0, err; ++ u32 base; ++ ++ mutex_lock(&bo->lock); ++ ++ bo_va = lima_vm_bo_find(vm, bo); ++ if (!bo_va) { ++ err = -ENOENT; ++ goto err_out0; ++ } ++ ++ mutex_lock(&vm->lock); ++ ++ base = bo_va->node.start + (pageoff << PAGE_SHIFT); ++ for_each_sg_dma_page(bo->base.sgt->sgl, &sg_iter, ++ bo->base.sgt->nents, pageoff) { ++ err = lima_vm_map_page(vm, sg_page_iter_dma_address(&sg_iter), ++ base + offset); ++ if (err) ++ goto err_out1; ++ ++ offset += PAGE_SIZE; ++ } ++ ++ mutex_unlock(&vm->lock); ++ ++ mutex_unlock(&bo->lock); ++ return 0; ++ ++err_out1: ++ if (offset) ++ lima_vm_unmap_range(vm, base, base + offset - 1); ++ mutex_unlock(&vm->lock); ++err_out0: ++ mutex_unlock(&bo->lock); ++ return err; ++} +diff --git a/drivers/gpu/drm/lima/lima_vm.h b/drivers/gpu/drm/lima/lima_vm.h +index e0bdedcf14dd..22aeec77d84d 100644 +--- a/drivers/gpu/drm/lima/lima_vm.h ++++ b/drivers/gpu/drm/lima/lima_vm.h +@@ -58,5 +58,6 @@ static inline void lima_vm_put(struct lima_vm *vm) + } + + void lima_vm_print(struct lima_vm *vm); ++int lima_vm_map_bo(struct lima_vm *vm, struct lima_bo *bo, int pageoff); + + #endif +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-clk-meson-g12a-aoclk-migrate-to-the-new-pare.patch b/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-clk-meson-g12a-aoclk-migrate-to-the-new-pare.patch deleted file mode 100644 index 4f1b5c99ae..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-clk-meson-g12a-aoclk-migrate-to-the-new-pare.patch +++ /dev/null @@ -1,240 +0,0 @@ -From e33fbafaf171bc40295804d9e1d55056be910618 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:41:23 +0200 -Subject: [PATCH 004/187] FROMGIT: clk: meson: g12a-aoclk: migrate to the new - parent description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (when parent -clocks are localy declared in the controller) and use .parent_data -otherwise. - -Remove clk input helper and all bypass clocks (declared in probe function) -which are no longer used since we are able to use device-tree clock name -directly. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit ba626081107dceacff554e5ca2efc7cea7326b6e - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/g12a-aoclk.c | 81 +++++++++++++++++++++------------- - 1 file changed, 50 insertions(+), 31 deletions(-) - -diff --git a/drivers/clk/meson/g12a-aoclk.c b/drivers/clk/meson/g12a-aoclk.c -index 1994e735396b..62499563e4f5 100644 ---- a/drivers/clk/meson/g12a-aoclk.c -+++ b/drivers/clk/meson/g12a-aoclk.c -@@ -18,8 +18,6 @@ - #include "clk-regmap.h" - #include "clk-dualdiv.h" - --#define IN_PREFIX "ao-in-" -- - /* - * AO Configuration Clock registers offsets - * Register offsets from the data sheet must be multiplied by 4. -@@ -51,7 +49,9 @@ static struct clk_regmap g12a_aoclk_##_name = { \ - .hw.init = &(struct clk_init_data) { \ - .name = "g12a_ao_" #_name, \ - .ops = &clk_regmap_gate_ops, \ -- .parent_names = (const char *[]){ IN_PREFIX "mpeg-clk" }, \ -+ .parent_data = &(const struct clk_parent_data) { \ -+ .fw_name = "mpeg-clk", \ -+ }, \ - .num_parents = 1, \ - .flags = CLK_IGNORE_UNUSED, \ - }, \ -@@ -81,7 +81,9 @@ static struct clk_regmap g12a_aoclk_cts_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "cts_oscin", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -106,7 +108,9 @@ static struct clk_regmap g12a_aoclk_32k_by_oscin_pre = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_32k_by_oscin_pre", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_oscin" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_cts_oscin.hw -+ }, - .num_parents = 1, - }, - }; -@@ -143,7 +147,9 @@ static struct clk_regmap g12a_aoclk_32k_by_oscin_div = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_32k_by_oscin_div", - .ops = &meson_clk_dualdiv_ops, -- .parent_names = (const char *[]){ "g12a_ao_32k_by_oscin_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_32k_by_oscin_pre.hw -+ }, - .num_parents = 1, - }, - }; -@@ -158,8 +164,10 @@ static struct clk_regmap g12a_aoclk_32k_by_oscin_sel = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_32k_by_oscin_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "g12a_ao_32k_by_oscin_div", -- "g12a_ao_32k_by_oscin_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_32k_by_oscin_div.hw, -+ &g12a_aoclk_32k_by_oscin_pre.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -173,7 +181,9 @@ static struct clk_regmap g12a_aoclk_32k_by_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_32k_by_oscin", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "g12a_ao_32k_by_oscin_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_32k_by_oscin_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -189,7 +199,9 @@ static struct clk_regmap g12a_aoclk_cec_pre = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_cec_pre", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_oscin" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_cts_oscin.hw -+ }, - .num_parents = 1, - }, - }; -@@ -226,7 +238,9 @@ static struct clk_regmap g12a_aoclk_cec_div = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_cec_div", - .ops = &meson_clk_dualdiv_ops, -- .parent_names = (const char *[]){ "g12a_ao_cec_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_cec_pre.hw -+ }, - .num_parents = 1, - }, - }; -@@ -241,8 +255,10 @@ static struct clk_regmap g12a_aoclk_cec_sel = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_cec_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "g12a_ao_cec_div", -- "g12a_ao_cec_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_cec_div.hw, -+ &g12a_aoclk_cec_pre.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -256,7 +272,9 @@ static struct clk_regmap g12a_aoclk_cec = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_cec", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "g12a_ao_cec_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_cec_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -272,8 +290,10 @@ static struct clk_regmap g12a_aoclk_cts_rtc_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_cts_rtc_oscin", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "g12a_ao_32k_by_oscin", -- IN_PREFIX "ext_32k-0" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .hw = &g12a_aoclk_32k_by_oscin.hw }, -+ { .fw_name = "ext-32k-0", }, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -289,8 +309,10 @@ static struct clk_regmap g12a_aoclk_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_clk81", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "mpeg-clk", -- "g12a_ao_cts_rtc_oscin"}, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "mpeg-clk", }, -+ { .hw = &g12a_aoclk_cts_rtc_oscin.hw }, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -305,8 +327,10 @@ static struct clk_regmap g12a_aoclk_saradc_mux = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_saradc_mux", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "g12a_ao_clk81" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_aoclk_clk81.hw }, -+ }, - .num_parents = 2, - }, - }; -@@ -320,7 +344,9 @@ static struct clk_regmap g12a_aoclk_saradc_div = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_saradc_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "g12a_ao_saradc_mux" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_saradc_mux.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -334,7 +360,9 @@ static struct clk_regmap g12a_aoclk_saradc_gate = { - .hw.init = &(struct clk_init_data){ - .name = "g12a_ao_saradc_gate", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "g12a_ao_saradc_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_aoclk_saradc_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -417,12 +445,6 @@ static const struct clk_hw_onecell_data g12a_aoclk_onecell_data = { - .num = NR_CLKS, - }; - --static const struct meson_aoclk_input g12a_aoclk_inputs[] = { -- { .name = "xtal", .required = true }, -- { .name = "mpeg-clk", .required = true }, -- { .name = "ext-32k-0", .required = false }, --}; -- - static const struct meson_aoclk_data g12a_aoclkc_data = { - .reset_reg = AO_RTI_GEN_CNTL_REG0, - .num_reset = ARRAY_SIZE(g12a_aoclk_reset), -@@ -430,9 +452,6 @@ static const struct meson_aoclk_data g12a_aoclkc_data = { - .num_clks = ARRAY_SIZE(g12a_aoclk_regmap), - .clks = g12a_aoclk_regmap, - .hw_data = &g12a_aoclk_onecell_data, -- .inputs = g12a_aoclk_inputs, -- .num_inputs = ARRAY_SIZE(g12a_aoclk_inputs), -- .input_prefix = IN_PREFIX, - }; - - static const struct of_device_id g12a_aoclkc_match_table[] = { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-drm-lima-support-heap-buffer-creation.patch b/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-drm-lima-support-heap-buffer-creation.patch new file mode 100644 index 0000000000..3f7b0870de --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-drm-lima-support-heap-buffer-creation.patch @@ -0,0 +1,327 @@ +From e2058aea7a06fbc3cf41e49173b973ff620d33e2 Mon Sep 17 00:00:00 2001 +From: Qiang Yu +Date: Thu, 16 Jan 2020 21:11:55 +0800 +Subject: [PATCH 004/146] FROMGIT: drm/lima: support heap buffer creation + +heap buffer is used as output of GP and input of PP for +Mali Utgard GPU. Size of heap buffer depends on the task +so is a runtime variable. + +Previously we just create a large enough buffer as heap +buffer. Now we add a heap buffer type to be able to +increase the backup memory dynamically when GP fail due +to lack of heap memory. + +Reviewed-by: Vasily Khoruzhick +Tested-by: Andreas Baierl +Signed-off-by: Qiang Yu +Link: https://patchwork.freedesktop.org/patch/msgid/20200116131157.13346-4-yuq825@gmail.com +--- + drivers/gpu/drm/lima/lima_drv.c | 6 +- + drivers/gpu/drm/lima/lima_drv.h | 1 + + drivers/gpu/drm/lima/lima_gem.c | 134 ++++++++++++++++++++++++++++++-- + drivers/gpu/drm/lima/lima_gem.h | 4 + + drivers/gpu/drm/lima/lima_vm.c | 4 +- + include/uapi/drm/lima_drm.h | 9 ++- + 6 files changed, 147 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c +index 124efe4fa97b..18f88aaef1a2 100644 +--- a/drivers/gpu/drm/lima/lima_drv.c ++++ b/drivers/gpu/drm/lima/lima_drv.c +@@ -15,10 +15,14 @@ + #include "lima_vm.h" + + int lima_sched_timeout_ms; ++uint lima_heap_init_nr_pages = 8; + + MODULE_PARM_DESC(sched_timeout_ms, "task run timeout in ms"); + module_param_named(sched_timeout_ms, lima_sched_timeout_ms, int, 0444); + ++MODULE_PARM_DESC(heap_init_nr_pages, "heap buffer init number of pages"); ++module_param_named(heap_init_nr_pages, lima_heap_init_nr_pages, uint, 0444); ++ + static int lima_ioctl_get_param(struct drm_device *dev, void *data, struct drm_file *file) + { + struct drm_lima_get_param *args = data; +@@ -68,7 +72,7 @@ static int lima_ioctl_gem_create(struct drm_device *dev, void *data, struct drm_ + if (args->pad) + return -EINVAL; + +- if (args->flags) ++ if (args->flags & ~(LIMA_BO_FLAG_HEAP)) + return -EINVAL; + + if (args->size == 0) +diff --git a/drivers/gpu/drm/lima/lima_drv.h b/drivers/gpu/drm/lima/lima_drv.h +index 69c7344715c9..f492ecc6a5d9 100644 +--- a/drivers/gpu/drm/lima/lima_drv.h ++++ b/drivers/gpu/drm/lima/lima_drv.h +@@ -9,6 +9,7 @@ + #include "lima_ctx.h" + + extern int lima_sched_timeout_ms; ++extern uint lima_heap_init_nr_pages; + + struct lima_vm; + struct lima_bo; +diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c +index d0059d8c97d8..5404e0d668db 100644 +--- a/drivers/gpu/drm/lima/lima_gem.c ++++ b/drivers/gpu/drm/lima/lima_gem.c +@@ -4,6 +4,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -15,6 +17,83 @@ + #include "lima_gem.h" + #include "lima_vm.h" + ++int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) ++{ ++ struct page **pages; ++ struct address_space *mapping = bo->base.base.filp->f_mapping; ++ struct device *dev = bo->base.base.dev->dev; ++ size_t old_size = bo->heap_size; ++ size_t new_size = bo->heap_size ? bo->heap_size * 2 : ++ (lima_heap_init_nr_pages << PAGE_SHIFT); ++ struct sg_table sgt; ++ int i, ret; ++ ++ if (bo->heap_size >= bo->base.base.size) ++ return -ENOSPC; ++ ++ new_size = min(new_size, bo->base.base.size); ++ ++ mutex_lock(&bo->base.pages_lock); ++ ++ if (bo->base.pages) { ++ pages = bo->base.pages; ++ } else { ++ pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, ++ sizeof(*pages), GFP_KERNEL | __GFP_ZERO); ++ if (!pages) { ++ mutex_unlock(&bo->base.pages_lock); ++ return -ENOMEM; ++ } ++ ++ bo->base.pages = pages; ++ bo->base.pages_use_count = 1; ++ ++ mapping_set_unevictable(mapping); ++ } ++ ++ for (i = old_size >> PAGE_SHIFT; i < new_size >> PAGE_SHIFT; i++) { ++ struct page *page = shmem_read_mapping_page(mapping, i); ++ ++ if (IS_ERR(page)) { ++ mutex_unlock(&bo->base.pages_lock); ++ return PTR_ERR(page); ++ } ++ pages[i] = page; ++ } ++ ++ mutex_unlock(&bo->base.pages_lock); ++ ++ ret = sg_alloc_table_from_pages(&sgt, pages, i, 0, ++ new_size, GFP_KERNEL); ++ if (ret) ++ return ret; ++ ++ if (bo->base.sgt) { ++ dma_unmap_sg(dev, bo->base.sgt->sgl, ++ bo->base.sgt->nents, DMA_BIDIRECTIONAL); ++ sg_free_table(bo->base.sgt); ++ } else { ++ bo->base.sgt = kmalloc(sizeof(*bo->base.sgt), GFP_KERNEL); ++ if (!bo->base.sgt) { ++ sg_free_table(&sgt); ++ return -ENOMEM; ++ } ++ } ++ ++ dma_map_sg(dev, sgt.sgl, sgt.nents, DMA_BIDIRECTIONAL); ++ ++ *bo->base.sgt = sgt; ++ ++ if (vm) { ++ ret = lima_vm_map_bo(vm, bo, old_size >> PAGE_SHIFT); ++ if (ret) ++ return ret; ++ } ++ ++ bo->heap_size = new_size; ++ return 0; ++} ++ + int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, + u32 size, u32 flags, u32 *handle) + { +@@ -22,7 +101,8 @@ int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, + gfp_t mask; + struct drm_gem_shmem_object *shmem; + struct drm_gem_object *obj; +- struct sg_table *sgt; ++ struct lima_bo *bo; ++ bool is_heap = flags & LIMA_BO_FLAG_HEAP; + + shmem = drm_gem_shmem_create(dev, size); + if (IS_ERR(shmem)) +@@ -36,10 +116,18 @@ int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, + mask |= __GFP_DMA32; + mapping_set_gfp_mask(obj->filp->f_mapping, mask); + +- sgt = drm_gem_shmem_get_pages_sgt(obj); +- if (IS_ERR(sgt)) { +- err = PTR_ERR(sgt); +- goto out; ++ if (is_heap) { ++ bo = to_lima_bo(obj); ++ err = lima_heap_alloc(bo, NULL); ++ if (err) ++ goto out; ++ } else { ++ struct sg_table *sgt = drm_gem_shmem_get_pages_sgt(obj); ++ ++ if (IS_ERR(sgt)) { ++ err = PTR_ERR(sgt); ++ goto out; ++ } + } + + err = drm_gem_handle_create(file, obj, handle); +@@ -79,17 +167,47 @@ static void lima_gem_object_close(struct drm_gem_object *obj, struct drm_file *f + lima_vm_bo_del(vm, bo); + } + ++static int lima_gem_pin(struct drm_gem_object *obj) ++{ ++ struct lima_bo *bo = to_lima_bo(obj); ++ ++ if (bo->heap_size) ++ return -EINVAL; ++ ++ return drm_gem_shmem_pin(obj); ++} ++ ++static void *lima_gem_vmap(struct drm_gem_object *obj) ++{ ++ struct lima_bo *bo = to_lima_bo(obj); ++ ++ if (bo->heap_size) ++ return ERR_PTR(-EINVAL); ++ ++ return drm_gem_shmem_vmap(obj); ++} ++ ++static int lima_gem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) ++{ ++ struct lima_bo *bo = to_lima_bo(obj); ++ ++ if (bo->heap_size) ++ return -EINVAL; ++ ++ return drm_gem_shmem_mmap(obj, vma); ++} ++ + static const struct drm_gem_object_funcs lima_gem_funcs = { + .free = lima_gem_free_object, + .open = lima_gem_object_open, + .close = lima_gem_object_close, + .print_info = drm_gem_shmem_print_info, +- .pin = drm_gem_shmem_pin, ++ .pin = lima_gem_pin, + .unpin = drm_gem_shmem_unpin, + .get_sg_table = drm_gem_shmem_get_sg_table, +- .vmap = drm_gem_shmem_vmap, ++ .vmap = lima_gem_vmap, + .vunmap = drm_gem_shmem_vunmap, +- .mmap = drm_gem_shmem_mmap, ++ .mmap = lima_gem_mmap, + }; + + struct drm_gem_object *lima_gem_create_object(struct drm_device *dev, size_t size) +diff --git a/drivers/gpu/drm/lima/lima_gem.h b/drivers/gpu/drm/lima/lima_gem.h +index 1800feb3e47f..ccea06142f4b 100644 +--- a/drivers/gpu/drm/lima/lima_gem.h ++++ b/drivers/gpu/drm/lima/lima_gem.h +@@ -7,12 +7,15 @@ + #include + + struct lima_submit; ++struct lima_vm; + + struct lima_bo { + struct drm_gem_shmem_object base; + + struct mutex lock; + struct list_head va; ++ ++ size_t heap_size; + }; + + static inline struct lima_bo * +@@ -31,6 +34,7 @@ static inline struct dma_resv *lima_bo_resv(struct lima_bo *bo) + return bo->base.base.resv; + } + ++int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm); + struct drm_gem_object *lima_gem_create_object(struct drm_device *dev, size_t size); + int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, + u32 size, u32 flags, u32 *handle); +diff --git a/drivers/gpu/drm/lima/lima_vm.c b/drivers/gpu/drm/lima/lima_vm.c +index 2e513841de6c..5b92fb82674a 100644 +--- a/drivers/gpu/drm/lima/lima_vm.c ++++ b/drivers/gpu/drm/lima/lima_vm.c +@@ -155,6 +155,7 @@ int lima_vm_bo_add(struct lima_vm *vm, struct lima_bo *bo, bool create) + void lima_vm_bo_del(struct lima_vm *vm, struct lima_bo *bo) + { + struct lima_bo_va *bo_va; ++ u32 size; + + mutex_lock(&bo->lock); + +@@ -166,8 +167,9 @@ void lima_vm_bo_del(struct lima_vm *vm, struct lima_bo *bo) + + mutex_lock(&vm->lock); + ++ size = bo->heap_size ? bo->heap_size : bo_va->node.size; + lima_vm_unmap_range(vm, bo_va->node.start, +- bo_va->node.start + bo_va->node.size - 1); ++ bo_va->node.start + size - 1); + + drm_mm_remove_node(&bo_va->node); + +diff --git a/include/uapi/drm/lima_drm.h b/include/uapi/drm/lima_drm.h +index 95a00fb867e6..1ec58d652a5a 100644 +--- a/include/uapi/drm/lima_drm.h ++++ b/include/uapi/drm/lima_drm.h +@@ -32,12 +32,19 @@ struct drm_lima_get_param { + __u64 value; /* out, parameter value */ + }; + ++/* ++ * heap buffer dynamically increase backup memory size when GP task fail ++ * due to lack of heap memory. size field of heap buffer is an up bound of ++ * the backup memory which can be set to a fairly large value. ++ */ ++#define LIMA_BO_FLAG_HEAP (1 << 0) ++ + /** + * create a buffer for used by GPU + */ + struct drm_lima_gem_create { + __u32 size; /* in, buffer size */ +- __u32 flags; /* in, currently no flags, must be zero */ ++ __u32 flags; /* in, buffer flags */ + __u32 handle; /* out, GEM buffer handle */ + __u32 pad; /* pad, must be zero */ + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-clk-meson-gxbb-aoclk-migrate-to-the-new-pare.patch b/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-clk-meson-gxbb-aoclk-migrate-to-the-new-pare.patch deleted file mode 100644 index 443135c0dc..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-clk-meson-gxbb-aoclk-migrate-to-the-new-pare.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 0e852bd3494390d165f8e79386a9eb9ef666db5b Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:41:24 +0200 -Subject: [PATCH 005/187] FROMGIT: clk: meson: gxbb-aoclk: migrate to the new - parent description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (when parent -clocks are localy declared in the controller) and use .parent_data -otherwise. - -Remove clk input helper and all bypass clocks (declared in probe function) -which are no longer used since we are able to use device-tree clock name -directly. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit 6e2bfc352e7a3a9b22f13c36627545d5f4caf3e9 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/gxbb-aoclk.c | 55 +++++++++++++++++----------------- - 1 file changed, 27 insertions(+), 28 deletions(-) - -diff --git a/drivers/clk/meson/gxbb-aoclk.c b/drivers/clk/meson/gxbb-aoclk.c -index 449f6ac189d8..e940861a396b 100644 ---- a/drivers/clk/meson/gxbb-aoclk.c -+++ b/drivers/clk/meson/gxbb-aoclk.c -@@ -11,8 +11,6 @@ - #include "clk-regmap.h" - #include "clk-dualdiv.h" - --#define IN_PREFIX "ao-in-" -- - /* AO Configuration Clock registers offsets */ - #define AO_RTI_PWR_CNTL_REG1 0x0c - #define AO_RTI_PWR_CNTL_REG0 0x10 -@@ -31,7 +29,9 @@ static struct clk_regmap _name##_ao = { \ - .hw.init = &(struct clk_init_data) { \ - .name = #_name "_ao", \ - .ops = &clk_regmap_gate_ops, \ -- .parent_names = (const char *[]){ IN_PREFIX "mpeg-clk" }, \ -+ .parent_data = &(const struct clk_parent_data) { \ -+ .fw_name = "mpeg-clk", \ -+ }, \ - .num_parents = 1, \ - .flags = CLK_IGNORE_UNUSED, \ - }, \ -@@ -52,7 +52,9 @@ static struct clk_regmap ao_cts_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "ao_cts_oscin", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -65,7 +67,7 @@ static struct clk_regmap ao_32k_pre = { - .hw.init = &(struct clk_init_data){ - .name = "ao_32k_pre", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "ao_cts_oscin" }, -+ .parent_hws = (const struct clk_hw *[]) { &ao_cts_oscin.hw }, - .num_parents = 1, - }, - }; -@@ -112,7 +114,7 @@ static struct clk_regmap ao_32k_div = { - .hw.init = &(struct clk_init_data){ - .name = "ao_32k_div", - .ops = &meson_clk_dualdiv_ops, -- .parent_names = (const char *[]){ "ao_32k_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { &ao_32k_pre.hw }, - .num_parents = 1, - }, - }; -@@ -127,8 +129,10 @@ static struct clk_regmap ao_32k_sel = { - .hw.init = &(struct clk_init_data){ - .name = "ao_32k_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "ao_32k_div", -- "ao_32k_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &ao_32k_div.hw, -+ &ao_32k_pre.hw -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -142,7 +146,7 @@ static struct clk_regmap ao_32k = { - .hw.init = &(struct clk_init_data){ - .name = "ao_32k", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "ao_32k_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &ao_32k_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -159,10 +163,12 @@ static struct clk_regmap ao_cts_rtc_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "ao_cts_rtc_oscin", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ IN_PREFIX "ext-32k-0", -- IN_PREFIX "ext-32k-1", -- IN_PREFIX "ext-32k-2", -- "ao_32k" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "ext-32k-0", }, -+ { .fw_name = "ext-32k-1", }, -+ { .fw_name = "ext-32k-2", }, -+ { .hw = &ao_32k.hw }, -+ }, - .num_parents = 4, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -178,8 +184,10 @@ static struct clk_regmap ao_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "ao_clk81", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "mpeg-clk", -- "ao_cts_rtc_oscin" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "mpeg-clk", }, -+ { .hw = &ao_cts_rtc_oscin.hw }, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -208,8 +216,10 @@ static struct clk_regmap ao_cts_cec = { - * Until CCF gets fixed, adding this fake parent that won't - * ever be registered should work around the problem - */ -- .parent_names = (const char *[]){ "fixme", -- "ao_cts_rtc_oscin" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .name = "fixme", .index = -1, }, -+ { .hw = &ao_cts_rtc_oscin.hw }, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -261,14 +271,6 @@ static const struct clk_hw_onecell_data gxbb_aoclk_onecell_data = { - .num = NR_CLKS, - }; - --static const struct meson_aoclk_input gxbb_aoclk_inputs[] = { -- { .name = "xtal", .required = true, }, -- { .name = "mpeg-clk", .required = true, }, -- {. name = "ext-32k-0", .required = false, }, -- {. name = "ext-32k-1", .required = false, }, -- {. name = "ext-32k-2", .required = false, }, --}; -- - static const struct meson_aoclk_data gxbb_aoclkc_data = { - .reset_reg = AO_RTI_GEN_CNTL_REG0, - .num_reset = ARRAY_SIZE(gxbb_aoclk_reset), -@@ -276,9 +278,6 @@ static const struct meson_aoclk_data gxbb_aoclkc_data = { - .num_clks = ARRAY_SIZE(gxbb_aoclk), - .clks = gxbb_aoclk, - .hw_data = &gxbb_aoclk_onecell_data, -- .inputs = gxbb_aoclk_inputs, -- .num_inputs = ARRAY_SIZE(gxbb_aoclk_inputs), -- .input_prefix = IN_PREFIX, - }; - - static const struct of_device_id gxbb_aoclkc_match_table[] = { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-drm-lima-recover-task-by-enlarging-heap-buff.patch b/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-drm-lima-recover-task-by-enlarging-heap-buff.patch new file mode 100644 index 0000000000..f98586abef --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-drm-lima-recover-task-by-enlarging-heap-buff.patch @@ -0,0 +1,247 @@ +From 1205d670359f3cb93770adf7b23dc4e71de605fc Mon Sep 17 00:00:00 2001 +From: Qiang Yu +Date: Thu, 16 Jan 2020 21:11:56 +0800 +Subject: [PATCH 005/146] FROMGIT: drm/lima: recover task by enlarging heap + buffer + +Increase heap buffer backup memory when GP receive PLBU +out of memory interrupt, then resume the task. + +Reviewed-by: Vasily Khoruzhick +Tested-by: Andreas Baierl +Signed-off-by: Qiang Yu +Link: https://patchwork.freedesktop.org/patch/msgid/20200116131157.13346-5-yuq825@gmail.com +--- + drivers/gpu/drm/lima/lima_gp.c | 58 +++++++++++++++++++++++++++++-- + drivers/gpu/drm/lima/lima_mmu.c | 5 +++ + drivers/gpu/drm/lima/lima_mmu.h | 1 + + drivers/gpu/drm/lima/lima_sched.c | 35 ++++++++++++++++--- + drivers/gpu/drm/lima/lima_sched.h | 6 ++++ + 5 files changed, 98 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c +index ccf49faedebf..52b210f9a605 100644 +--- a/drivers/gpu/drm/lima/lima_gp.c ++++ b/drivers/gpu/drm/lima/lima_gp.c +@@ -11,6 +11,8 @@ + #include "lima_device.h" + #include "lima_gp.h" + #include "lima_regs.h" ++#include "lima_gem.h" ++#include "lima_vm.h" + + #define gp_write(reg, data) writel(data, ip->iomem + reg) + #define gp_read(reg) readl(ip->iomem + reg) +@@ -20,6 +22,7 @@ static irqreturn_t lima_gp_irq_handler(int irq, void *data) + struct lima_ip *ip = data; + struct lima_device *dev = ip->dev; + struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_gp; ++ struct lima_sched_task *task = pipe->current_task; + u32 state = gp_read(LIMA_GP_INT_STAT); + u32 status = gp_read(LIMA_GP_STATUS); + bool done = false; +@@ -29,8 +32,16 @@ static irqreturn_t lima_gp_irq_handler(int irq, void *data) + return IRQ_NONE; + + if (state & LIMA_GP_IRQ_MASK_ERROR) { +- dev_err(dev->dev, "gp error irq state=%x status=%x\n", +- state, status); ++ if ((state & LIMA_GP_IRQ_MASK_ERROR) == ++ LIMA_GP_IRQ_PLBU_OUT_OF_MEM) { ++ dev_dbg(dev->dev, "gp out of heap irq status=%x\n", ++ status); ++ } else { ++ dev_err(dev->dev, "gp error irq state=%x status=%x\n", ++ state, status); ++ if (task) ++ task->recoverable = false; ++ } + + /* mask all interrupts before hard reset */ + gp_write(LIMA_GP_INT_MASK, 0); +@@ -43,6 +54,7 @@ static irqreturn_t lima_gp_irq_handler(int irq, void *data) + bool active = status & (LIMA_GP_STATUS_VS_ACTIVE | + LIMA_GP_STATUS_PLBU_ACTIVE); + done = valid && !active; ++ pipe->error = false; + } + + gp_write(LIMA_GP_INT_CLEAR, state); +@@ -121,6 +133,22 @@ static void lima_gp_task_run(struct lima_sched_pipe *pipe, + u32 cmd = 0; + int i; + ++ /* update real heap buffer size for GP */ ++ for (i = 0; i < task->num_bos; i++) { ++ struct lima_bo *bo = task->bos[i]; ++ ++ if (bo->heap_size && ++ lima_vm_get_va(task->vm, bo) == ++ f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2]) { ++ f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2] = ++ f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + ++ bo->heap_size; ++ task->recoverable = true; ++ task->heap = bo; ++ break; ++ } ++ } ++ + if (f[LIMA_GP_VSCL_START_ADDR >> 2] != + f[LIMA_GP_VSCL_END_ADDR >> 2]) + cmd |= LIMA_GP_CMD_START_VS; +@@ -184,6 +212,31 @@ static void lima_gp_task_mmu_error(struct lima_sched_pipe *pipe) + lima_sched_pipe_task_done(pipe); + } + ++static int lima_gp_task_recover(struct lima_sched_pipe *pipe) ++{ ++ struct lima_ip *ip = pipe->processor[0]; ++ struct lima_sched_task *task = pipe->current_task; ++ struct drm_lima_gp_frame *frame = task->frame; ++ u32 *f = frame->frame; ++ size_t fail_size = ++ f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2] - ++ f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2]; ++ ++ if (fail_size == task->heap->heap_size) { ++ int ret; ++ ++ ret = lima_heap_alloc(task->heap, task->vm); ++ if (ret < 0) ++ return ret; ++ } ++ ++ gp_write(LIMA_GP_INT_MASK, LIMA_GP_IRQ_MASK_USED); ++ gp_write(LIMA_GP_PLBU_ALLOC_END_ADDR, ++ f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size); ++ gp_write(LIMA_GP_CMD, LIMA_GP_CMD_UPDATE_PLBU_ALLOC); ++ return 0; ++} ++ + static void lima_gp_print_version(struct lima_ip *ip) + { + u32 version, major, minor; +@@ -270,6 +323,7 @@ int lima_gp_pipe_init(struct lima_device *dev) + pipe->task_fini = lima_gp_task_fini; + pipe->task_error = lima_gp_task_error; + pipe->task_mmu_error = lima_gp_task_mmu_error; ++ pipe->task_recover = lima_gp_task_recover; + + return 0; + } +diff --git a/drivers/gpu/drm/lima/lima_mmu.c b/drivers/gpu/drm/lima/lima_mmu.c +index 97ec09dee572..f79d2af427e7 100644 +--- a/drivers/gpu/drm/lima/lima_mmu.c ++++ b/drivers/gpu/drm/lima/lima_mmu.c +@@ -99,6 +99,11 @@ void lima_mmu_fini(struct lima_ip *ip) + + } + ++void lima_mmu_flush_tlb(struct lima_ip *ip) ++{ ++ mmu_write(LIMA_MMU_COMMAND, LIMA_MMU_COMMAND_ZAP_CACHE); ++} ++ + void lima_mmu_switch_vm(struct lima_ip *ip, struct lima_vm *vm) + { + struct lima_device *dev = ip->dev; +diff --git a/drivers/gpu/drm/lima/lima_mmu.h b/drivers/gpu/drm/lima/lima_mmu.h +index 8c78319bcc8e..4f8ccbebcba1 100644 +--- a/drivers/gpu/drm/lima/lima_mmu.h ++++ b/drivers/gpu/drm/lima/lima_mmu.h +@@ -10,6 +10,7 @@ struct lima_vm; + int lima_mmu_init(struct lima_ip *ip); + void lima_mmu_fini(struct lima_ip *ip); + ++void lima_mmu_flush_tlb(struct lima_ip *ip); + void lima_mmu_switch_vm(struct lima_ip *ip, struct lima_vm *vm); + void lima_mmu_page_fault_resume(struct lima_ip *ip); + +diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c +index b561dd05bd62..3886999b4533 100644 +--- a/drivers/gpu/drm/lima/lima_sched.c ++++ b/drivers/gpu/drm/lima/lima_sched.c +@@ -313,6 +313,26 @@ static const struct drm_sched_backend_ops lima_sched_ops = { + .free_job = lima_sched_free_job, + }; + ++static void lima_sched_recover_work(struct work_struct *work) ++{ ++ struct lima_sched_pipe *pipe = ++ container_of(work, struct lima_sched_pipe, recover_work); ++ int i; ++ ++ for (i = 0; i < pipe->num_l2_cache; i++) ++ lima_l2_cache_flush(pipe->l2_cache[i]); ++ ++ if (pipe->bcast_mmu) { ++ lima_mmu_flush_tlb(pipe->bcast_mmu); ++ } else { ++ for (i = 0; i < pipe->num_mmu; i++) ++ lima_mmu_flush_tlb(pipe->mmu[i]); ++ } ++ ++ if (pipe->task_recover(pipe)) ++ drm_sched_fault(&pipe->base); ++} ++ + int lima_sched_pipe_init(struct lima_sched_pipe *pipe, const char *name) + { + unsigned int timeout = lima_sched_timeout_ms > 0 ? +@@ -321,6 +341,8 @@ int lima_sched_pipe_init(struct lima_sched_pipe *pipe, const char *name) + pipe->fence_context = dma_fence_context_alloc(1); + spin_lock_init(&pipe->fence_lock); + ++ INIT_WORK(&pipe->recover_work, lima_sched_recover_work); ++ + return drm_sched_init(&pipe->base, &lima_sched_ops, 1, 0, + msecs_to_jiffies(timeout), name); + } +@@ -332,11 +354,14 @@ void lima_sched_pipe_fini(struct lima_sched_pipe *pipe) + + void lima_sched_pipe_task_done(struct lima_sched_pipe *pipe) + { +- if (pipe->error) +- drm_sched_fault(&pipe->base); +- else { +- struct lima_sched_task *task = pipe->current_task; +- ++ struct lima_sched_task *task = pipe->current_task; ++ ++ if (pipe->error) { ++ if (task && task->recoverable) ++ schedule_work(&pipe->recover_work); ++ else ++ drm_sched_fault(&pipe->base); ++ } else { + pipe->task_fini(pipe); + dma_fence_signal(task->fence); + } +diff --git a/drivers/gpu/drm/lima/lima_sched.h b/drivers/gpu/drm/lima/lima_sched.h +index 1d814fecbcc0..d64393fb50a9 100644 +--- a/drivers/gpu/drm/lima/lima_sched.h ++++ b/drivers/gpu/drm/lima/lima_sched.h +@@ -20,6 +20,9 @@ struct lima_sched_task { + struct lima_bo **bos; + int num_bos; + ++ bool recoverable; ++ struct lima_bo *heap; ++ + /* pipe fence */ + struct dma_fence *fence; + }; +@@ -68,6 +71,9 @@ struct lima_sched_pipe { + void (*task_fini)(struct lima_sched_pipe *pipe); + void (*task_error)(struct lima_sched_pipe *pipe); + void (*task_mmu_error)(struct lima_sched_pipe *pipe); ++ int (*task_recover)(struct lima_sched_pipe *pipe); ++ ++ struct work_struct recover_work; + }; + + int lima_sched_task_init(struct lima_sched_task *task, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-clk-meson-axg-aoclk-migrate-to-the-new-paren.patch b/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-clk-meson-axg-aoclk-migrate-to-the-new-paren.patch deleted file mode 100644 index c1852052d3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-clk-meson-axg-aoclk-migrate-to-the-new-paren.patch +++ /dev/null @@ -1,194 +0,0 @@ -From bf0e0bbc0daea063465c686fcd7ad4c378df053a Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:41:25 +0200 -Subject: [PATCH 006/187] FROMGIT: clk: meson: axg-aoclk: migrate to the new - parent description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (when parent -clocks are localy declared in the controller) and use .parent_data -otherwise. - -Remove clk input helper and all bypass clocks (declared in probe function) -which are no longer used since we are able to use device-tree clock name -directly. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit b90ec1e344a2dd4c1afebd75c1ce05afaf9e116b - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/axg-aoclk.c | 63 ++++++++++++++++++++--------------- - 1 file changed, 37 insertions(+), 26 deletions(-) - -diff --git a/drivers/clk/meson/axg-aoclk.c b/drivers/clk/meson/axg-aoclk.c -index 0086f31288eb..b488b40c9d0e 100644 ---- a/drivers/clk/meson/axg-aoclk.c -+++ b/drivers/clk/meson/axg-aoclk.c -@@ -18,8 +18,6 @@ - #include "clk-regmap.h" - #include "clk-dualdiv.h" - --#define IN_PREFIX "ao-in-" -- - /* - * AO Configuration Clock registers offsets - * Register offsets from the data sheet must be multiplied by 4. -@@ -42,7 +40,9 @@ static struct clk_regmap axg_aoclk_##_name = { \ - .hw.init = &(struct clk_init_data) { \ - .name = "axg_ao_" #_name, \ - .ops = &clk_regmap_gate_ops, \ -- .parent_names = (const char *[]){ IN_PREFIX "mpeg-clk" }, \ -+ .parent_data = &(const struct clk_parent_data) { \ -+ .fw_name = "mpeg-clk", \ -+ }, \ - .num_parents = 1, \ - .flags = CLK_IGNORE_UNUSED, \ - }, \ -@@ -64,7 +64,9 @@ static struct clk_regmap axg_aoclk_cts_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "cts_oscin", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -77,7 +79,9 @@ static struct clk_regmap axg_aoclk_32k_pre = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_32k_pre", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_oscin" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_aoclk_cts_oscin.hw -+ }, - .num_parents = 1, - }, - }; -@@ -124,7 +128,9 @@ static struct clk_regmap axg_aoclk_32k_div = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_32k_div", - .ops = &meson_clk_dualdiv_ops, -- .parent_names = (const char *[]){ "axg_ao_32k_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_aoclk_32k_pre.hw -+ }, - .num_parents = 1, - }, - }; -@@ -139,8 +145,10 @@ static struct clk_regmap axg_aoclk_32k_sel = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_32k_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "axg_ao_32k_div", -- "axg_ao_32k_pre" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_aoclk_32k_div.hw, -+ &axg_aoclk_32k_pre.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -154,7 +162,9 @@ static struct clk_regmap axg_aoclk_32k = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_32k", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "axg_ao_32k_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_aoclk_32k_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -170,8 +180,10 @@ static struct clk_regmap axg_aoclk_cts_rtc_oscin = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_cts_rtc_oscin", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "axg_ao_32k", -- IN_PREFIX "ext_32k-0" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .hw = &axg_aoclk_32k.hw }, -+ { .fw_name = "ext_32k-0", }, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -187,8 +199,10 @@ static struct clk_regmap axg_aoclk_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_clk81", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "mpeg-clk", -- "axg_ao_cts_rtc_oscin"}, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "mpeg-clk", }, -+ { .hw = &axg_aoclk_cts_rtc_oscin.hw }, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -203,8 +217,10 @@ static struct clk_regmap axg_aoclk_saradc_mux = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_saradc_mux", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "axg_ao_clk81" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &axg_aoclk_clk81.hw }, -+ }, - .num_parents = 2, - }, - }; -@@ -218,7 +234,9 @@ static struct clk_regmap axg_aoclk_saradc_div = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_saradc_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "axg_ao_saradc_mux" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_aoclk_saradc_mux.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -232,7 +250,9 @@ static struct clk_regmap axg_aoclk_saradc_gate = { - .hw.init = &(struct clk_init_data){ - .name = "axg_ao_saradc_gate", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "axg_ao_saradc_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_aoclk_saradc_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -290,12 +310,6 @@ static const struct clk_hw_onecell_data axg_aoclk_onecell_data = { - .num = NR_CLKS, - }; - --static const struct meson_aoclk_input axg_aoclk_inputs[] = { -- { .name = "xtal", .required = true }, -- { .name = "mpeg-clk", .required = true }, -- { .name = "ext-32k-0", .required = false }, --}; -- - static const struct meson_aoclk_data axg_aoclkc_data = { - .reset_reg = AO_RTI_GEN_CNTL_REG0, - .num_reset = ARRAY_SIZE(axg_aoclk_reset), -@@ -303,9 +317,6 @@ static const struct meson_aoclk_data axg_aoclkc_data = { - .num_clks = ARRAY_SIZE(axg_aoclk_regmap), - .clks = axg_aoclk_regmap, - .hw_data = &axg_aoclk_onecell_data, -- .inputs = axg_aoclk_inputs, -- .num_inputs = ARRAY_SIZE(axg_aoclk_inputs), -- .input_prefix = IN_PREFIX, - }; - - static const struct of_device_id axg_aoclkc_match_table[] = { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-drm-lima-increase-driver-version-to-1.1.patch b/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-drm-lima-increase-driver-version-to-1.1.patch new file mode 100644 index 0000000000..9c59af69a7 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-drm-lima-increase-driver-version-to-1.1.patch @@ -0,0 +1,48 @@ +From b5da0390f260f6cfc633d496ee2ee1bc5233a877 Mon Sep 17 00:00:00 2001 +From: Qiang Yu +Date: Thu, 16 Jan 2020 21:11:57 +0800 +Subject: [PATCH 006/146] FROMGIT: drm/lima: increase driver version to 1.1 + +Increase driver version for mesa driver to identify +the support of new heap buffer interface. + +Reviewed-by: Vasily Khoruzhick +Tested-by: Andreas Baierl +Signed-off-by: Qiang Yu +Link: https://patchwork.freedesktop.org/patch/msgid/20200116131157.13346-6-yuq825@gmail.com +--- + drivers/gpu/drm/lima/lima_drv.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c +index 18f88aaef1a2..2daac64d8955 100644 +--- a/drivers/gpu/drm/lima/lima_drv.c ++++ b/drivers/gpu/drm/lima/lima_drv.c +@@ -245,6 +245,12 @@ static const struct drm_ioctl_desc lima_drm_driver_ioctls[] = { + + DEFINE_DRM_GEM_FOPS(lima_drm_driver_fops); + ++/** ++ * Changelog: ++ * ++ * - 1.1.0 - add heap buffer support ++ */ ++ + static struct drm_driver lima_drm_driver = { + .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ, + .open = lima_drm_driver_open, +@@ -254,9 +260,9 @@ static struct drm_driver lima_drm_driver = { + .fops = &lima_drm_driver_fops, + .name = "lima", + .desc = "lima DRM", +- .date = "20190217", ++ .date = "20191231", + .major = 1, +- .minor = 0, ++ .minor = 1, + .patchlevel = 0, + + .gem_create_object = lima_gem_create_object, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-clk-meson-remove-ao-input-bypass-clocks.patch b/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-clk-meson-remove-ao-input-bypass-clocks.patch deleted file mode 100644 index 1a619c8de9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-clk-meson-remove-ao-input-bypass-clocks.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 38016b418a556c21fbede6d4822c3ec5b2e3ec0e Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:41:26 +0200 -Subject: [PATCH 007/187] FROMGIT: clk: meson: remove ao input bypass clocks - -During probe, bypass clocks (i.e. ao-in-xtal) are made from device-tree -inputs to provide input clocks which can be access through global name. -The cons of this method are the duplicated clocks, means more string -comparison. - -Specify parent directly with device-tree clock name. - -Function to regiter bypass clocks is removed. - -Input parameters from meson aoclk data structure are deprecated and then -deleted since all aoclk files are migrated. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit 072a043f5a2e02441002fff34e3885e6026714eb - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/Kconfig | 1 - - drivers/clk/meson/meson-aoclk.c | 37 --------------------------------- - drivers/clk/meson/meson-aoclk.h | 8 ------- - 3 files changed, 46 deletions(-) - -diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig -index ee0b84b6b329..178ee72ba4bc 100644 ---- a/drivers/clk/meson/Kconfig -+++ b/drivers/clk/meson/Kconfig -@@ -33,7 +33,6 @@ config COMMON_CLK_MESON_VID_PLL_DIV - config COMMON_CLK_MESON_AO_CLKC - tristate - select COMMON_CLK_MESON_REGMAP -- select COMMON_CLK_MESON_INPUT - select RESET_CONTROLLER - - config COMMON_CLK_MESON_EE_CLKC -diff --git a/drivers/clk/meson/meson-aoclk.c b/drivers/clk/meson/meson-aoclk.c -index b67951909e04..bf8bea675d24 100644 ---- a/drivers/clk/meson/meson-aoclk.c -+++ b/drivers/clk/meson/meson-aoclk.c -@@ -17,8 +17,6 @@ - #include - #include "meson-aoclk.h" - --#include "clk-input.h" -- - static int meson_aoclk_do_reset(struct reset_controller_dev *rcdev, - unsigned long id) - { -@@ -33,37 +31,6 @@ static const struct reset_control_ops meson_aoclk_reset_ops = { - .reset = meson_aoclk_do_reset, - }; - --static int meson_aoclkc_register_inputs(struct device *dev, -- struct meson_aoclk_data *data) --{ -- struct clk_hw *hw; -- char *str; -- int i; -- -- for (i = 0; i < data->num_inputs; i++) { -- const struct meson_aoclk_input *in = &data->inputs[i]; -- -- str = kasprintf(GFP_KERNEL, "%s%s", data->input_prefix, -- in->name); -- if (!str) -- return -ENOMEM; -- -- hw = meson_clk_hw_register_input(dev, in->name, str, 0); -- kfree(str); -- -- if (IS_ERR(hw)) { -- if (!in->required && PTR_ERR(hw) == -ENOENT) -- continue; -- else if (PTR_ERR(hw) != -EPROBE_DEFER) -- dev_err(dev, "failed to register input %s\n", -- in->name); -- return PTR_ERR(hw); -- } -- } -- -- return 0; --} -- - int meson_aoclkc_probe(struct platform_device *pdev) - { - struct meson_aoclk_reset_controller *rstc; -@@ -86,10 +53,6 @@ int meson_aoclkc_probe(struct platform_device *pdev) - return PTR_ERR(regmap); - } - -- ret = meson_aoclkc_register_inputs(dev, data); -- if (ret) -- return ret; -- - /* Reset Controller */ - rstc->data = data; - rstc->regmap = regmap; -diff --git a/drivers/clk/meson/meson-aoclk.h b/drivers/clk/meson/meson-aoclk.h -index 999cde3868f7..605b43855a69 100644 ---- a/drivers/clk/meson/meson-aoclk.h -+++ b/drivers/clk/meson/meson-aoclk.h -@@ -18,20 +18,12 @@ - - #include "clk-regmap.h" - --struct meson_aoclk_input { -- const char *name; -- bool required; --}; -- - struct meson_aoclk_data { - const unsigned int reset_reg; - const int num_reset; - const unsigned int *reset; - const int num_clks; - struct clk_regmap **clks; -- const int num_inputs; -- const struct meson_aoclk_input *inputs; -- const char *input_prefix; - const struct clk_hw_onecell_data *hw_data; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-drm-lima-fix-recovering-from-PLBU-out-of-mem.patch b/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-drm-lima-fix-recovering-from-PLBU-out-of-mem.patch new file mode 100644 index 0000000000..e2ffb1a778 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-drm-lima-fix-recovering-from-PLBU-out-of-mem.patch @@ -0,0 +1,38 @@ +From 532b7e7f35698a33640bdf36914d0e0acd8270ef Mon Sep 17 00:00:00 2001 +From: Vasily Khoruzhick +Date: Tue, 18 Feb 2020 22:09:52 +0000 +Subject: [PATCH 007/146] FROMGIT: drm/lima: fix recovering from PLBU out of + memory + +It looks like on PLBU_OUT_OF_MEM interrupt we need to resume from where we +stopped, i.e. new PLBU heap start is old end. Also update end address +in GP frame to grow heap on 2nd and subsequent out of memory interrupts. + +Fixes: 2081e8dcf1ee ("drm/lima: recover task by enlarging heap buffer") +Signed-off-by: Vasily Khoruzhick +--- + drivers/gpu/drm/lima/lima_gp.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c +index 52b210f9a605..d8841c870d90 100644 +--- a/drivers/gpu/drm/lima/lima_gp.c ++++ b/drivers/gpu/drm/lima/lima_gp.c +@@ -231,8 +231,13 @@ static int lima_gp_task_recover(struct lima_sched_pipe *pipe) + } + + gp_write(LIMA_GP_INT_MASK, LIMA_GP_IRQ_MASK_USED); ++ /* Resume from where we stopped, i.e. new start is old end */ ++ gp_write(LIMA_GP_PLBU_ALLOC_START_ADDR, ++ f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]); ++ f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2] = ++ f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size; + gp_write(LIMA_GP_PLBU_ALLOC_END_ADDR, +- f[LIMA_GP_PLBU_ALLOC_START_ADDR >> 2] + task->heap->heap_size); ++ f[LIMA_GP_PLBU_ALLOC_END_ADDR >> 2]); + gp_write(LIMA_GP_CMD, LIMA_GP_CMD_UPDATE_PLBU_ALLOC); + return 0; + } +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-clk-meson-g12a-migrate-to-the-new-parent-des.patch b/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-clk-meson-g12a-migrate-to-the-new-parent-des.patch deleted file mode 100644 index 11642cdb29..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-clk-meson-g12a-migrate-to-the-new-parent-des.patch +++ /dev/null @@ -1,2363 +0,0 @@ -From ae1fd76f27570e360dd835d7450f9f0bf58d6e44 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:31 +0200 -Subject: [PATCH 008/187] FROMGIT: clk: meson: g12a: migrate to the new parent - description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (ie. when -all clocks are local to the controller) and use .parent_data otherwise. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit 25e682a02d91e2d09f47c089a4b42bba726106b9 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/g12a.c | 1087 ++++++++++++++++++++++++-------------- - 1 file changed, 693 insertions(+), 394 deletions(-) - -diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c -index 7bc5566b66f7..8cc7f5acf7ab 100644 ---- a/drivers/clk/meson/g12a.c -+++ b/drivers/clk/meson/g12a.c -@@ -15,7 +15,6 @@ - #include - #include - --#include "clk-input.h" - #include "clk-mpll.h" - #include "clk-pll.h" - #include "clk-regmap.h" -@@ -61,7 +60,9 @@ static struct clk_regmap g12a_fixed_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -76,7 +77,9 @@ static struct clk_regmap g12a_fixed_pll = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fixed_pll_dco.hw -+ }, - .num_parents = 1, - /* - * This clock won't ever change at runtime so -@@ -130,7 +133,9 @@ static struct clk_regmap g12a_sys_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -145,7 +150,9 @@ static struct clk_regmap g12a_sys_pll = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "sys_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sys_pll_dco.hw -+ }, - .num_parents = 1, - }, - }; -@@ -181,7 +188,9 @@ static struct clk_regmap g12b_sys1_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "sys1_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -196,7 +205,9 @@ static struct clk_regmap g12b_sys1_pll = { - .hw.init = &(struct clk_init_data){ - .name = "sys1_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "sys1_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_sys1_pll_dco.hw -+ }, - .num_parents = 1, - }, - }; -@@ -209,7 +220,7 @@ static struct clk_regmap g12a_sys_pll_div16_en = { - .hw.init = &(struct clk_init_data) { - .name = "sys_pll_div16_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "sys_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_sys_pll.hw }, - .num_parents = 1, - /* - * This clock is used to debug the sys_pll range -@@ -226,7 +237,9 @@ static struct clk_regmap g12b_sys1_pll_div16_en = { - .hw.init = &(struct clk_init_data) { - .name = "sys1_pll_div16_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "sys1_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_sys1_pll.hw -+ }, - .num_parents = 1, - /* - * This clock is used to debug the sys_pll range -@@ -241,7 +254,9 @@ static struct clk_fixed_factor g12a_sys_pll_div16 = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll_div16", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "sys_pll_div16_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sys_pll_div16_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -252,11 +267,75 @@ static struct clk_fixed_factor g12b_sys1_pll_div16 = { - .hw.init = &(struct clk_init_data){ - .name = "sys1_pll_div16", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "sys1_pll_div16_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_sys1_pll_div16_en.hw -+ }, -+ .num_parents = 1, -+ }, -+}; -+ -+static struct clk_fixed_factor g12a_fclk_div2_div = { -+ .mult = 1, -+ .div = 2, -+ .hw.init = &(struct clk_init_data){ -+ .name = "fclk_div2_div", -+ .ops = &clk_fixed_factor_ops, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw }, -+ .num_parents = 1, -+ }, -+}; -+ -+static struct clk_regmap g12a_fclk_div2 = { -+ .data = &(struct clk_regmap_gate_data){ -+ .offset = HHI_FIX_PLL_CNTL1, -+ .bit_idx = 24, -+ }, -+ .hw.init = &(struct clk_init_data){ -+ .name = "fclk_div2", -+ .ops = &clk_regmap_gate_ops, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fclk_div2_div.hw -+ }, -+ .num_parents = 1, -+ }, -+}; -+ -+static struct clk_fixed_factor g12a_fclk_div3_div = { -+ .mult = 1, -+ .div = 3, -+ .hw.init = &(struct clk_init_data){ -+ .name = "fclk_div3_div", -+ .ops = &clk_fixed_factor_ops, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw }, - .num_parents = 1, - }, - }; - -+static struct clk_regmap g12a_fclk_div3 = { -+ .data = &(struct clk_regmap_gate_data){ -+ .offset = HHI_FIX_PLL_CNTL1, -+ .bit_idx = 20, -+ }, -+ .hw.init = &(struct clk_init_data){ -+ .name = "fclk_div3", -+ .ops = &clk_regmap_gate_ops, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fclk_div3_div.hw -+ }, -+ .num_parents = 1, -+ /* -+ * This clock is used by the resident firmware and is required -+ * by the platform to operate correctly. -+ * Until the following condition are met, we need this clock to -+ * be marked as critical: -+ * a) Mark the clock used by a firmware resource, if possible -+ * b) CCF has a clock hand-off mechanism to make the sure the -+ * clock stays on until the proper driver comes along -+ */ -+ .flags = CLK_IS_CRITICAL, -+ }, -+}; -+ - /* Datasheet names this field as "premux0" */ - static struct clk_regmap g12a_cpu_clk_premux0 = { - .data = &(struct clk_regmap_mux_data){ -@@ -267,9 +346,30 @@ static struct clk_regmap g12a_cpu_clk_premux0 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn0_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "fclk_div2", -- "fclk_div3" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div2.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ }, -+ .num_parents = 3, -+ }, -+}; -+ -+/* Datasheet names this field as "premux1" */ -+static struct clk_regmap g12a_cpu_clk_premux1 = { -+ .data = &(struct clk_regmap_mux_data){ -+ .offset = HHI_SYS_CPU_CLK_CNTL0, -+ .mask = 0x3, -+ .shift = 16, -+ }, -+ .hw.init = &(struct clk_init_data){ -+ .name = "cpu_clk_dyn1_sel", -+ .ops = &clk_regmap_mux_ro_ops, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div2.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ }, - .num_parents = 3, - }, - }; -@@ -284,7 +384,9 @@ static struct clk_regmap g12a_cpu_clk_mux0_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn0_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_premux0.hw -+ }, - .num_parents = 1, - }, - }; -@@ -299,29 +401,14 @@ static struct clk_regmap g12a_cpu_clk_postmux0 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn0", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn0_sel", -- "cpu_clk_dyn0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_premux0.hw, -+ &g12a_cpu_clk_mux0_div.hw, -+ }, - .num_parents = 2, - }, - }; - --/* Datasheet names this field as "premux1" */ --static struct clk_regmap g12a_cpu_clk_premux1 = { -- .data = &(struct clk_regmap_mux_data){ -- .offset = HHI_SYS_CPU_CLK_CNTL0, -- .mask = 0x3, -- .shift = 16, -- }, -- .hw.init = &(struct clk_init_data){ -- .name = "cpu_clk_dyn1_sel", -- .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "fclk_div2", -- "fclk_div3" }, -- .num_parents = 3, -- }, --}; -- - /* Datasheet names this field as "Mux1_divn_tcnt" */ - static struct clk_regmap g12a_cpu_clk_mux1_div = { - .data = &(struct clk_regmap_div_data){ -@@ -332,7 +419,9 @@ static struct clk_regmap g12a_cpu_clk_mux1_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn1_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_premux1.hw -+ }, - .num_parents = 1, - }, - }; -@@ -347,8 +436,10 @@ static struct clk_regmap g12a_cpu_clk_postmux1 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn1", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn1_sel", -- "cpu_clk_dyn1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_premux1.hw, -+ &g12a_cpu_clk_mux1_div.hw, -+ }, - .num_parents = 2, - }, - }; -@@ -363,8 +454,10 @@ static struct clk_regmap g12a_cpu_clk_dyn = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn0", -- "cpu_clk_dyn1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_postmux0.hw, -+ &g12a_cpu_clk_postmux1.hw, -+ }, - .num_parents = 2, - }, - }; -@@ -379,8 +472,10 @@ static struct clk_regmap g12a_cpu_clk = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn", -- "sys_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_dyn.hw, -+ &g12a_sys_pll.hw, -+ }, - .num_parents = 2, - }, - }; -@@ -395,8 +490,10 @@ static struct clk_regmap g12b_cpu_clk = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_dyn", -- "sys1_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_dyn.hw, -+ &g12b_sys1_pll.hw -+ }, - .num_parents = 2, - }, - }; -@@ -411,9 +508,11 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn0_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "fclk_div2", -- "fclk_div3" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div2.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ }, - .num_parents = 3, - }, - }; -@@ -428,7 +527,9 @@ static struct clk_regmap g12b_cpub_clk_mux0_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn0_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_dyn0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_premux0.hw -+ }, - .num_parents = 1, - }, - }; -@@ -443,8 +544,10 @@ static struct clk_regmap g12b_cpub_clk_postmux0 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn0", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_dyn0_sel", -- "cpub_clk_dyn0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_premux0.hw, -+ &g12b_cpub_clk_mux0_div.hw -+ }, - .num_parents = 2, - }, - }; -@@ -459,9 +562,11 @@ static struct clk_regmap g12b_cpub_clk_premux1 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn1_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "fclk_div2", -- "fclk_div3" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div2.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ }, - .num_parents = 3, - }, - }; -@@ -476,7 +581,9 @@ static struct clk_regmap g12b_cpub_clk_mux1_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn1_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_dyn1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_premux1.hw -+ }, - .num_parents = 1, - }, - }; -@@ -491,8 +598,10 @@ static struct clk_regmap g12b_cpub_clk_postmux1 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn1", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_dyn1_sel", -- "cpub_clk_dyn1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_premux1.hw, -+ &g12b_cpub_clk_mux1_div.hw -+ }, - .num_parents = 2, - }, - }; -@@ -507,8 +616,10 @@ static struct clk_regmap g12b_cpub_clk_dyn = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_dyn0", -- "cpub_clk_dyn1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_postmux0.hw, -+ &g12b_cpub_clk_postmux1.hw -+ }, - .num_parents = 2, - }, - }; -@@ -523,8 +634,10 @@ static struct clk_regmap g12b_cpub_clk = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_dyn", -- "sys_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_dyn.hw, -+ &g12a_sys_pll.hw -+ }, - .num_parents = 2, - }, - }; -@@ -537,7 +650,9 @@ static struct clk_regmap g12a_cpu_clk_div16_en = { - .hw.init = &(struct clk_init_data) { - .name = "cpu_clk_div16_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk.hw -+ }, - .num_parents = 1, - /* - * This clock is used to debug the cpu_clk range -@@ -554,7 +669,9 @@ static struct clk_regmap g12b_cpub_clk_div16_en = { - .hw.init = &(struct clk_init_data) { - .name = "cpub_clk_div16_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - /* - * This clock is used to debug the cpu_clk range -@@ -569,7 +686,9 @@ static struct clk_fixed_factor g12a_cpu_clk_div16 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div16", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk_div16_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_div16_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -580,7 +699,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div16 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div16", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk_div16_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_div16_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -595,7 +716,7 @@ static struct clk_regmap g12a_cpu_clk_apb_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_apb_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw }, - .num_parents = 1, - }, - }; -@@ -608,7 +729,9 @@ static struct clk_regmap g12a_cpu_clk_apb = { - .hw.init = &(struct clk_init_data) { - .name = "cpu_clk_apb", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_apb_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_apb_div.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -627,7 +750,7 @@ static struct clk_regmap g12a_cpu_clk_atb_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_atb_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw }, - .num_parents = 1, - }, - }; -@@ -640,7 +763,9 @@ static struct clk_regmap g12a_cpu_clk_atb = { - .hw.init = &(struct clk_init_data) { - .name = "cpu_clk_atb", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_atb_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_atb_div.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -659,7 +784,7 @@ static struct clk_regmap g12a_cpu_clk_axi_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_axi_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw }, - .num_parents = 1, - }, - }; -@@ -672,7 +797,9 @@ static struct clk_regmap g12a_cpu_clk_axi = { - .hw.init = &(struct clk_init_data) { - .name = "cpu_clk_axi", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_axi_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_axi_div.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -691,7 +818,17 @@ static struct clk_regmap g12a_cpu_clk_trace_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_trace_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_data = &(const struct clk_parent_data) { -+ /* -+ * Note: -+ * G12A and G12B have different cpu_clks (with -+ * different struct clk_hw). We fallback to the global -+ * naming string mechanism so cpu_clk_trace_div picks -+ * up the appropriate one. -+ */ -+ .name = "cpu_clk", -+ .index = -1, -+ }, - .num_parents = 1, - }, - }; -@@ -704,7 +841,9 @@ static struct clk_regmap g12a_cpu_clk_trace = { - .hw.init = &(struct clk_init_data) { - .name = "cpu_clk_trace", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpu_clk_trace_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cpu_clk_trace_div.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -719,7 +858,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -730,7 +871,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div3 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div3", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -741,7 +884,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -752,7 +897,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div5 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div5", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -763,7 +910,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div6 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -774,7 +923,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div7 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div7", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -785,7 +936,9 @@ static struct clk_fixed_factor g12b_cpub_clk_div8 = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_div8", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpub_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -801,13 +954,15 @@ static struct clk_regmap g12b_cpub_clk_apb_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_apb_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_div2", -- "cpub_clk_div3", -- "cpub_clk_div4", -- "cpub_clk_div5", -- "cpub_clk_div6", -- "cpub_clk_div7", -- "cpub_clk_div8" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_div2.hw, -+ &g12b_cpub_clk_div3.hw, -+ &g12b_cpub_clk_div4.hw, -+ &g12b_cpub_clk_div5.hw, -+ &g12b_cpub_clk_div6.hw, -+ &g12b_cpub_clk_div7.hw, -+ &g12b_cpub_clk_div8.hw -+ }, - .num_parents = 7, - }, - }; -@@ -821,7 +976,9 @@ static struct clk_regmap g12b_cpub_clk_apb = { - .hw.init = &(struct clk_init_data) { - .name = "cpub_clk_apb", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_apb_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_apb_sel.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -840,13 +997,15 @@ static struct clk_regmap g12b_cpub_clk_atb_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_atb_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_div2", -- "cpub_clk_div3", -- "cpub_clk_div4", -- "cpub_clk_div5", -- "cpub_clk_div6", -- "cpub_clk_div7", -- "cpub_clk_div8" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_div2.hw, -+ &g12b_cpub_clk_div3.hw, -+ &g12b_cpub_clk_div4.hw, -+ &g12b_cpub_clk_div5.hw, -+ &g12b_cpub_clk_div6.hw, -+ &g12b_cpub_clk_div7.hw, -+ &g12b_cpub_clk_div8.hw -+ }, - .num_parents = 7, - }, - }; -@@ -860,7 +1019,9 @@ static struct clk_regmap g12b_cpub_clk_atb = { - .hw.init = &(struct clk_init_data) { - .name = "cpub_clk_atb", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_atb_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_atb_sel.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -879,13 +1040,15 @@ static struct clk_regmap g12b_cpub_clk_axi_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_axi_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_div2", -- "cpub_clk_div3", -- "cpub_clk_div4", -- "cpub_clk_div5", -- "cpub_clk_div6", -- "cpub_clk_div7", -- "cpub_clk_div8" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_div2.hw, -+ &g12b_cpub_clk_div3.hw, -+ &g12b_cpub_clk_div4.hw, -+ &g12b_cpub_clk_div5.hw, -+ &g12b_cpub_clk_div6.hw, -+ &g12b_cpub_clk_div7.hw, -+ &g12b_cpub_clk_div8.hw -+ }, - .num_parents = 7, - }, - }; -@@ -899,7 +1062,9 @@ static struct clk_regmap g12b_cpub_clk_axi = { - .hw.init = &(struct clk_init_data) { - .name = "cpub_clk_axi", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_axi_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_axi_sel.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -918,13 +1083,15 @@ static struct clk_regmap g12b_cpub_clk_trace_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_trace_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_div2", -- "cpub_clk_div3", -- "cpub_clk_div4", -- "cpub_clk_div5", -- "cpub_clk_div6", -- "cpub_clk_div7", -- "cpub_clk_div8" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_div2.hw, -+ &g12b_cpub_clk_div3.hw, -+ &g12b_cpub_clk_div4.hw, -+ &g12b_cpub_clk_div5.hw, -+ &g12b_cpub_clk_div6.hw, -+ &g12b_cpub_clk_div7.hw, -+ &g12b_cpub_clk_div8.hw -+ }, - .num_parents = 7, - }, - }; -@@ -938,7 +1105,9 @@ static struct clk_regmap g12b_cpub_clk_trace = { - .hw.init = &(struct clk_init_data) { - .name = "cpub_clk_trace", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cpub_clk_trace_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12b_cpub_clk_trace_sel.hw -+ }, - .num_parents = 1, - /* - * This clock is set by the ROM monitor code, -@@ -1003,7 +1172,9 @@ static struct clk_regmap g12a_gp0_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -1019,7 +1190,9 @@ static struct clk_regmap g12a_gp0_pll = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "gp0_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_gp0_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1077,7 +1250,9 @@ static struct clk_regmap g12a_hifi_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "hifi_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -1093,7 +1268,9 @@ static struct clk_regmap g12a_hifi_pll = { - .hw.init = &(struct clk_init_data){ - .name = "hifi_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "hifi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_hifi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1164,7 +1341,9 @@ static struct clk_regmap g12a_pcie_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll_dco", - .ops = &meson_clk_pcie_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -1175,7 +1354,9 @@ static struct clk_fixed_factor g12a_pcie_pll_dco_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll_dco_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "pcie_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_pcie_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1193,7 +1374,9 @@ static struct clk_regmap g12a_pcie_pll_od = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll_od", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "pcie_pll_dco_div2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_pcie_pll_dco_div2.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1205,7 +1388,9 @@ static struct clk_fixed_factor g12a_pcie_pll = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll_pll", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "pcie_pll_od" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_pcie_pll_od.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1247,7 +1432,9 @@ static struct clk_regmap g12a_hdmi_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - /* - * Display directly handle hdmi pll registers ATM, we need -@@ -1267,7 +1454,9 @@ static struct clk_regmap g12a_hdmi_pll_od = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_od", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_hdmi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -1283,7 +1472,9 @@ static struct clk_regmap g12a_hdmi_pll_od2 = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_od2", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_od" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_hdmi_pll_od.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -1299,77 +1490,21 @@ static struct clk_regmap g12a_hdmi_pll = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_od2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_hdmi_pll_od2.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, - }; - --static struct clk_fixed_factor g12a_fclk_div2_div = { -- .mult = 1, -- .div = 2, -- .hw.init = &(struct clk_init_data){ -- .name = "fclk_div2_div", -- .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -- .num_parents = 1, -- }, --}; -- --static struct clk_regmap g12a_fclk_div2 = { -- .data = &(struct clk_regmap_gate_data){ -- .offset = HHI_FIX_PLL_CNTL1, -- .bit_idx = 24, -- }, -- .hw.init = &(struct clk_init_data){ -- .name = "fclk_div2", -- .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div2_div" }, -- .num_parents = 1, -- }, --}; -- --static struct clk_fixed_factor g12a_fclk_div3_div = { -- .mult = 1, -- .div = 3, -- .hw.init = &(struct clk_init_data){ -- .name = "fclk_div3_div", -- .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -- .num_parents = 1, -- }, --}; -- --static struct clk_regmap g12a_fclk_div3 = { -- .data = &(struct clk_regmap_gate_data){ -- .offset = HHI_FIX_PLL_CNTL1, -- .bit_idx = 20, -- }, -- .hw.init = &(struct clk_init_data){ -- .name = "fclk_div3", -- .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div3_div" }, -- .num_parents = 1, -- /* -- * This clock is used by the resident firmware and is required -- * by the platform to operate correctly. -- * Until the following condition are met, we need this clock to -- * be marked as critical: -- * a) Mark the clock used by a firmware resource, if possible -- * b) CCF has a clock hand-off mechanism to make the sure the -- * clock stays on until the proper driver comes along -- */ -- .flags = CLK_IS_CRITICAL, -- }, --}; -- - static struct clk_fixed_factor g12a_fclk_div4_div = { - .mult = 1, - .div = 4, - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -1382,7 +1517,9 @@ static struct clk_regmap g12a_fclk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div4_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fclk_div4_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1393,7 +1530,7 @@ static struct clk_fixed_factor g12a_fclk_div5_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -1406,7 +1543,9 @@ static struct clk_regmap g12a_fclk_div5 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div5_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fclk_div5_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1417,7 +1556,7 @@ static struct clk_fixed_factor g12a_fclk_div7_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -1430,7 +1569,9 @@ static struct clk_regmap g12a_fclk_div7 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div7_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fclk_div7_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1441,7 +1582,9 @@ static struct clk_fixed_factor g12a_fclk_div2p5_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2p5_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fixed_pll_dco.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1454,7 +1597,9 @@ static struct clk_regmap g12a_fclk_div2p5 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2p5", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div2p5_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fclk_div2p5_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1465,7 +1610,9 @@ static struct clk_fixed_factor g12a_mpll_50m_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll_50m_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fixed_pll_dco.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1479,8 +1626,10 @@ static struct clk_regmap g12a_mpll_50m = { - .hw.init = &(struct clk_init_data){ - .name = "mpll_50m", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal", -- "mpll_50m_div" }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_mpll_50m_div.hw }, -+ }, - .num_parents = 2, - }, - }; -@@ -1491,7 +1640,9 @@ static struct clk_fixed_factor g12a_mpll_prediv = { - .hw.init = &(struct clk_init_data){ - .name = "mpll_prediv", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_fixed_pll_dco.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1529,7 +1680,9 @@ static struct clk_regmap g12a_mpll0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1542,7 +1695,7 @@ static struct clk_regmap g12a_mpll0 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_mpll0_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1581,7 +1734,9 @@ static struct clk_regmap g12a_mpll1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1594,7 +1749,7 @@ static struct clk_regmap g12a_mpll1 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_mpll1_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1633,7 +1788,9 @@ static struct clk_regmap g12a_mpll2_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1646,7 +1803,7 @@ static struct clk_regmap g12a_mpll2 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_mpll2_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1685,7 +1842,9 @@ static struct clk_regmap g12a_mpll3_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll3_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1698,16 +1857,21 @@ static struct clk_regmap g12a_mpll3 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll3", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll3_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_mpll3_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - - static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 }; --static const char * const clk81_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div7", "mpll1", "mpll2", "fclk_div4", -- "fclk_div3", "fclk_div5" -+static const struct clk_parent_data clk81_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div7.hw }, -+ { .hw = &g12a_mpll1.hw }, -+ { .hw = &g12a_mpll2.hw }, -+ { .hw = &g12a_fclk_div4.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ { .hw = &g12a_fclk_div5.hw }, - }; - - static struct clk_regmap g12a_mpeg_clk_sel = { -@@ -1720,8 +1884,8 @@ static struct clk_regmap g12a_mpeg_clk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "mpeg_clk_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = clk81_parent_names, -- .num_parents = ARRAY_SIZE(clk81_parent_names), -+ .parent_data = clk81_parent_data, -+ .num_parents = ARRAY_SIZE(clk81_parent_data), - }, - }; - -@@ -1734,7 +1898,9 @@ static struct clk_regmap g12a_mpeg_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpeg_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mpeg_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mpeg_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1748,15 +1914,20 @@ static struct clk_regmap g12a_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "clk81", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpeg_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mpeg_clk_div.hw -+ }, - .num_parents = 1, - .flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL), - }, - }; - --static const char * const g12a_sd_emmc_clk0_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div2", "fclk_div3", "fclk_div5", "fclk_div7", -- -+static const struct clk_parent_data g12a_sd_emmc_clk0_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div2.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ { .hw = &g12a_fclk_div5.hw }, -+ { .hw = &g12a_fclk_div7.hw }, - /* - * Following these parent clocks, we should also have had mpll2, mpll3 - * and gp0_pll but these clocks are too precious to be used here. All -@@ -1775,8 +1946,8 @@ static struct clk_regmap g12a_sd_emmc_a_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_a_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_names), -+ .parent_data = g12a_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1790,7 +1961,9 @@ static struct clk_regmap g12a_sd_emmc_a_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_a_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_a_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sd_emmc_a_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1804,7 +1977,9 @@ static struct clk_regmap g12a_sd_emmc_a_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_a_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_a_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sd_emmc_a_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1820,8 +1995,8 @@ static struct clk_regmap g12a_sd_emmc_b_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_b_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_names), -+ .parent_data = g12a_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1835,7 +2010,9 @@ static struct clk_regmap g12a_sd_emmc_b_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_b_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sd_emmc_b_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1849,7 +2026,9 @@ static struct clk_regmap g12a_sd_emmc_b_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_b_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_b_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sd_emmc_b_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1865,8 +2044,8 @@ static struct clk_regmap g12a_sd_emmc_c_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_c_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_names), -+ .parent_data = g12a_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1880,7 +2059,9 @@ static struct clk_regmap g12a_sd_emmc_c_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_c_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sd_emmc_c_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1894,17 +2075,89 @@ static struct clk_regmap g12a_sd_emmc_c_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_c_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_c_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_sd_emmc_c_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - -+/* Video Clocks */ -+ -+static struct clk_regmap g12a_vid_pll_div = { -+ .data = &(struct meson_vid_pll_div_data){ -+ .val = { -+ .reg_off = HHI_VID_PLL_CLK_DIV, -+ .shift = 0, -+ .width = 15, -+ }, -+ .sel = { -+ .reg_off = HHI_VID_PLL_CLK_DIV, -+ .shift = 16, -+ .width = 2, -+ }, -+ }, -+ .hw.init = &(struct clk_init_data) { -+ .name = "vid_pll_div", -+ .ops = &meson_vid_pll_div_ro_ops, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_pll.hw }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, -+ }, -+}; -+ -+static const struct clk_hw *g12a_vid_pll_parent_hws[] = { -+ &g12a_vid_pll_div.hw, -+ &g12a_hdmi_pll.hw, -+}; -+ -+static struct clk_regmap g12a_vid_pll_sel = { -+ .data = &(struct clk_regmap_mux_data){ -+ .offset = HHI_VID_PLL_CLK_DIV, -+ .mask = 0x1, -+ .shift = 18, -+ }, -+ .hw.init = &(struct clk_init_data){ -+ .name = "vid_pll_sel", -+ .ops = &clk_regmap_mux_ops, -+ /* -+ * bit 18 selects from 2 possible parents: -+ * vid_pll_div or hdmi_pll -+ */ -+ .parent_hws = g12a_vid_pll_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vid_pll_parent_hws), -+ .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, -+ }, -+}; -+ -+static struct clk_regmap g12a_vid_pll = { -+ .data = &(struct clk_regmap_gate_data){ -+ .offset = HHI_VID_PLL_CLK_DIV, -+ .bit_idx = 19, -+ }, -+ .hw.init = &(struct clk_init_data) { -+ .name = "vid_pll", -+ .ops = &clk_regmap_gate_ops, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vid_pll_sel.hw -+ }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, -+ }, -+}; -+ - /* VPU Clock */ - --static const char * const g12a_vpu_parent_names[] = { -- "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7", -- "mpll1", "vid_pll", "hifi_pll", "gp0_pll", -+static const struct clk_hw *g12a_vpu_parent_hws[] = { -+ &g12a_fclk_div3.hw, -+ &g12a_fclk_div4.hw, -+ &g12a_fclk_div5.hw, -+ &g12a_fclk_div7.hw, -+ &g12a_mpll1.hw, -+ &g12a_vid_pll.hw, -+ &g12a_hifi_pll.hw, -+ &g12a_gp0_pll.hw, - }; - - static struct clk_regmap g12a_vpu_0_sel = { -@@ -1916,8 +2169,8 @@ static struct clk_regmap g12a_vpu_0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vpu_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vpu_parent_names), -+ .parent_hws = g12a_vpu_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vpu_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -1931,7 +2184,7 @@ static struct clk_regmap g12a_vpu_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vpu_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1945,7 +2198,7 @@ static struct clk_regmap g12a_vpu_0 = { - .hw.init = &(struct clk_init_data) { - .name = "vpu_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vpu_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1960,8 +2213,8 @@ static struct clk_regmap g12a_vpu_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vpu_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vpu_parent_names), -+ .parent_hws = g12a_vpu_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vpu_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -1975,7 +2228,7 @@ static struct clk_regmap g12a_vpu_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vpu_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1989,7 +2242,7 @@ static struct clk_regmap g12a_vpu_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vpu_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vpu_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2008,7 +2261,10 @@ static struct clk_regmap g12a_vpu = { - * bit 31 selects from 2 possible parents: - * vpu_0 or vpu_1 - */ -- .parent_names = (const char *[]){ "vpu_0", "vpu_1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vpu_0.hw, -+ &g12a_vpu_1.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -2016,9 +2272,14 @@ static struct clk_regmap g12a_vpu = { - - /* VDEC clocks */ - --static const char * const g12a_vdec_parent_names[] = { -- "fclk_div2p5", "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7", -- "hifi_pll", "gp0_pll", -+static const struct clk_hw *g12a_vdec_parent_hws[] = { -+ &g12a_fclk_div2p5.hw, -+ &g12a_fclk_div3.hw, -+ &g12a_fclk_div4.hw, -+ &g12a_fclk_div5.hw, -+ &g12a_fclk_div7.hw, -+ &g12a_hifi_pll.hw, -+ &g12a_gp0_pll.hw, - }; - - static struct clk_regmap g12a_vdec_1_sel = { -@@ -2031,8 +2292,8 @@ static struct clk_regmap g12a_vdec_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vdec_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vdec_parent_names), -+ .parent_hws = g12a_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2047,7 +2308,9 @@ static struct clk_regmap g12a_vdec_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vdec_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2061,7 +2324,9 @@ static struct clk_regmap g12a_vdec_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vdec_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2077,8 +2342,8 @@ static struct clk_regmap g12a_vdec_hevcf_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevcf_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vdec_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vdec_parent_names), -+ .parent_hws = g12a_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2093,7 +2358,9 @@ static struct clk_regmap g12a_vdec_hevcf_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevcf_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_hevcf_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vdec_hevcf_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2107,7 +2374,9 @@ static struct clk_regmap g12a_vdec_hevcf = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_hevcf", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_hevcf_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vdec_hevcf_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2123,8 +2392,8 @@ static struct clk_regmap g12a_vdec_hevc_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevc_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vdec_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vdec_parent_names), -+ .parent_hws = g12a_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2139,7 +2408,9 @@ static struct clk_regmap g12a_vdec_hevc_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevc_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_hevc_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vdec_hevc_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2153,7 +2424,9 @@ static struct clk_regmap g12a_vdec_hevc = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_hevc", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_hevc_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vdec_hevc_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2161,9 +2434,15 @@ static struct clk_regmap g12a_vdec_hevc = { - - /* VAPB Clock */ - --static const char * const g12a_vapb_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7", -- "mpll1", "vid_pll", "mpll2", "fclk_div2p5", -+static const struct clk_hw *g12a_vapb_parent_hws[] = { -+ &g12a_fclk_div4.hw, -+ &g12a_fclk_div3.hw, -+ &g12a_fclk_div5.hw, -+ &g12a_fclk_div7.hw, -+ &g12a_mpll1.hw, -+ &g12a_vid_pll.hw, -+ &g12a_mpll2.hw, -+ &g12a_fclk_div2p5.hw, - }; - - static struct clk_regmap g12a_vapb_0_sel = { -@@ -2175,8 +2454,8 @@ static struct clk_regmap g12a_vapb_0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vapb_0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vapb_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vapb_parent_names), -+ .parent_hws = g12a_vapb_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vapb_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -2190,7 +2469,9 @@ static struct clk_regmap g12a_vapb_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "vapb_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vapb_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vapb_0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2204,7 +2485,9 @@ static struct clk_regmap g12a_vapb_0 = { - .hw.init = &(struct clk_init_data) { - .name = "vapb_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vapb_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vapb_0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2219,8 +2502,8 @@ static struct clk_regmap g12a_vapb_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vapb_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vapb_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vapb_parent_names), -+ .parent_hws = g12a_vapb_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vapb_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -2234,7 +2517,9 @@ static struct clk_regmap g12a_vapb_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vapb_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vapb_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vapb_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2248,7 +2533,9 @@ static struct clk_regmap g12a_vapb_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vapb_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vapb_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vapb_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2267,7 +2554,10 @@ static struct clk_regmap g12a_vapb_sel = { - * bit 31 selects from 2 possible parents: - * vapb_0 or vapb_1 - */ -- .parent_names = (const char *[]){ "vapb_0", "vapb_1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vapb_0.hw, -+ &g12a_vapb_1.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -2281,75 +2571,21 @@ static struct clk_regmap g12a_vapb = { - .hw.init = &(struct clk_init_data) { - .name = "vapb", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vapb_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vapb_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, - }; - --/* Video Clocks */ -- --static struct clk_regmap g12a_vid_pll_div = { -- .data = &(struct meson_vid_pll_div_data){ -- .val = { -- .reg_off = HHI_VID_PLL_CLK_DIV, -- .shift = 0, -- .width = 15, -- }, -- .sel = { -- .reg_off = HHI_VID_PLL_CLK_DIV, -- .shift = 16, -- .width = 2, -- }, -- }, -- .hw.init = &(struct clk_init_data) { -- .name = "vid_pll_div", -- .ops = &meson_vid_pll_div_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll" }, -- .num_parents = 1, -- .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, -- }, --}; -- --static const char * const g12a_vid_pll_parent_names[] = { "vid_pll_div", -- "hdmi_pll" }; -- --static struct clk_regmap g12a_vid_pll_sel = { -- .data = &(struct clk_regmap_mux_data){ -- .offset = HHI_VID_PLL_CLK_DIV, -- .mask = 0x1, -- .shift = 18, -- }, -- .hw.init = &(struct clk_init_data){ -- .name = "vid_pll_sel", -- .ops = &clk_regmap_mux_ops, -- /* -- * bit 18 selects from 2 possible parents: -- * vid_pll_div or hdmi_pll -- */ -- .parent_names = g12a_vid_pll_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vid_pll_parent_names), -- .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, -- }, --}; -- --static struct clk_regmap g12a_vid_pll = { -- .data = &(struct clk_regmap_gate_data){ -- .offset = HHI_VID_PLL_CLK_DIV, -- .bit_idx = 19, -- }, -- .hw.init = &(struct clk_init_data) { -- .name = "vid_pll", -- .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vid_pll_sel" }, -- .num_parents = 1, -- .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, -- }, --}; -- --static const char * const g12a_vclk_parent_names[] = { -- "vid_pll", "gp0_pll", "hifi_pll", "mpll1", "fclk_div3", "fclk_div4", -- "fclk_div5", "fclk_div7" -+static const struct clk_hw *g12a_vclk_parent_hws[] = { -+ &g12a_vid_pll.hw, -+ &g12a_gp0_pll.hw, -+ &g12a_hifi_pll.hw, -+ &g12a_mpll1.hw, -+ &g12a_fclk_div3.hw, -+ &g12a_fclk_div4.hw, -+ &g12a_fclk_div5.hw, -+ &g12a_fclk_div7.hw, - }; - - static struct clk_regmap g12a_vclk_sel = { -@@ -2361,8 +2597,8 @@ static struct clk_regmap g12a_vclk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vclk_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vclk_parent_names), -+ .parent_hws = g12a_vclk_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vclk_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2376,8 +2612,8 @@ static struct clk_regmap g12a_vclk2_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_vclk_parent_names, -- .num_parents = ARRAY_SIZE(g12a_vclk_parent_names), -+ .parent_hws = g12a_vclk_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_vclk_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2390,7 +2626,7 @@ static struct clk_regmap g12a_vclk_input = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_input", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2404,7 +2640,7 @@ static struct clk_regmap g12a_vclk2_input = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_input", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2419,7 +2655,9 @@ static struct clk_regmap g12a_vclk_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vclk_input" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk_input.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE, - }, -@@ -2434,7 +2672,9 @@ static struct clk_regmap g12a_vclk2_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vclk2_input" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk2_input.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE, - }, -@@ -2448,7 +2688,7 @@ static struct clk_regmap g12a_vclk = { - .hw.init = &(struct clk_init_data) { - .name = "vclk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2462,7 +2702,7 @@ static struct clk_regmap g12a_vclk2 = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2476,7 +2716,7 @@ static struct clk_regmap g12a_vclk_div1 = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2490,7 +2730,7 @@ static struct clk_regmap g12a_vclk_div2_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div2_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2504,7 +2744,7 @@ static struct clk_regmap g12a_vclk_div4_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div4_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2518,7 +2758,7 @@ static struct clk_regmap g12a_vclk_div6_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div6_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2532,7 +2772,7 @@ static struct clk_regmap g12a_vclk_div12_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div12_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2546,7 +2786,7 @@ static struct clk_regmap g12a_vclk2_div1 = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2560,7 +2800,7 @@ static struct clk_regmap g12a_vclk2_div2_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div2_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2574,7 +2814,7 @@ static struct clk_regmap g12a_vclk2_div4_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div4_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2588,7 +2828,7 @@ static struct clk_regmap g12a_vclk2_div6_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div6_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2602,7 +2842,7 @@ static struct clk_regmap g12a_vclk2_div12_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div12_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2614,7 +2854,9 @@ static struct clk_fixed_factor g12a_vclk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div2_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk_div2_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2625,7 +2867,9 @@ static struct clk_fixed_factor g12a_vclk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div4_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk_div4_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2636,7 +2880,9 @@ static struct clk_fixed_factor g12a_vclk_div6 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div6_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk_div6_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2647,7 +2893,9 @@ static struct clk_fixed_factor g12a_vclk_div12 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div12", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div12_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk_div12_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2658,7 +2906,9 @@ static struct clk_fixed_factor g12a_vclk2_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div2_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk2_div2_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2669,7 +2919,9 @@ static struct clk_fixed_factor g12a_vclk2_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div4_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk2_div4_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2680,7 +2932,9 @@ static struct clk_fixed_factor g12a_vclk2_div6 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div6_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk2_div6_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -2691,16 +2945,25 @@ static struct clk_fixed_factor g12a_vclk2_div12 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div12", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div12_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_vclk2_div12_en.hw -+ }, - .num_parents = 1, - }, - }; - - static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 }; --static const char * const g12a_cts_parent_names[] = { -- "vclk_div1", "vclk_div2", "vclk_div4", "vclk_div6", -- "vclk_div12", "vclk2_div1", "vclk2_div2", "vclk2_div4", -- "vclk2_div6", "vclk2_div12" -+static const struct clk_hw *g12a_cts_parent_hws[] = { -+ &g12a_vclk_div1.hw, -+ &g12a_vclk_div2.hw, -+ &g12a_vclk_div4.hw, -+ &g12a_vclk_div6.hw, -+ &g12a_vclk_div12.hw, -+ &g12a_vclk2_div1.hw, -+ &g12a_vclk2_div2.hw, -+ &g12a_vclk2_div4.hw, -+ &g12a_vclk2_div6.hw, -+ &g12a_vclk2_div12.hw, - }; - - static struct clk_regmap g12a_cts_enci_sel = { -@@ -2713,8 +2976,8 @@ static struct clk_regmap g12a_cts_enci_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_enci_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_cts_parent_names, -- .num_parents = ARRAY_SIZE(g12a_cts_parent_names), -+ .parent_hws = g12a_cts_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_cts_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2729,8 +2992,8 @@ static struct clk_regmap g12a_cts_encp_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_encp_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_cts_parent_names, -- .num_parents = ARRAY_SIZE(g12a_cts_parent_names), -+ .parent_hws = g12a_cts_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_cts_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2745,18 +3008,25 @@ static struct clk_regmap g12a_cts_vdac_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_vdac_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_cts_parent_names, -- .num_parents = ARRAY_SIZE(g12a_cts_parent_names), -+ .parent_hws = g12a_cts_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_cts_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; - - /* TOFIX: add support for cts_tcon */ - static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 }; --static const char * const g12a_cts_hdmi_tx_parent_names[] = { -- "vclk_div1", "vclk_div2", "vclk_div4", "vclk_div6", -- "vclk_div12", "vclk2_div1", "vclk2_div2", "vclk2_div4", -- "vclk2_div6", "vclk2_div12" -+static const struct clk_hw *g12a_cts_hdmi_tx_parent_hws[] = { -+ &g12a_vclk_div1.hw, -+ &g12a_vclk_div2.hw, -+ &g12a_vclk_div4.hw, -+ &g12a_vclk_div6.hw, -+ &g12a_vclk_div12.hw, -+ &g12a_vclk2_div1.hw, -+ &g12a_vclk2_div2.hw, -+ &g12a_vclk2_div4.hw, -+ &g12a_vclk2_div6.hw, -+ &g12a_vclk2_div12.hw, - }; - - static struct clk_regmap g12a_hdmi_tx_sel = { -@@ -2769,8 +3039,8 @@ static struct clk_regmap g12a_hdmi_tx_sel = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_tx_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_cts_hdmi_tx_parent_names, -- .num_parents = ARRAY_SIZE(g12a_cts_hdmi_tx_parent_names), -+ .parent_hws = g12a_cts_hdmi_tx_parent_hws, -+ .num_parents = ARRAY_SIZE(g12a_cts_hdmi_tx_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2783,7 +3053,9 @@ static struct clk_regmap g12a_cts_enci = { - .hw.init = &(struct clk_init_data) { - .name = "cts_enci", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_enci_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cts_enci_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2797,7 +3069,9 @@ static struct clk_regmap g12a_cts_encp = { - .hw.init = &(struct clk_init_data) { - .name = "cts_encp", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_encp_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cts_encp_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2811,7 +3085,9 @@ static struct clk_regmap g12a_cts_vdac = { - .hw.init = &(struct clk_init_data) { - .name = "cts_vdac", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_vdac_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_cts_vdac_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2825,7 +3101,9 @@ static struct clk_regmap g12a_hdmi_tx = { - .hw.init = &(struct clk_init_data) { - .name = "hdmi_tx", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "hdmi_tx_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_hdmi_tx_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2833,8 +3111,11 @@ static struct clk_regmap g12a_hdmi_tx = { - - /* HDMI Clocks */ - --static const char * const g12a_hdmi_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div4", "fclk_div3", "fclk_div5" -+static const struct clk_parent_data g12a_hdmi_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_fclk_div4.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ { .hw = &g12a_fclk_div5.hw }, - }; - - static struct clk_regmap g12a_hdmi_sel = { -@@ -2847,8 +3128,8 @@ static struct clk_regmap g12a_hdmi_sel = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_hdmi_parent_names, -- .num_parents = ARRAY_SIZE(g12a_hdmi_parent_names), -+ .parent_data = g12a_hdmi_parent_data, -+ .num_parents = ARRAY_SIZE(g12a_hdmi_parent_data), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2862,7 +3143,7 @@ static struct clk_regmap g12a_hdmi_div = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "hdmi_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_sel.hw }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE, - }, -@@ -2876,7 +3157,7 @@ static struct clk_regmap g12a_hdmi = { - .hw.init = &(struct clk_init_data) { - .name = "hdmi", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "hdmi_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2886,10 +3167,15 @@ static struct clk_regmap g12a_hdmi = { - * The MALI IP is clocked by two identical clocks (mali_0 and mali_1) - * muxed by a glitch-free switch. - */ -- --static const char * const g12a_mali_0_1_parent_names[] = { -- IN_PREFIX "xtal", "gp0_pll", "hifi_pll", "fclk_div2p5", -- "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7" -+static const struct clk_parent_data g12a_mali_0_1_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &g12a_gp0_pll.hw }, -+ { .hw = &g12a_hifi_pll.hw }, -+ { .hw = &g12a_fclk_div2p5.hw }, -+ { .hw = &g12a_fclk_div3.hw }, -+ { .hw = &g12a_fclk_div4.hw }, -+ { .hw = &g12a_fclk_div5.hw }, -+ { .hw = &g12a_fclk_div7.hw }, - }; - - static struct clk_regmap g12a_mali_0_sel = { -@@ -2901,7 +3187,7 @@ static struct clk_regmap g12a_mali_0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_mali_0_1_parent_names, -+ .parent_data = g12a_mali_0_1_parent_data, - .num_parents = 8, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -2916,7 +3202,9 @@ static struct clk_regmap g12a_mali_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mali_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mali_0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -2930,7 +3218,9 @@ static struct clk_regmap g12a_mali_0 = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mali_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mali_0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2945,7 +3235,7 @@ static struct clk_regmap g12a_mali_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_mali_0_1_parent_names, -+ .parent_data = g12a_mali_0_1_parent_data, - .num_parents = 8, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -2960,7 +3250,9 @@ static struct clk_regmap g12a_mali_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mali_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mali_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -2974,14 +3266,17 @@ static struct clk_regmap g12a_mali_1 = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mali_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_mali_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const g12a_mali_parent_names[] = { -- "mali_0", "mali_1" -+static const struct clk_hw *g12a_mali_parent_hws[] = { -+ &g12a_mali_0.hw, -+ &g12a_mali_1.hw, - }; - - static struct clk_regmap g12a_mali = { -@@ -2993,7 +3288,7 @@ static struct clk_regmap g12a_mali = { - .hw.init = &(struct clk_init_data){ - .name = "mali", - .ops = &clk_regmap_mux_ops, -- .parent_names = g12a_mali_parent_names, -+ .parent_hws = g12a_mali_parent_hws, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -3008,7 +3303,9 @@ static struct clk_regmap g12a_ts_div = { - .hw.init = &(struct clk_init_data){ - .name = "ts_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -3021,7 +3318,9 @@ static struct clk_regmap g12a_ts = { - .hw.init = &(struct clk_init_data){ - .name = "ts", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "ts_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &g12a_ts_div.hw -+ }, - .num_parents = 1, - }, - }; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch b/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch new file mode 100644 index 0000000000..9af3e028e2 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch @@ -0,0 +1,31 @@ +From bfbcca83970e75e1231347f1693e0884b17bec98 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 22 Jan 2020 10:25:26 +0100 +Subject: [PATCH 008/146] FROMGIT: dt-bindings: reset: meson: add gxl internal + dac reset + +Add the reset line of the internal DAC found on the amlogic gxl SoC family + +Signed-off-by: Jerome Brunet +Reviewed-by: Neil Armstrong +Signed-off-by: Neil Armstrong +--- + include/dt-bindings/reset/amlogic,meson-gxbb-reset.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/dt-bindings/reset/amlogic,meson-gxbb-reset.h b/include/dt-bindings/reset/amlogic,meson-gxbb-reset.h +index ea5058618863..883bfd3bcbad 100644 +--- a/include/dt-bindings/reset/amlogic,meson-gxbb-reset.h ++++ b/include/dt-bindings/reset/amlogic,meson-gxbb-reset.h +@@ -69,7 +69,7 @@ + #define RESET_SYS_CPU_L2 58 + #define RESET_SYS_CPU_P 59 + #define RESET_SYS_CPU_MBIST 60 +-/* 61 */ ++#define RESET_ACODEC 61 + /* 62 */ + /* 63 */ + /* RESET2 */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-clk-meson-gxbb-migrate-to-the-new-parent-des.patch b/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-clk-meson-gxbb-migrate-to-the-new-parent-des.patch deleted file mode 100644 index fc60f92bea..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-clk-meson-gxbb-migrate-to-the-new-parent-des.patch +++ /dev/null @@ -1,1677 +0,0 @@ -From 8286ca1faad2b3a76dc66264d419f5b726eb9119 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:33 +0200 -Subject: [PATCH 009/187] FROMGIT: clk: meson: gxbb: migrate to the new parent - description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (ie. when -all clocks are local to the controller) and use .parent_data otherwise. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit 0dea3f35996f4571eacbf6cac889d57bfd20822a - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/gxbb.c | 654 +++++++++++++++++++++++++++------------ - 1 file changed, 451 insertions(+), 203 deletions(-) - -diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c -index dab16d9b1af8..67e466356d4b 100644 ---- a/drivers/clk/meson/gxbb.c -+++ b/drivers/clk/meson/gxbb.c -@@ -10,15 +10,12 @@ - #include - - #include "gxbb.h" --#include "clk-input.h" - #include "clk-regmap.h" - #include "clk-pll.h" - #include "clk-mpll.h" - #include "meson-eeclk.h" - #include "vid-pll-div.h" - --#define IN_PREFIX "ee-in-" -- - static DEFINE_SPINLOCK(meson_clk_lock); - - static const struct pll_params_table gxbb_gp0_pll_params_table[] = { -@@ -121,7 +118,9 @@ static struct clk_regmap gxbb_fixed_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -136,7 +135,9 @@ static struct clk_regmap gxbb_fixed_pll = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fixed_pll_dco.hw -+ }, - .num_parents = 1, - /* - * This clock won't ever change at runtime so -@@ -151,7 +152,9 @@ static struct clk_fixed_factor gxbb_hdmi_pll_pre_mult = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_pre_mult", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -192,7 +195,9 @@ static struct clk_regmap gxbb_hdmi_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_pre_mult" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_hdmi_pll_pre_mult.hw -+ }, - .num_parents = 1, - /* - * Display directly handle hdmi pll registers ATM, we need -@@ -244,7 +249,9 @@ static struct clk_regmap gxl_hdmi_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - /* - * Display directly handle hdmi pll registers ATM, we need -@@ -264,7 +271,9 @@ static struct clk_regmap gxbb_hdmi_pll_od = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_od", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_hdmi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -280,7 +289,9 @@ static struct clk_regmap gxbb_hdmi_pll_od2 = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_od2", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_od" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_hdmi_pll_od.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -296,7 +307,9 @@ static struct clk_regmap gxbb_hdmi_pll = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_od2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_hdmi_pll_od2.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -312,7 +325,9 @@ static struct clk_regmap gxl_hdmi_pll_od = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_od", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxl_hdmi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -328,7 +343,9 @@ static struct clk_regmap gxl_hdmi_pll_od2 = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_od2", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_od" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxl_hdmi_pll_od.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -344,7 +361,9 @@ static struct clk_regmap gxl_hdmi_pll = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_od2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxl_hdmi_pll_od2.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT, - }, -@@ -381,7 +400,9 @@ static struct clk_regmap gxbb_sys_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -396,7 +417,9 @@ static struct clk_regmap gxbb_sys_pll = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "sys_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sys_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -442,7 +465,9 @@ static struct clk_regmap gxbb_gp0_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -494,7 +519,9 @@ static struct clk_regmap gxl_gp0_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -509,7 +536,17 @@ static struct clk_regmap gxbb_gp0_pll = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "gp0_pll_dco" }, -+ .parent_data = &(const struct clk_parent_data) { -+ /* -+ * Note: -+ * GXL and GXBB have different gp0_pll_dco (with -+ * different struct clk_hw). We fallback to the global -+ * naming string mechanism so gp0_pll picks up the -+ * appropriate one. -+ */ -+ .name = "gp0_pll_dco", -+ .index = -1, -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -521,7 +558,9 @@ static struct clk_fixed_factor gxbb_fclk_div2_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -534,7 +573,9 @@ static struct clk_regmap gxbb_fclk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fclk_div2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_IS_CRITICAL, - }, -@@ -546,7 +587,7 @@ static struct clk_fixed_factor gxbb_fclk_div3_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div3_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -559,7 +600,9 @@ static struct clk_regmap gxbb_fclk_div3 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div3", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div3_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fclk_div3_div.hw -+ }, - .num_parents = 1, - /* - * FIXME: -@@ -582,7 +625,7 @@ static struct clk_fixed_factor gxbb_fclk_div4_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -595,7 +638,9 @@ static struct clk_regmap gxbb_fclk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div4_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fclk_div4_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -606,7 +651,7 @@ static struct clk_fixed_factor gxbb_fclk_div5_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -619,7 +664,9 @@ static struct clk_regmap gxbb_fclk_div5 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div5_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fclk_div5_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -630,7 +677,7 @@ static struct clk_fixed_factor gxbb_fclk_div7_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -643,7 +690,9 @@ static struct clk_regmap gxbb_fclk_div7 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div7_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_fclk_div7_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -657,7 +706,7 @@ static struct clk_regmap gxbb_mpll_prediv = { - .hw.init = &(struct clk_init_data){ - .name = "mpll_prediv", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -684,7 +733,9 @@ static struct clk_regmap gxbb_mpll0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -697,7 +748,7 @@ static struct clk_regmap gxbb_mpll0 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_mpll0_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -725,7 +776,9 @@ static struct clk_regmap gxbb_mpll1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -738,7 +791,7 @@ static struct clk_regmap gxbb_mpll1 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_mpll1_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -766,7 +819,9 @@ static struct clk_regmap gxbb_mpll2_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -779,16 +834,21 @@ static struct clk_regmap gxbb_mpll2 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_mpll2_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - - static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 }; --static const char * const clk81_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div7", "mpll1", "mpll2", "fclk_div4", -- "fclk_div3", "fclk_div5" -+static const struct clk_parent_data clk81_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &gxbb_fclk_div7.hw }, -+ { .hw = &gxbb_mpll1.hw }, -+ { .hw = &gxbb_mpll2.hw }, -+ { .hw = &gxbb_fclk_div4.hw }, -+ { .hw = &gxbb_fclk_div3.hw }, -+ { .hw = &gxbb_fclk_div5.hw }, - }; - - static struct clk_regmap gxbb_mpeg_clk_sel = { -@@ -806,8 +866,8 @@ static struct clk_regmap gxbb_mpeg_clk_sel = { - * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2, - * fclk_div4, fclk_div3, fclk_div5 - */ -- .parent_names = clk81_parent_names, -- .num_parents = ARRAY_SIZE(clk81_parent_names), -+ .parent_data = clk81_parent_data, -+ .num_parents = ARRAY_SIZE(clk81_parent_data), - }, - }; - -@@ -820,7 +880,9 @@ static struct clk_regmap gxbb_mpeg_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpeg_clk_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "mpeg_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpeg_clk_sel.hw -+ }, - .num_parents = 1, - }, - }; -@@ -834,7 +896,9 @@ static struct clk_regmap gxbb_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "clk81", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpeg_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpeg_clk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_IS_CRITICAL, - }, -@@ -850,7 +914,10 @@ static struct clk_regmap gxbb_sar_adc_clk_sel = { - .name = "sar_adc_clk_sel", - .ops = &clk_regmap_mux_ops, - /* NOTE: The datasheet doesn't list the parents for bit 10 */ -- .parent_names = (const char *[]){ IN_PREFIX "xtal", "clk81", }, -+ .parent_data = (const struct clk_parent_data []) { -+ { .fw_name = "xtal", }, -+ { .hw = &gxbb_clk81.hw }, -+ }, - .num_parents = 2, - }, - }; -@@ -864,7 +931,9 @@ static struct clk_regmap gxbb_sar_adc_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "sar_adc_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sar_adc_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sar_adc_clk_sel.hw -+ }, - .num_parents = 1, - }, - }; -@@ -877,7 +946,9 @@ static struct clk_regmap gxbb_sar_adc_clk = { - .hw.init = &(struct clk_init_data){ - .name = "sar_adc_clk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sar_adc_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sar_adc_clk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -888,9 +959,15 @@ static struct clk_regmap gxbb_sar_adc_clk = { - * muxed by a glitch-free switch. - */ - --static const char * const gxbb_mali_0_1_parent_names[] = { -- IN_PREFIX "xtal", "gp0_pll", "mpll2", "mpll1", "fclk_div7", -- "fclk_div4", "fclk_div3", "fclk_div5" -+static const struct clk_parent_data gxbb_mali_0_1_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &gxbb_gp0_pll.hw }, -+ { .hw = &gxbb_mpll2.hw }, -+ { .hw = &gxbb_mpll1.hw }, -+ { .hw = &gxbb_fclk_div7.hw }, -+ { .hw = &gxbb_fclk_div4.hw }, -+ { .hw = &gxbb_fclk_div3.hw }, -+ { .hw = &gxbb_fclk_div5.hw }, - }; - - static struct clk_regmap gxbb_mali_0_sel = { -@@ -907,7 +984,7 @@ static struct clk_regmap gxbb_mali_0_sel = { - * xtal, gp0_pll, mpll2, mpll1, fclk_div7, - * fclk_div4, fclk_div3, fclk_div5 - */ -- .parent_names = gxbb_mali_0_1_parent_names, -+ .parent_data = gxbb_mali_0_1_parent_data, - .num_parents = 8, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -922,7 +999,9 @@ static struct clk_regmap gxbb_mali_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mali_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mali_0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -936,7 +1015,9 @@ static struct clk_regmap gxbb_mali_0 = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mali_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mali_0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -956,7 +1037,7 @@ static struct clk_regmap gxbb_mali_1_sel = { - * xtal, gp0_pll, mpll2, mpll1, fclk_div7, - * fclk_div4, fclk_div3, fclk_div5 - */ -- .parent_names = gxbb_mali_0_1_parent_names, -+ .parent_data = gxbb_mali_0_1_parent_data, - .num_parents = 8, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -971,7 +1052,9 @@ static struct clk_regmap gxbb_mali_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mali_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mali_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -985,14 +1068,17 @@ static struct clk_regmap gxbb_mali_1 = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mali_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mali_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const gxbb_mali_parent_names[] = { -- "mali_0", "mali_1" -+static const struct clk_hw *gxbb_mali_parent_hws[] = { -+ &gxbb_mali_0.hw, -+ &gxbb_mali_1.hw, - }; - - static struct clk_regmap gxbb_mali = { -@@ -1004,7 +1090,7 @@ static struct clk_regmap gxbb_mali = { - .hw.init = &(struct clk_init_data){ - .name = "mali", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_mali_parent_names, -+ .parent_hws = gxbb_mali_parent_hws, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -1021,7 +1107,11 @@ static struct clk_regmap gxbb_cts_amclk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_amclk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "mpll0", "mpll1", "mpll2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpll0.hw, -+ &gxbb_mpll1.hw, -+ &gxbb_mpll2.hw, -+ }, - .num_parents = 3, - }, - }; -@@ -1036,7 +1126,9 @@ static struct clk_regmap gxbb_cts_amclk_div = { - .hw.init = &(struct clk_init_data){ - .name = "cts_amclk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "cts_amclk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_amclk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1050,7 +1142,9 @@ static struct clk_regmap gxbb_cts_amclk = { - .hw.init = &(struct clk_init_data){ - .name = "cts_amclk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_amclk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_amclk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1067,7 +1161,11 @@ static struct clk_regmap gxbb_cts_mclk_i958_sel = { - .hw.init = &(struct clk_init_data) { - .name = "cts_mclk_i958_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "mpll0", "mpll1", "mpll2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_mpll0.hw, -+ &gxbb_mpll1.hw, -+ &gxbb_mpll2.hw, -+ }, - .num_parents = 3, - }, - }; -@@ -1082,7 +1180,9 @@ static struct clk_regmap gxbb_cts_mclk_i958_div = { - .hw.init = &(struct clk_init_data) { - .name = "cts_mclk_i958_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "cts_mclk_i958_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_mclk_i958_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1096,7 +1196,9 @@ static struct clk_regmap gxbb_cts_mclk_i958 = { - .hw.init = &(struct clk_init_data){ - .name = "cts_mclk_i958", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_mclk_i958_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_mclk_i958_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1111,7 +1213,10 @@ static struct clk_regmap gxbb_cts_i958 = { - .hw.init = &(struct clk_init_data){ - .name = "cts_i958", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "cts_amclk", "cts_mclk_i958" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_amclk.hw, -+ &gxbb_cts_mclk_i958.hw -+ }, - .num_parents = 2, - /* - *The parent is specific to origin of the audio data. Let the -@@ -1121,6 +1226,33 @@ static struct clk_regmap gxbb_cts_i958 = { - }, - }; - -+static const struct clk_parent_data gxbb_32k_clk_parent_data[] = { -+ { .fw_name = "xtal", }, -+ /* -+ * FIXME: This clock is provided by the ao clock controller but the -+ * clock is not yet part of the binding of this controller, so string -+ * name must be use to set this parent. -+ */ -+ { .name = "cts_slow_oscin", .index = -1 }, -+ { .hw = &gxbb_fclk_div3.hw }, -+ { .hw = &gxbb_fclk_div5.hw }, -+}; -+ -+static struct clk_regmap gxbb_32k_clk_sel = { -+ .data = &(struct clk_regmap_mux_data){ -+ .offset = HHI_32K_CLK_CNTL, -+ .mask = 0x3, -+ .shift = 16, -+ }, -+ .hw.init = &(struct clk_init_data){ -+ .name = "32k_clk_sel", -+ .ops = &clk_regmap_mux_ops, -+ .parent_data = gxbb_32k_clk_parent_data, -+ .num_parents = 4, -+ .flags = CLK_SET_RATE_PARENT, -+ }, -+}; -+ - static struct clk_regmap gxbb_32k_clk_div = { - .data = &(struct clk_regmap_div_data){ - .offset = HHI_32K_CLK_CNTL, -@@ -1130,7 +1262,9 @@ static struct clk_regmap gxbb_32k_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "32k_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "32k_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_32k_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST, - }, -@@ -1144,34 +1278,20 @@ static struct clk_regmap gxbb_32k_clk = { - .hw.init = &(struct clk_init_data){ - .name = "32k_clk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "32k_clk_div" }, -- .num_parents = 1, -- .flags = CLK_SET_RATE_PARENT, -- }, --}; -- --static const char * const gxbb_32k_clk_parent_names[] = { -- IN_PREFIX "xtal", "cts_slow_oscin", "fclk_div3", "fclk_div5" --}; -- --static struct clk_regmap gxbb_32k_clk_sel = { -- .data = &(struct clk_regmap_mux_data){ -- .offset = HHI_32K_CLK_CNTL, -- .mask = 0x3, -- .shift = 16, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_32k_clk_div.hw - }, -- .hw.init = &(struct clk_init_data){ -- .name = "32k_clk_sel", -- .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_32k_clk_parent_names, -- .num_parents = 4, -+ .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const gxbb_sd_emmc_clk0_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div2", "fclk_div3", "fclk_div5", "fclk_div7", -- -+static const struct clk_parent_data gxbb_sd_emmc_clk0_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &gxbb_fclk_div2.hw }, -+ { .hw = &gxbb_fclk_div3.hw }, -+ { .hw = &gxbb_fclk_div5.hw }, -+ { .hw = &gxbb_fclk_div7.hw }, - /* - * Following these parent clocks, we should also have had mpll2, mpll3 - * and gp0_pll but these clocks are too precious to be used here. All -@@ -1190,8 +1310,8 @@ static struct clk_regmap gxbb_sd_emmc_a_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_a_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_sd_emmc_clk0_parent_names), -+ .parent_data = gxbb_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(gxbb_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1206,7 +1326,9 @@ static struct clk_regmap gxbb_sd_emmc_a_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_a_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_a_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sd_emmc_a_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1220,7 +1342,9 @@ static struct clk_regmap gxbb_sd_emmc_a_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_a_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_a_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sd_emmc_a_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1236,8 +1360,8 @@ static struct clk_regmap gxbb_sd_emmc_b_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_b_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_sd_emmc_clk0_parent_names), -+ .parent_data = gxbb_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(gxbb_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1252,7 +1376,9 @@ static struct clk_regmap gxbb_sd_emmc_b_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_b_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sd_emmc_b_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1266,7 +1392,9 @@ static struct clk_regmap gxbb_sd_emmc_b_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_b_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_b_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sd_emmc_b_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1282,8 +1410,8 @@ static struct clk_regmap gxbb_sd_emmc_c_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_c_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_sd_emmc_clk0_parent_names), -+ .parent_data = gxbb_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(gxbb_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1298,7 +1426,9 @@ static struct clk_regmap gxbb_sd_emmc_c_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_c_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sd_emmc_c_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1312,7 +1442,9 @@ static struct clk_regmap gxbb_sd_emmc_c_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_c_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_c_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_sd_emmc_c_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1320,8 +1452,11 @@ static struct clk_regmap gxbb_sd_emmc_c_clk0 = { - - /* VPU Clock */ - --static const char * const gxbb_vpu_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7" -+static const struct clk_hw *gxbb_vpu_parent_hws[] = { -+ &gxbb_fclk_div4.hw, -+ &gxbb_fclk_div3.hw, -+ &gxbb_fclk_div5.hw, -+ &gxbb_fclk_div7.hw, - }; - - static struct clk_regmap gxbb_vpu_0_sel = { -@@ -1337,8 +1472,8 @@ static struct clk_regmap gxbb_vpu_0_sel = { - * bits 9:10 selects from 4 possible parents: - * fclk_div4, fclk_div3, fclk_div5, fclk_div7, - */ -- .parent_names = gxbb_vpu_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vpu_parent_names), -+ .parent_hws = gxbb_vpu_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vpu_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -1352,7 +1487,7 @@ static struct clk_regmap gxbb_vpu_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vpu_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vpu_0_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1366,7 +1501,7 @@ static struct clk_regmap gxbb_vpu_0 = { - .hw.init = &(struct clk_init_data) { - .name = "vpu_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vpu_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vpu_0_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1385,8 +1520,8 @@ static struct clk_regmap gxbb_vpu_1_sel = { - * bits 25:26 selects from 4 possible parents: - * fclk_div4, fclk_div3, fclk_div5, fclk_div7, - */ -- .parent_names = gxbb_vpu_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vpu_parent_names), -+ .parent_hws = gxbb_vpu_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vpu_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -1400,7 +1535,7 @@ static struct clk_regmap gxbb_vpu_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vpu_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vpu_1_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1414,7 +1549,7 @@ static struct clk_regmap gxbb_vpu_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vpu_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vpu_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vpu_1_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1433,7 +1568,10 @@ static struct clk_regmap gxbb_vpu = { - * bit 31 selects from 2 possible parents: - * vpu_0 or vpu_1 - */ -- .parent_names = (const char *[]){ "vpu_0", "vpu_1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vpu_0.hw, -+ &gxbb_vpu_1.hw -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -1441,8 +1579,11 @@ static struct clk_regmap gxbb_vpu = { - - /* VAPB Clock */ - --static const char * const gxbb_vapb_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7" -+static const struct clk_hw *gxbb_vapb_parent_hws[] = { -+ &gxbb_fclk_div4.hw, -+ &gxbb_fclk_div3.hw, -+ &gxbb_fclk_div5.hw, -+ &gxbb_fclk_div7.hw, - }; - - static struct clk_regmap gxbb_vapb_0_sel = { -@@ -1458,8 +1599,8 @@ static struct clk_regmap gxbb_vapb_0_sel = { - * bits 9:10 selects from 4 possible parents: - * fclk_div4, fclk_div3, fclk_div5, fclk_div7, - */ -- .parent_names = gxbb_vapb_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vapb_parent_names), -+ .parent_hws = gxbb_vapb_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vapb_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -1473,7 +1614,9 @@ static struct clk_regmap gxbb_vapb_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "vapb_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vapb_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vapb_0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1487,7 +1630,9 @@ static struct clk_regmap gxbb_vapb_0 = { - .hw.init = &(struct clk_init_data) { - .name = "vapb_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vapb_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vapb_0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1506,8 +1651,8 @@ static struct clk_regmap gxbb_vapb_1_sel = { - * bits 25:26 selects from 4 possible parents: - * fclk_div4, fclk_div3, fclk_div5, fclk_div7, - */ -- .parent_names = gxbb_vapb_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vapb_parent_names), -+ .parent_hws = gxbb_vapb_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vapb_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; -@@ -1521,7 +1666,9 @@ static struct clk_regmap gxbb_vapb_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vapb_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vapb_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vapb_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1535,7 +1682,9 @@ static struct clk_regmap gxbb_vapb_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vapb_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vapb_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vapb_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1554,7 +1703,10 @@ static struct clk_regmap gxbb_vapb_sel = { - * bit 31 selects from 2 possible parents: - * vapb_0 or vapb_1 - */ -- .parent_names = (const char *[]){ "vapb_0", "vapb_1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vapb_0.hw, -+ &gxbb_vapb_1.hw -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -1568,7 +1720,7 @@ static struct clk_regmap gxbb_vapb = { - .hw.init = &(struct clk_init_data) { - .name = "vapb", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vapb_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vapb_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1592,13 +1744,33 @@ static struct clk_regmap gxbb_vid_pll_div = { - .hw.init = &(struct clk_init_data) { - .name = "vid_pll_div", - .ops = &meson_vid_pll_div_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll" }, -+ .parent_data = &(const struct clk_parent_data) { -+ /* -+ * Note: -+ * GXL and GXBB have different hdmi_plls (with -+ * different struct clk_hw). We fallback to the global -+ * naming string mechanism so vid_pll_div picks up the -+ * appropriate one. -+ */ -+ .name = "hdmi_pll", -+ .index = -1, -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, - }, - }; - --static const char * const gxbb_vid_pll_parent_names[] = { "vid_pll_div", "hdmi_pll" }; -+static const struct clk_parent_data gxbb_vid_pll_parent_data[] = { -+ { .hw = &gxbb_vid_pll_div.hw }, -+ /* -+ * Note: -+ * GXL and GXBB have different hdmi_plls (with -+ * different struct clk_hw). We fallback to the global -+ * naming string mechanism so vid_pll_div picks up the -+ * appropriate one. -+ */ -+ { .name = "hdmi_pll", .index = -1 }, -+}; - - static struct clk_regmap gxbb_vid_pll_sel = { - .data = &(struct clk_regmap_mux_data){ -@@ -1613,8 +1785,8 @@ static struct clk_regmap gxbb_vid_pll_sel = { - * bit 18 selects from 2 possible parents: - * vid_pll_div or hdmi_pll - */ -- .parent_names = gxbb_vid_pll_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vid_pll_parent_names), -+ .parent_data = gxbb_vid_pll_parent_data, -+ .num_parents = ARRAY_SIZE(gxbb_vid_pll_parent_data), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -1627,15 +1799,22 @@ static struct clk_regmap gxbb_vid_pll = { - .hw.init = &(struct clk_init_data) { - .name = "vid_pll", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vid_pll_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vid_pll_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, - }; - --static const char * const gxbb_vclk_parent_names[] = { -- "vid_pll", "fclk_div4", "fclk_div3", "fclk_div5", "vid_pll", -- "fclk_div7", "mpll1", -+static const struct clk_hw *gxbb_vclk_parent_hws[] = { -+ &gxbb_vid_pll.hw, -+ &gxbb_fclk_div4.hw, -+ &gxbb_fclk_div3.hw, -+ &gxbb_fclk_div5.hw, -+ &gxbb_vid_pll.hw, -+ &gxbb_fclk_div7.hw, -+ &gxbb_mpll1.hw, - }; - - static struct clk_regmap gxbb_vclk_sel = { -@@ -1652,8 +1831,8 @@ static struct clk_regmap gxbb_vclk_sel = { - * vid_pll, fclk_div4, fclk_div3, fclk_div5, - * vid_pll, fclk_div7, mp1 - */ -- .parent_names = gxbb_vclk_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vclk_parent_names), -+ .parent_hws = gxbb_vclk_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vclk_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -1672,8 +1851,8 @@ static struct clk_regmap gxbb_vclk2_sel = { - * vid_pll, fclk_div4, fclk_div3, fclk_div5, - * vid_pll, fclk_div7, mp1 - */ -- .parent_names = gxbb_vclk_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vclk_parent_names), -+ .parent_hws = gxbb_vclk_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vclk_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -1686,7 +1865,7 @@ static struct clk_regmap gxbb_vclk_input = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_input", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1700,7 +1879,7 @@ static struct clk_regmap gxbb_vclk2_input = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_input", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2_sel.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1715,7 +1894,9 @@ static struct clk_regmap gxbb_vclk_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vclk_input" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk_input.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE, - }, -@@ -1730,7 +1911,9 @@ static struct clk_regmap gxbb_vclk2_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vclk2_input" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk2_input.hw -+ }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE, - }, -@@ -1744,7 +1927,7 @@ static struct clk_regmap gxbb_vclk = { - .hw.init = &(struct clk_init_data) { - .name = "vclk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1758,7 +1941,7 @@ static struct clk_regmap gxbb_vclk2 = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1772,7 +1955,7 @@ static struct clk_regmap gxbb_vclk_div1 = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1786,7 +1969,7 @@ static struct clk_regmap gxbb_vclk_div2_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div2_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1800,7 +1983,7 @@ static struct clk_regmap gxbb_vclk_div4_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div4_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1814,7 +1997,7 @@ static struct clk_regmap gxbb_vclk_div6_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div6_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1828,7 +2011,7 @@ static struct clk_regmap gxbb_vclk_div12_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk_div12_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1842,7 +2025,7 @@ static struct clk_regmap gxbb_vclk2_div1 = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1856,7 +2039,7 @@ static struct clk_regmap gxbb_vclk2_div2_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div2_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1870,7 +2053,7 @@ static struct clk_regmap gxbb_vclk2_div4_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div4_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1884,7 +2067,7 @@ static struct clk_regmap gxbb_vclk2_div6_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div6_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1898,7 +2081,7 @@ static struct clk_regmap gxbb_vclk2_div12_en = { - .hw.init = &(struct clk_init_data) { - .name = "vclk2_div12_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vclk2" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_vclk2.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -1910,7 +2093,9 @@ static struct clk_fixed_factor gxbb_vclk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div2_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk_div2_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1921,7 +2106,9 @@ static struct clk_fixed_factor gxbb_vclk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div4_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk_div4_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1932,7 +2119,9 @@ static struct clk_fixed_factor gxbb_vclk_div6 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div6_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk_div6_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1943,7 +2132,9 @@ static struct clk_fixed_factor gxbb_vclk_div12 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div12", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_div12_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk_div12_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1954,7 +2145,9 @@ static struct clk_fixed_factor gxbb_vclk2_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div2_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk2_div2_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1965,7 +2158,9 @@ static struct clk_fixed_factor gxbb_vclk2_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div4_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk2_div4_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1976,7 +2171,9 @@ static struct clk_fixed_factor gxbb_vclk2_div6 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div6_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk2_div6_en.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1987,16 +2184,25 @@ static struct clk_fixed_factor gxbb_vclk2_div12 = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div12", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_div12_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vclk2_div12_en.hw -+ }, - .num_parents = 1, - }, - }; - - static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 }; --static const char * const gxbb_cts_parent_names[] = { -- "vclk_div1", "vclk_div2", "vclk_div4", "vclk_div6", -- "vclk_div12", "vclk2_div1", "vclk2_div2", "vclk2_div4", -- "vclk2_div6", "vclk2_div12" -+static const struct clk_hw *gxbb_cts_parent_hws[] = { -+ &gxbb_vclk_div1.hw, -+ &gxbb_vclk_div2.hw, -+ &gxbb_vclk_div4.hw, -+ &gxbb_vclk_div6.hw, -+ &gxbb_vclk_div12.hw, -+ &gxbb_vclk2_div1.hw, -+ &gxbb_vclk2_div2.hw, -+ &gxbb_vclk2_div4.hw, -+ &gxbb_vclk2_div6.hw, -+ &gxbb_vclk2_div12.hw, - }; - - static struct clk_regmap gxbb_cts_enci_sel = { -@@ -2009,8 +2215,8 @@ static struct clk_regmap gxbb_cts_enci_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_enci_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_cts_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_cts_parent_names), -+ .parent_hws = gxbb_cts_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_cts_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2025,8 +2231,8 @@ static struct clk_regmap gxbb_cts_encp_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_encp_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_cts_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_cts_parent_names), -+ .parent_hws = gxbb_cts_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_cts_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2041,18 +2247,25 @@ static struct clk_regmap gxbb_cts_vdac_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_vdac_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_cts_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_cts_parent_names), -+ .parent_hws = gxbb_cts_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_cts_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; - - /* TOFIX: add support for cts_tcon */ - static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 }; --static const char * const gxbb_cts_hdmi_tx_parent_names[] = { -- "vclk_div1", "vclk_div2", "vclk_div4", "vclk_div6", -- "vclk_div12", "vclk2_div1", "vclk2_div2", "vclk2_div4", -- "vclk2_div6", "vclk2_div12" -+static const struct clk_hw *gxbb_cts_hdmi_tx_parent_hws[] = { -+ &gxbb_vclk_div1.hw, -+ &gxbb_vclk_div2.hw, -+ &gxbb_vclk_div4.hw, -+ &gxbb_vclk_div6.hw, -+ &gxbb_vclk_div12.hw, -+ &gxbb_vclk2_div1.hw, -+ &gxbb_vclk2_div2.hw, -+ &gxbb_vclk2_div4.hw, -+ &gxbb_vclk2_div6.hw, -+ &gxbb_vclk2_div12.hw, - }; - - static struct clk_regmap gxbb_hdmi_tx_sel = { -@@ -2071,8 +2284,8 @@ static struct clk_regmap gxbb_hdmi_tx_sel = { - * vclk2_div1, vclk2_div2, vclk2_div4, vclk2_div6, vclk2_div12, - * cts_tcon - */ -- .parent_names = gxbb_cts_hdmi_tx_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_cts_hdmi_tx_parent_names), -+ .parent_hws = gxbb_cts_hdmi_tx_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_cts_hdmi_tx_parent_hws), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2085,7 +2298,9 @@ static struct clk_regmap gxbb_cts_enci = { - .hw.init = &(struct clk_init_data) { - .name = "cts_enci", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_enci_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_enci_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2099,7 +2314,9 @@ static struct clk_regmap gxbb_cts_encp = { - .hw.init = &(struct clk_init_data) { - .name = "cts_encp", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_encp_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_encp_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2113,7 +2330,9 @@ static struct clk_regmap gxbb_cts_vdac = { - .hw.init = &(struct clk_init_data) { - .name = "cts_vdac", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_vdac_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_cts_vdac_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2127,7 +2346,9 @@ static struct clk_regmap gxbb_hdmi_tx = { - .hw.init = &(struct clk_init_data) { - .name = "hdmi_tx", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "hdmi_tx_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_hdmi_tx_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2135,8 +2356,11 @@ static struct clk_regmap gxbb_hdmi_tx = { - - /* HDMI Clocks */ - --static const char * const gxbb_hdmi_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div4", "fclk_div3", "fclk_div5" -+static const struct clk_parent_data gxbb_hdmi_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &gxbb_fclk_div4.hw }, -+ { .hw = &gxbb_fclk_div3.hw }, -+ { .hw = &gxbb_fclk_div5.hw }, - }; - - static struct clk_regmap gxbb_hdmi_sel = { -@@ -2149,8 +2373,8 @@ static struct clk_regmap gxbb_hdmi_sel = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_hdmi_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_hdmi_parent_names), -+ .parent_data = gxbb_hdmi_parent_data, -+ .num_parents = ARRAY_SIZE(gxbb_hdmi_parent_data), - .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, - }, - }; -@@ -2164,7 +2388,7 @@ static struct clk_regmap gxbb_hdmi_div = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "hdmi_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_hdmi_sel.hw }, - .num_parents = 1, - .flags = CLK_GET_RATE_NOCACHE, - }, -@@ -2178,7 +2402,7 @@ static struct clk_regmap gxbb_hdmi = { - .hw.init = &(struct clk_init_data) { - .name = "hdmi", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "hdmi_div" }, -+ .parent_hws = (const struct clk_hw *[]) { &gxbb_hdmi_div.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, -@@ -2186,8 +2410,11 @@ static struct clk_regmap gxbb_hdmi = { - - /* VDEC clocks */ - --static const char * const gxbb_vdec_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7" -+static const struct clk_hw *gxbb_vdec_parent_hws[] = { -+ &gxbb_fclk_div4.hw, -+ &gxbb_fclk_div3.hw, -+ &gxbb_fclk_div5.hw, -+ &gxbb_fclk_div7.hw, - }; - - static struct clk_regmap gxbb_vdec_1_sel = { -@@ -2200,8 +2427,8 @@ static struct clk_regmap gxbb_vdec_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_vdec_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vdec_parent_names), -+ .parent_hws = gxbb_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2216,7 +2443,9 @@ static struct clk_regmap gxbb_vdec_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vdec_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2230,7 +2459,9 @@ static struct clk_regmap gxbb_vdec_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vdec_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2246,8 +2477,8 @@ static struct clk_regmap gxbb_vdec_hevc_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevc_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = gxbb_vdec_parent_names, -- .num_parents = ARRAY_SIZE(gxbb_vdec_parent_names), -+ .parent_hws = gxbb_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(gxbb_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2262,7 +2493,9 @@ static struct clk_regmap gxbb_vdec_hevc_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevc_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_hevc_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vdec_hevc_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2276,7 +2509,9 @@ static struct clk_regmap gxbb_vdec_hevc = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_hevc", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_hevc_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_vdec_hevc_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2284,9 +2519,18 @@ static struct clk_regmap gxbb_vdec_hevc = { - - static u32 mux_table_gen_clk[] = { 0, 4, 5, 6, 7, 8, - 9, 10, 11, 13, 14, }; --static const char * const gen_clk_parent_names[] = { -- IN_PREFIX "xtal", "vdec_1", "vdec_hevc", "mpll0", "mpll1", "mpll2", -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7", "gp0_pll", -+static const struct clk_parent_data gen_clk_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &gxbb_vdec_1.hw }, -+ { .hw = &gxbb_vdec_hevc.hw }, -+ { .hw = &gxbb_mpll0.hw }, -+ { .hw = &gxbb_mpll1.hw }, -+ { .hw = &gxbb_mpll2.hw }, -+ { .hw = &gxbb_fclk_div4.hw }, -+ { .hw = &gxbb_fclk_div3.hw }, -+ { .hw = &gxbb_fclk_div5.hw }, -+ { .hw = &gxbb_fclk_div7.hw }, -+ { .hw = &gxbb_gp0_pll.hw }, - }; - - static struct clk_regmap gxbb_gen_clk_sel = { -@@ -2305,8 +2549,8 @@ static struct clk_regmap gxbb_gen_clk_sel = { - * vid_pll, vid2_pll (hevc), mpll0, mpll1, mpll2, fdiv4, - * fdiv3, fdiv5, [cts_msr_clk], fdiv7, gp0_pll - */ -- .parent_names = gen_clk_parent_names, -- .num_parents = ARRAY_SIZE(gen_clk_parent_names), -+ .parent_data = gen_clk_parent_data, -+ .num_parents = ARRAY_SIZE(gen_clk_parent_data), - }, - }; - -@@ -2319,7 +2563,9 @@ static struct clk_regmap gxbb_gen_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "gen_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "gen_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_gen_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2333,7 +2579,9 @@ static struct clk_regmap gxbb_gen_clk = { - .hw.init = &(struct clk_init_data){ - .name = "gen_clk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "gen_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &gxbb_gen_clk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-dt-bindings-clk-meson-add-the-gxl-internal-d.patch b/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-dt-bindings-clk-meson-add-the-gxl-internal-d.patch new file mode 100644 index 0000000000..3d5f5db0c3 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-dt-bindings-clk-meson-add-the-gxl-internal-d.patch @@ -0,0 +1,29 @@ +From 8502dc53c6d999458b198a953d52339411524c9c Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 22 Jan 2020 11:04:49 +0100 +Subject: [PATCH 009/146] FROMGIT: dt-bindings: clk: meson: add the gxl + internal dac gate + +Add the gxl ACODEC clock id to the gxbb clock controller bindings + +Signed-off-by: Jerome Brunet +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +--- + include/dt-bindings/clock/gxbb-clkc.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/dt-bindings/clock/gxbb-clkc.h b/include/dt-bindings/clock/gxbb-clkc.h +index db0763e96173..4073eb7a9da1 100644 +--- a/include/dt-bindings/clock/gxbb-clkc.h ++++ b/include/dt-bindings/clock/gxbb-clkc.h +@@ -146,5 +146,6 @@ + #define CLKID_CTS_VDAC 201 + #define CLKID_HDMI_TX 202 + #define CLKID_HDMI 205 ++#define CLKID_ACODEC 206 + + #endif /* __GXBB_CLKC_H */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-axg-migrate-to-the-new-parent-desc.patch b/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-axg-migrate-to-the-new-parent-desc.patch deleted file mode 100644 index ae94620d7e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-axg-migrate-to-the-new-parent-desc.patch +++ /dev/null @@ -1,579 +0,0 @@ -From 96ac190be753b21610c9c77676fee7c0dd4ecc2a Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:34 +0200 -Subject: [PATCH 010/187] FROMGIT: clk: meson: axg: migrate to the new parent - description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (ie. when -all clocks are local to the controller) and use .parent_data otherwise. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit cc132d113dc589d8449fe2b53043b0f17029acac - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/axg.c | 204 ++++++++++++++++++++++++++++------------ - 1 file changed, 144 insertions(+), 60 deletions(-) - -diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c -index 3ddd0efc9ee0..7a3d795cc614 100644 ---- a/drivers/clk/meson/axg.c -+++ b/drivers/clk/meson/axg.c -@@ -14,7 +14,6 @@ - #include - #include - --#include "clk-input.h" - #include "clk-regmap.h" - #include "clk-pll.h" - #include "clk-mpll.h" -@@ -59,7 +58,9 @@ static struct clk_regmap axg_fixed_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -74,7 +75,9 @@ static struct clk_regmap axg_fixed_pll = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fixed_pll_dco.hw -+ }, - .num_parents = 1, - /* - * This clock won't ever change at runtime so -@@ -114,7 +117,9 @@ static struct clk_regmap axg_sys_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -129,7 +134,9 @@ static struct clk_regmap axg_sys_pll = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "sys_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_sys_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -215,7 +222,9 @@ static struct clk_regmap axg_gp0_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -230,7 +239,9 @@ static struct clk_regmap axg_gp0_pll = { - .hw.init = &(struct clk_init_data){ - .name = "gp0_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "gp0_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_gp0_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -284,7 +295,9 @@ static struct clk_regmap axg_hifi_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "hifi_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -299,7 +312,9 @@ static struct clk_regmap axg_hifi_pll = { - .hw.init = &(struct clk_init_data){ - .name = "hifi_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "hifi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_hifi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -311,7 +326,7 @@ static struct clk_fixed_factor axg_fclk_div2_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -324,7 +339,9 @@ static struct clk_regmap axg_fclk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fclk_div2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_IS_CRITICAL, - }, -@@ -336,7 +353,7 @@ static struct clk_fixed_factor axg_fclk_div3_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div3_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -349,7 +366,9 @@ static struct clk_regmap axg_fclk_div3 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div3", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div3_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fclk_div3_div.hw -+ }, - .num_parents = 1, - /* - * FIXME: -@@ -372,7 +391,7 @@ static struct clk_fixed_factor axg_fclk_div4_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -385,7 +404,9 @@ static struct clk_regmap axg_fclk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div4_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fclk_div4_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -396,7 +417,7 @@ static struct clk_fixed_factor axg_fclk_div5_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_fixed_pll.hw }, - .num_parents = 1, - }, - }; -@@ -409,7 +430,9 @@ static struct clk_regmap axg_fclk_div5 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div5_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fclk_div5_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -420,7 +443,9 @@ static struct clk_fixed_factor axg_fclk_div7_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -433,7 +458,9 @@ static struct clk_regmap axg_fclk_div7 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div7_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fclk_div7_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -447,7 +474,9 @@ static struct clk_regmap axg_mpll_prediv = { - .hw.init = &(struct clk_init_data){ - .name = "mpll_prediv", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -480,7 +509,9 @@ static struct clk_regmap axg_mpll0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -493,7 +524,9 @@ static struct clk_regmap axg_mpll0 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -527,7 +560,9 @@ static struct clk_regmap axg_mpll1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -540,7 +575,9 @@ static struct clk_regmap axg_mpll1 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -579,7 +616,9 @@ static struct clk_regmap axg_mpll2_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -592,7 +631,9 @@ static struct clk_regmap axg_mpll2 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -626,7 +667,9 @@ static struct clk_regmap axg_mpll3_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll3_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -639,7 +682,9 @@ static struct clk_regmap axg_mpll3 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll3", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll3_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpll3_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -702,7 +747,9 @@ static struct clk_regmap axg_pcie_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ IN_PREFIX "xtal" }, -+ .parent_data = &(const struct clk_parent_data) { -+ .fw_name = "xtal", -+ }, - .num_parents = 1, - }, - }; -@@ -717,7 +764,9 @@ static struct clk_regmap axg_pcie_pll_od = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll_od", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "pcie_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_pcie_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -733,7 +782,9 @@ static struct clk_regmap axg_pcie_pll = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "pcie_pll_od" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_pcie_pll_od.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -750,7 +801,7 @@ static struct clk_regmap axg_pcie_mux = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_mux", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "pcie_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_pcie_pll.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -767,7 +818,7 @@ static struct clk_regmap axg_pcie_ref = { - .hw.init = &(struct clk_init_data){ - .name = "pcie_ref", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "pcie_mux" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_pcie_mux.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -781,7 +832,7 @@ static struct clk_regmap axg_pcie_cml_en0 = { - .hw.init = &(struct clk_init_data) { - .name = "pcie_cml_en0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "pcie_ref" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_pcie_ref.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - -@@ -796,16 +847,21 @@ static struct clk_regmap axg_pcie_cml_en1 = { - .hw.init = &(struct clk_init_data) { - .name = "pcie_cml_en1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "pcie_ref" }, -+ .parent_hws = (const struct clk_hw *[]) { &axg_pcie_ref.hw }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - - static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 }; --static const char * const clk81_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div7", "mpll1", "mpll2", "fclk_div4", -- "fclk_div3", "fclk_div5" -+static const struct clk_parent_data clk81_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &axg_fclk_div7.hw }, -+ { .hw = &axg_mpll1.hw }, -+ { .hw = &axg_mpll2.hw }, -+ { .hw = &axg_fclk_div4.hw }, -+ { .hw = &axg_fclk_div3.hw }, -+ { .hw = &axg_fclk_div5.hw }, - }; - - static struct clk_regmap axg_mpeg_clk_sel = { -@@ -818,8 +874,8 @@ static struct clk_regmap axg_mpeg_clk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "mpeg_clk_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = clk81_parent_names, -- .num_parents = ARRAY_SIZE(clk81_parent_names), -+ .parent_data = clk81_parent_data, -+ .num_parents = ARRAY_SIZE(clk81_parent_data), - }, - }; - -@@ -832,7 +888,9 @@ static struct clk_regmap axg_mpeg_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpeg_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mpeg_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpeg_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -846,15 +904,20 @@ static struct clk_regmap axg_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "clk81", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpeg_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_mpeg_clk_div.hw -+ }, - .num_parents = 1, - .flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL), - }, - }; - --static const char * const axg_sd_emmc_clk0_parent_names[] = { -- IN_PREFIX "xtal", "fclk_div2", "fclk_div3", "fclk_div5", "fclk_div7", -- -+static const struct clk_parent_data axg_sd_emmc_clk0_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &axg_fclk_div2.hw }, -+ { .hw = &axg_fclk_div3.hw }, -+ { .hw = &axg_fclk_div5.hw }, -+ { .hw = &axg_fclk_div7.hw }, - /* - * Following these parent clocks, we should also have had mpll2, mpll3 - * and gp0_pll but these clocks are too precious to be used here. All -@@ -873,8 +936,8 @@ static struct clk_regmap axg_sd_emmc_b_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_b_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = axg_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_names), -+ .parent_data = axg_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -889,7 +952,9 @@ static struct clk_regmap axg_sd_emmc_b_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_b_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_b_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_sd_emmc_b_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -903,7 +968,9 @@ static struct clk_regmap axg_sd_emmc_b_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_b_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_b_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_sd_emmc_b_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -919,8 +986,8 @@ static struct clk_regmap axg_sd_emmc_c_clk0_sel = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_c_clk0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = axg_sd_emmc_clk0_parent_names, -- .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_names), -+ .parent_data = axg_sd_emmc_clk0_parent_data, -+ .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_data), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -935,7 +1002,9 @@ static struct clk_regmap axg_sd_emmc_c_clk0_div = { - .hw.init = &(struct clk_init_data) { - .name = "sd_emmc_c_clk0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sd_emmc_c_clk0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_sd_emmc_c_clk0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -949,7 +1018,9 @@ static struct clk_regmap axg_sd_emmc_c_clk0 = { - .hw.init = &(struct clk_init_data){ - .name = "sd_emmc_c_clk0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "sd_emmc_c_clk0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_sd_emmc_c_clk0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -957,9 +1028,18 @@ static struct clk_regmap axg_sd_emmc_c_clk0 = { - - static u32 mux_table_gen_clk[] = { 0, 4, 5, 6, 7, 8, - 9, 10, 11, 13, 14, }; --static const char * const gen_clk_parent_names[] = { -- IN_PREFIX "xtal", "hifi_pll", "mpll0", "mpll1", "mpll2", "mpll3", -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7", "gp0_pll", -+static const struct clk_parent_data gen_clk_parent_data[] = { -+ { .fw_name = "xtal", }, -+ { .hw = &axg_hifi_pll.hw }, -+ { .hw = &axg_mpll0.hw }, -+ { .hw = &axg_mpll1.hw }, -+ { .hw = &axg_mpll2.hw }, -+ { .hw = &axg_mpll3.hw }, -+ { .hw = &axg_fclk_div4.hw }, -+ { .hw = &axg_fclk_div3.hw }, -+ { .hw = &axg_fclk_div5.hw }, -+ { .hw = &axg_fclk_div7.hw }, -+ { .hw = &axg_gp0_pll.hw }, - }; - - static struct clk_regmap axg_gen_clk_sel = { -@@ -978,8 +1058,8 @@ static struct clk_regmap axg_gen_clk_sel = { - * hifi_pll, mpll0, mpll1, mpll2, mpll3, fdiv4, - * fdiv3, fdiv5, [cts_msr_clk], fdiv7, gp0_pll - */ -- .parent_names = gen_clk_parent_names, -- .num_parents = ARRAY_SIZE(gen_clk_parent_names), -+ .parent_data = gen_clk_parent_data, -+ .num_parents = ARRAY_SIZE(gen_clk_parent_data), - }, - }; - -@@ -992,7 +1072,9 @@ static struct clk_regmap axg_gen_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "gen_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "gen_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_gen_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1006,7 +1088,9 @@ static struct clk_regmap axg_gen_clk = { - .hw.init = &(struct clk_init_data){ - .name = "gen_clk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "gen_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &axg_gen_clk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-gxbb-add-the-gxl-internal-dac-gate.patch b/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-gxbb-add-the-gxl-internal-dac-gate.patch new file mode 100644 index 0000000000..969355cf56 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-gxbb-add-the-gxl-internal-dac-gate.patch @@ -0,0 +1,60 @@ +From 17b823e4687b26ffe35a17e26128631afe49d0b2 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 22 Jan 2020 11:04:50 +0100 +Subject: [PATCH 010/146] FROMGIT: clk: meson: gxbb: add the gxl internal dac + gate + +Add the ACODEC clock gate to the gxl clk controller driver + +Signed-off-by: Jerome Brunet +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +--- + drivers/clk/meson/gxbb.c | 3 +++ + drivers/clk/meson/gxbb.h | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c +index 1f9c056e684c..47916c4f1700 100644 +--- a/drivers/clk/meson/gxbb.c ++++ b/drivers/clk/meson/gxbb.c +@@ -2613,6 +2613,7 @@ static MESON_GATE(gxbb_assist_misc, HHI_GCLK_MPEG0, 23); + static MESON_GATE(gxbb_emmc_a, HHI_GCLK_MPEG0, 24); + static MESON_GATE(gxbb_emmc_b, HHI_GCLK_MPEG0, 25); + static MESON_GATE(gxbb_emmc_c, HHI_GCLK_MPEG0, 26); ++static MESON_GATE(gxl_acodec, HHI_GCLK_MPEG0, 28); + static MESON_GATE(gxbb_spi, HHI_GCLK_MPEG0, 30); + + static MESON_GATE(gxbb_i2s_spdif, HHI_GCLK_MPEG1, 2); +@@ -3100,6 +3101,7 @@ static struct clk_hw_onecell_data gxl_hw_onecell_data = { + [CLKID_HDMI_SEL] = &gxbb_hdmi_sel.hw, + [CLKID_HDMI_DIV] = &gxbb_hdmi_div.hw, + [CLKID_HDMI] = &gxbb_hdmi.hw, ++ [CLKID_ACODEC] = &gxl_acodec.hw, + [NR_CLKS] = NULL, + }, + .num = NR_CLKS, +@@ -3491,6 +3493,7 @@ static struct clk_regmap *const gxl_clk_regmaps[] = { + &gxl_hdmi_pll_od, + &gxl_hdmi_pll_od2, + &gxl_hdmi_pll_dco, ++ &gxl_acodec, + }; + + static const struct meson_eeclkc_data gxbb_clkc_data = { +diff --git a/drivers/clk/meson/gxbb.h b/drivers/clk/meson/gxbb.h +index b53584fe66cf..1ee8cb7e2f5a 100644 +--- a/drivers/clk/meson/gxbb.h ++++ b/drivers/clk/meson/gxbb.h +@@ -188,7 +188,7 @@ + #define CLKID_HDMI_SEL 203 + #define CLKID_HDMI_DIV 204 + +-#define NR_CLKS 206 ++#define NR_CLKS 207 + + /* include the CLKIDs that have been made part of the DT binding */ + #include +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-gxbb-set-audio-output-clock-hierar.patch b/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-gxbb-set-audio-output-clock-hierar.patch new file mode 100644 index 0000000000..04c2b83f25 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-gxbb-set-audio-output-clock-hierar.patch @@ -0,0 +1,56 @@ +From d6a0ab839aaa36c6952e61e64500191126c74f40 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 22 Jan 2020 11:04:51 +0100 +Subject: [PATCH 011/146] FROMGIT: clk: meson: gxbb: set audio output clock + hierarchy + +The aiu devices peripheral clocks needs the aiu and aiu_glue clocks to +operate. Reflect this hierarchy in the gxbb clock tree. + +Fixes: 738f66d3211d ("clk: gxbb: add AmLogic GXBB clk controller driver") +Signed-off-by: Jerome Brunet +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +--- + drivers/clk/meson/gxbb.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c +index 47916c4f1700..5fd6a574f8c3 100644 +--- a/drivers/clk/meson/gxbb.c ++++ b/drivers/clk/meson/gxbb.c +@@ -2619,14 +2619,6 @@ static MESON_GATE(gxbb_spi, HHI_GCLK_MPEG0, 30); + static MESON_GATE(gxbb_i2s_spdif, HHI_GCLK_MPEG1, 2); + static MESON_GATE(gxbb_eth, HHI_GCLK_MPEG1, 3); + static MESON_GATE(gxbb_demux, HHI_GCLK_MPEG1, 4); +-static MESON_GATE(gxbb_aiu_glue, HHI_GCLK_MPEG1, 6); +-static MESON_GATE(gxbb_iec958, HHI_GCLK_MPEG1, 7); +-static MESON_GATE(gxbb_i2s_out, HHI_GCLK_MPEG1, 8); +-static MESON_GATE(gxbb_amclk, HHI_GCLK_MPEG1, 9); +-static MESON_GATE(gxbb_aififo2, HHI_GCLK_MPEG1, 10); +-static MESON_GATE(gxbb_mixer, HHI_GCLK_MPEG1, 11); +-static MESON_GATE(gxbb_mixer_iface, HHI_GCLK_MPEG1, 12); +-static MESON_GATE(gxbb_adc, HHI_GCLK_MPEG1, 13); + static MESON_GATE(gxbb_blkmv, HHI_GCLK_MPEG1, 14); + static MESON_GATE(gxbb_aiu, HHI_GCLK_MPEG1, 15); + static MESON_GATE(gxbb_uart1, HHI_GCLK_MPEG1, 16); +@@ -2681,6 +2673,16 @@ static MESON_GATE(gxbb_ao_ahb_bus, HHI_GCLK_AO, 2); + static MESON_GATE(gxbb_ao_iface, HHI_GCLK_AO, 3); + static MESON_GATE(gxbb_ao_i2c, HHI_GCLK_AO, 4); + ++/* AIU gates */ ++static MESON_PCLK(gxbb_aiu_glue, HHI_GCLK_MPEG1, 6, &gxbb_aiu.hw); ++static MESON_PCLK(gxbb_iec958, HHI_GCLK_MPEG1, 7, &gxbb_aiu_glue.hw); ++static MESON_PCLK(gxbb_i2s_out, HHI_GCLK_MPEG1, 8, &gxbb_aiu_glue.hw); ++static MESON_PCLK(gxbb_amclk, HHI_GCLK_MPEG1, 9, &gxbb_aiu_glue.hw); ++static MESON_PCLK(gxbb_aififo2, HHI_GCLK_MPEG1, 10, &gxbb_aiu_glue.hw); ++static MESON_PCLK(gxbb_mixer, HHI_GCLK_MPEG1, 11, &gxbb_aiu_glue.hw); ++static MESON_PCLK(gxbb_mixer_iface, HHI_GCLK_MPEG1, 12, &gxbb_aiu_glue.hw); ++static MESON_PCLK(gxbb_adc, HHI_GCLK_MPEG1, 13, &gxbb_aiu_glue.hw); ++ + /* Array of all clocks provided by this provider */ + + static struct clk_hw_onecell_data gxbb_hw_onecell_data = { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-meson8b-migrate-to-the-new-parent-.patch b/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-meson8b-migrate-to-the-new-parent-.patch deleted file mode 100644 index ee5be72606..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-meson8b-migrate-to-the-new-parent-.patch +++ /dev/null @@ -1,1729 +0,0 @@ -From 66d431de3a868dd2b83e59940ebee233579c5a31 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:35 +0200 -Subject: [PATCH 011/187] FROMGIT: clk: meson: meson8b: migrate to the new - parent description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (ie. when -all clocks are local to the controller) and use .parent_data otherwise. - -Signed-off-by: Alexandre Mergnat -Reviewed-by: Martin Blumenstingl -Tested-by: Martin Blumenstingl -Signed-off-by: Jerome Brunet -(cherry picked from commit 4b5b85c0e6505c50d4a986f75effe5b88d923737 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/meson8b.c | 707 +++++++++++++++++++++++++----------- - 1 file changed, 496 insertions(+), 211 deletions(-) - -diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c -index 537219fa573e..b30279a5bfcc 100644 ---- a/drivers/clk/meson/meson8b.c -+++ b/drivers/clk/meson/meson8b.c -@@ -97,7 +97,9 @@ static struct clk_regmap meson8b_fixed_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ "xtal" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw -+ }, - .num_parents = 1, - }, - }; -@@ -112,7 +114,9 @@ static struct clk_regmap meson8b_fixed_pll = { - .hw.init = &(struct clk_init_data){ - .name = "fixed_pll", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll_dco.hw -+ }, - .num_parents = 1, - /* - * This clock won't ever change at runtime so -@@ -158,7 +162,9 @@ static struct clk_regmap meson8b_hdmi_pll_dco = { - /* sometimes also called "HPLL" or "HPLL PLL" */ - .name = "hdmi_pll_dco", - .ops = &meson_clk_pll_ro_ops, -- .parent_names = (const char *[]){ "xtal" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw -+ }, - .num_parents = 1, - }, - }; -@@ -173,7 +179,9 @@ static struct clk_regmap meson8b_hdmi_pll_lvds_out = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_lvds_out", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_hdmi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -189,7 +197,9 @@ static struct clk_regmap meson8b_hdmi_pll_hdmi_out = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_pll_hdmi_out", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_hdmi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -227,7 +237,9 @@ static struct clk_regmap meson8b_sys_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ "xtal" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw -+ }, - .num_parents = 1, - }, - }; -@@ -242,7 +254,9 @@ static struct clk_regmap meson8b_sys_pll = { - .hw.init = &(struct clk_init_data){ - .name = "sys_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "sys_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_sys_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -254,7 +268,9 @@ static struct clk_fixed_factor meson8b_fclk_div2_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -267,7 +283,9 @@ static struct clk_regmap meson8b_fclk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div2_div.hw -+ }, - .num_parents = 1, - /* - * FIXME: Ethernet with a RGMII PHYs is not working if -@@ -285,7 +303,9 @@ static struct clk_fixed_factor meson8b_fclk_div3_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div3_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -298,7 +318,9 @@ static struct clk_regmap meson8b_fclk_div3 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div3", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div3_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div3_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -309,7 +331,9 @@ static struct clk_fixed_factor meson8b_fclk_div4_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -322,7 +346,9 @@ static struct clk_regmap meson8b_fclk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div4", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div4_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div4_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -333,7 +359,9 @@ static struct clk_fixed_factor meson8b_fclk_div5_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -346,7 +374,9 @@ static struct clk_regmap meson8b_fclk_div5 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div5", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div5_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div5_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -357,7 +387,9 @@ static struct clk_fixed_factor meson8b_fclk_div7_div = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7_div", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -370,7 +402,9 @@ static struct clk_regmap meson8b_fclk_div7 = { - .hw.init = &(struct clk_init_data){ - .name = "fclk_div7", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "fclk_div7_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div7_div.hw -+ }, - .num_parents = 1, - }, - }; -@@ -384,7 +418,9 @@ static struct clk_regmap meson8b_mpll_prediv = { - .hw.init = &(struct clk_init_data){ - .name = "mpll_prediv", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "fixed_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fixed_pll.hw -+ }, - .num_parents = 1, - }, - }; -@@ -416,7 +452,9 @@ static struct clk_regmap meson8b_mpll0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -429,7 +467,9 @@ static struct clk_regmap meson8b_mpll0 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpll0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -457,7 +497,9 @@ static struct clk_regmap meson8b_mpll1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -470,7 +512,9 @@ static struct clk_regmap meson8b_mpll1 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpll1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -498,7 +542,9 @@ static struct clk_regmap meson8b_mpll2_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2_div", - .ops = &meson_clk_mpll_ops, -- .parent_names = (const char *[]){ "mpll_prediv" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpll_prediv.hw -+ }, - .num_parents = 1, - }, - }; -@@ -511,7 +557,9 @@ static struct clk_regmap meson8b_mpll2 = { - .hw.init = &(struct clk_init_data){ - .name = "mpll2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpll2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpll2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -533,8 +581,11 @@ static struct clk_regmap meson8b_mpeg_clk_sel = { - * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2, - * fclk_div4, fclk_div3, fclk_div5 - */ -- .parent_names = (const char *[]){ "fclk_div3", "fclk_div4", -- "fclk_div5" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div5.hw, -+ }, - .num_parents = 3, - }, - }; -@@ -548,7 +599,9 @@ static struct clk_regmap meson8b_mpeg_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "mpeg_clk_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "mpeg_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpeg_clk_sel.hw -+ }, - .num_parents = 1, - }, - }; -@@ -561,7 +614,9 @@ static struct clk_regmap meson8b_clk81 = { - .hw.init = &(struct clk_init_data){ - .name = "clk81", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mpeg_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mpeg_clk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_IS_CRITICAL, - }, -@@ -576,7 +631,10 @@ static struct clk_regmap meson8b_cpu_in_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_in_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "xtal", "sys_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw, -+ &meson8b_sys_pll.hw, -+ }, - .num_parents = 2, - .flags = (CLK_SET_RATE_PARENT | - CLK_SET_RATE_NO_REPARENT), -@@ -589,7 +647,9 @@ static struct clk_fixed_factor meson8b_cpu_in_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_in_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_in_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_in_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -601,7 +661,9 @@ static struct clk_fixed_factor meson8b_cpu_in_div3 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_in_div3", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_in_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_in_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -630,7 +692,9 @@ static struct clk_regmap meson8b_cpu_scale_div = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_scale_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "cpu_in_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_in_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -649,13 +713,15 @@ static struct clk_regmap meson8b_cpu_scale_out_sel = { - .ops = &clk_regmap_mux_ops, - /* - * NOTE: We are skipping the parent with value 0x2 (which is -- * "cpu_in_div3") because it results in a duty cycle of 33% -- * which makes the system unstable and can result in a lockup -- * of the whole system. -+ * meson8b_cpu_in_div3) because it results in a duty cycle of -+ * 33% which makes the system unstable and can result in a -+ * lockup of the whole system. - */ -- .parent_names = (const char *[]) { "cpu_in_sel", -- "cpu_in_div2", -- "cpu_scale_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_in_sel.hw, -+ &meson8b_cpu_in_div2.hw, -+ &meson8b_cpu_scale_div.hw, -+ }, - .num_parents = 3, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -670,8 +736,10 @@ static struct clk_regmap meson8b_cpu_clk = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "xtal", -- "cpu_scale_out_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw, -+ &meson8b_cpu_scale_out_sel.hw, -+ }, - .num_parents = 2, - .flags = (CLK_SET_RATE_PARENT | - CLK_SET_RATE_NO_REPARENT | -@@ -690,8 +758,13 @@ static struct clk_regmap meson8b_nand_clk_sel = { - .name = "nand_clk_sel", - .ops = &clk_regmap_mux_ops, - /* FIXME all other parents are unknown: */ -- .parent_names = (const char *[]){ "fclk_div4", "fclk_div3", -- "fclk_div5", "fclk_div7", "xtal" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div5.hw, -+ &meson8b_fclk_div7.hw, -+ &meson8b_xtal.hw, -+ }, - .num_parents = 5, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -707,7 +780,9 @@ static struct clk_regmap meson8b_nand_clk_div = { - .hw.init = &(struct clk_init_data){ - .name = "nand_clk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "nand_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_nand_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -721,7 +796,9 @@ static struct clk_regmap meson8b_nand_clk_gate = { - .hw.init = &(struct clk_init_data){ - .name = "nand_clk_gate", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "nand_clk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_nand_clk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -733,7 +810,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div2 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -744,7 +823,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div3 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div3", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -755,7 +836,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div4 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -766,7 +849,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div5 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div5", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -777,7 +862,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div6 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -788,7 +875,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div7 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div7", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -799,7 +888,9 @@ static struct clk_fixed_factor meson8b_cpu_clk_div8 = { - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_div8", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "cpu_clk" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk.hw -+ }, - .num_parents = 1, - }, - }; -@@ -815,13 +906,15 @@ static struct clk_regmap meson8b_apb_clk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "apb_clk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "cpu_clk_div2", -- "cpu_clk_div3", -- "cpu_clk_div4", -- "cpu_clk_div5", -- "cpu_clk_div6", -- "cpu_clk_div7", -- "cpu_clk_div8", }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk_div2.hw, -+ &meson8b_cpu_clk_div3.hw, -+ &meson8b_cpu_clk_div4.hw, -+ &meson8b_cpu_clk_div5.hw, -+ &meson8b_cpu_clk_div6.hw, -+ &meson8b_cpu_clk_div7.hw, -+ &meson8b_cpu_clk_div8.hw, -+ }, - .num_parents = 7, - }, - }; -@@ -835,7 +928,9 @@ static struct clk_regmap meson8b_apb_clk_gate = { - .hw.init = &(struct clk_init_data){ - .name = "apb_clk_dis", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "apb_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_apb_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -850,13 +945,15 @@ static struct clk_regmap meson8b_periph_clk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "periph_clk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "cpu_clk_div2", -- "cpu_clk_div3", -- "cpu_clk_div4", -- "cpu_clk_div5", -- "cpu_clk_div6", -- "cpu_clk_div7", -- "cpu_clk_div8", }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk_div2.hw, -+ &meson8b_cpu_clk_div3.hw, -+ &meson8b_cpu_clk_div4.hw, -+ &meson8b_cpu_clk_div5.hw, -+ &meson8b_cpu_clk_div6.hw, -+ &meson8b_cpu_clk_div7.hw, -+ &meson8b_cpu_clk_div8.hw, -+ }, - .num_parents = 7, - }, - }; -@@ -870,7 +967,9 @@ static struct clk_regmap meson8b_periph_clk_gate = { - .hw.init = &(struct clk_init_data){ - .name = "periph_clk_dis", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "periph_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_periph_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -887,13 +986,15 @@ static struct clk_regmap meson8b_axi_clk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "axi_clk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "cpu_clk_div2", -- "cpu_clk_div3", -- "cpu_clk_div4", -- "cpu_clk_div5", -- "cpu_clk_div6", -- "cpu_clk_div7", -- "cpu_clk_div8", }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk_div2.hw, -+ &meson8b_cpu_clk_div3.hw, -+ &meson8b_cpu_clk_div4.hw, -+ &meson8b_cpu_clk_div5.hw, -+ &meson8b_cpu_clk_div6.hw, -+ &meson8b_cpu_clk_div7.hw, -+ &meson8b_cpu_clk_div8.hw, -+ }, - .num_parents = 7, - }, - }; -@@ -907,7 +1008,9 @@ static struct clk_regmap meson8b_axi_clk_gate = { - .hw.init = &(struct clk_init_data){ - .name = "axi_clk_dis", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "axi_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_axi_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -922,13 +1025,15 @@ static struct clk_regmap meson8b_l2_dram_clk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "l2_dram_clk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "cpu_clk_div2", -- "cpu_clk_div3", -- "cpu_clk_div4", -- "cpu_clk_div5", -- "cpu_clk_div6", -- "cpu_clk_div7", -- "cpu_clk_div8", }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cpu_clk_div2.hw, -+ &meson8b_cpu_clk_div3.hw, -+ &meson8b_cpu_clk_div4.hw, -+ &meson8b_cpu_clk_div5.hw, -+ &meson8b_cpu_clk_div6.hw, -+ &meson8b_cpu_clk_div7.hw, -+ &meson8b_cpu_clk_div8.hw, -+ }, - .num_parents = 7, - }, - }; -@@ -942,7 +1047,9 @@ static struct clk_regmap meson8b_l2_dram_clk_gate = { - .hw.init = &(struct clk_init_data){ - .name = "l2_dram_clk_dis", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "l2_dram_clk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_l2_dram_clk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -963,7 +1070,9 @@ static struct clk_regmap meson8b_vid_pll_in_sel = { - * Meson8b: hdmi_pll_dco - * Meson8m2: vid2_pll - */ -- .parent_names = (const char *[]){ "hdmi_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_hdmi_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -977,7 +1086,9 @@ static struct clk_regmap meson8b_vid_pll_in_en = { - .hw.init = &(struct clk_init_data){ - .name = "vid_pll_in_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vid_pll_in_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vid_pll_in_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -992,7 +1103,9 @@ static struct clk_regmap meson8b_vid_pll_pre_div = { - .hw.init = &(struct clk_init_data){ - .name = "vid_pll_pre_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "vid_pll_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vid_pll_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1007,7 +1120,9 @@ static struct clk_regmap meson8b_vid_pll_post_div = { - .hw.init = &(struct clk_init_data){ - .name = "vid_pll_post_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "vid_pll_pre_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vid_pll_pre_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1023,8 +1138,10 @@ static struct clk_regmap meson8b_vid_pll = { - .name = "vid_pll", - .ops = &clk_regmap_mux_ro_ops, - /* TODO: parent 0x2 is vid_pll_pre_div_mult7_div2 */ -- .parent_names = (const char *[]){ "vid_pll_pre_div", -- "vid_pll_post_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vid_pll_pre_div.hw, -+ &meson8b_vid_pll_post_div.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1039,15 +1156,22 @@ static struct clk_regmap meson8b_vid_pll_final_div = { - .hw.init = &(struct clk_init_data){ - .name = "vid_pll_final_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "vid_pll" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vid_pll.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const meson8b_vclk_mux_parents[] = { -- "vid_pll_final_div", "fclk_div4", "fclk_div3", "fclk_div5", -- "vid_pll_final_div", "fclk_div7", "mpll1" -+static const struct clk_hw *meson8b_vclk_mux_parent_hws[] = { -+ &meson8b_vid_pll_final_div.hw, -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div5.hw, -+ &meson8b_vid_pll_final_div.hw, -+ &meson8b_fclk_div7.hw, -+ &meson8b_mpll1.hw, - }; - - static struct clk_regmap meson8b_vclk_in_sel = { -@@ -1059,8 +1183,8 @@ static struct clk_regmap meson8b_vclk_in_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_in_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parents), -+ .parent_hws = meson8b_vclk_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1073,7 +1197,9 @@ static struct clk_regmap meson8b_vclk_in_en = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_in_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk_in_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_in_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1087,7 +1213,9 @@ static struct clk_regmap meson8b_vclk_div1_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div1_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1099,7 +1227,9 @@ static struct clk_fixed_factor meson8b_vclk_div2_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1113,7 +1243,9 @@ static struct clk_regmap meson8b_vclk_div2_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div2_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk_div2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_div2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1125,7 +1257,9 @@ static struct clk_fixed_factor meson8b_vclk_div4_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1139,7 +1273,9 @@ static struct clk_regmap meson8b_vclk_div4_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div4_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk_div4" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_div4_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1151,7 +1287,9 @@ static struct clk_fixed_factor meson8b_vclk_div6_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1165,7 +1303,9 @@ static struct clk_regmap meson8b_vclk_div6_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div6_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk_div6" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_div6_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1177,7 +1317,9 @@ static struct clk_fixed_factor meson8b_vclk_div12_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div12", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1191,7 +1333,9 @@ static struct clk_regmap meson8b_vclk_div12_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk_div12_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk_div12" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk_div12_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1206,8 +1350,8 @@ static struct clk_regmap meson8b_vclk2_in_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_in_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parents), -+ .parent_hws = meson8b_vclk_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1220,7 +1364,9 @@ static struct clk_regmap meson8b_vclk2_clk_in_en = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_in_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk2_in_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_in_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1234,7 +1380,9 @@ static struct clk_regmap meson8b_vclk2_div1_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div1_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk2_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_clk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1246,7 +1394,9 @@ static struct clk_fixed_factor meson8b_vclk2_div2_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div2", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_clk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1260,7 +1410,9 @@ static struct clk_regmap meson8b_vclk2_div2_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div2_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk2_div2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_div2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1272,7 +1424,9 @@ static struct clk_fixed_factor meson8b_vclk2_div4_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div4", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_clk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1286,7 +1440,9 @@ static struct clk_regmap meson8b_vclk2_div4_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div4_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk2_div4" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_div4_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1298,7 +1454,9 @@ static struct clk_fixed_factor meson8b_vclk2_div6_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div6", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_clk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1312,7 +1470,9 @@ static struct clk_regmap meson8b_vclk2_div6_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div6_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk2_div6" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_div6_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1324,7 +1484,9 @@ static struct clk_fixed_factor meson8b_vclk2_div12_div = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div12", - .ops = &clk_fixed_factor_ops, -- .parent_names = (const char *[]){ "vclk2_in_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_clk_in_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - } -@@ -1338,15 +1500,20 @@ static struct clk_regmap meson8b_vclk2_div12_div_gate = { - .hw.init = &(struct clk_init_data){ - .name = "vclk2_div12_en", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "vclk2_div12" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vclk2_div12_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const meson8b_vclk_enc_mux_parents[] = { -- "vclk_div1_en", "vclk_div2_en", "vclk_div4_en", "vclk_div6_en", -- "vclk_div12_en", -+static const struct clk_hw *meson8b_vclk_enc_mux_parent_hws[] = { -+ &meson8b_vclk_div1_gate.hw, -+ &meson8b_vclk_div2_div_gate.hw, -+ &meson8b_vclk_div4_div_gate.hw, -+ &meson8b_vclk_div6_div_gate.hw, -+ &meson8b_vclk_div12_div_gate.hw, - }; - - static struct clk_regmap meson8b_cts_enct_sel = { -@@ -1358,8 +1525,8 @@ static struct clk_regmap meson8b_cts_enct_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_enct_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk_enc_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parents), -+ .parent_hws = meson8b_vclk_enc_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1372,7 +1539,9 @@ static struct clk_regmap meson8b_cts_enct = { - .hw.init = &(struct clk_init_data){ - .name = "cts_enct", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cts_enct_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_enct_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1387,8 +1556,8 @@ static struct clk_regmap meson8b_cts_encp_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_encp_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk_enc_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parents), -+ .parent_hws = meson8b_vclk_enc_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1401,7 +1570,9 @@ static struct clk_regmap meson8b_cts_encp = { - .hw.init = &(struct clk_init_data){ - .name = "cts_encp", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cts_encp_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_encp_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1416,8 +1587,8 @@ static struct clk_regmap meson8b_cts_enci_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_enci_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk_enc_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parents), -+ .parent_hws = meson8b_vclk_enc_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1430,7 +1601,9 @@ static struct clk_regmap meson8b_cts_enci = { - .hw.init = &(struct clk_init_data){ - .name = "cts_enci", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cts_enci_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_enci_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1445,8 +1618,8 @@ static struct clk_regmap meson8b_hdmi_tx_pixel_sel = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_tx_pixel_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk_enc_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parents), -+ .parent_hws = meson8b_vclk_enc_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1459,15 +1632,20 @@ static struct clk_regmap meson8b_hdmi_tx_pixel = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_tx_pixel", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "hdmi_tx_pixel_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_hdmi_tx_pixel_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const meson8b_vclk2_enc_mux_parents[] = { -- "vclk2_div1_en", "vclk2_div2_en", "vclk2_div4_en", "vclk2_div6_en", -- "vclk2_div12_en", -+static const struct clk_hw *meson8b_vclk2_enc_mux_parent_hws[] = { -+ &meson8b_vclk2_div1_gate.hw, -+ &meson8b_vclk2_div2_div_gate.hw, -+ &meson8b_vclk2_div4_div_gate.hw, -+ &meson8b_vclk2_div6_div_gate.hw, -+ &meson8b_vclk2_div12_div_gate.hw, - }; - - static struct clk_regmap meson8b_cts_encl_sel = { -@@ -1479,8 +1657,8 @@ static struct clk_regmap meson8b_cts_encl_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_encl_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk2_enc_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parents), -+ .parent_hws = meson8b_vclk2_enc_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1493,7 +1671,9 @@ static struct clk_regmap meson8b_cts_encl = { - .hw.init = &(struct clk_init_data){ - .name = "cts_encl", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cts_encl_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_encl_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1508,8 +1688,8 @@ static struct clk_regmap meson8b_cts_vdac0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_vdac0_sel", - .ops = &clk_regmap_mux_ro_ops, -- .parent_names = meson8b_vclk2_enc_mux_parents, -- .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parents), -+ .parent_hws = meson8b_vclk2_enc_mux_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1522,7 +1702,9 @@ static struct clk_regmap meson8b_cts_vdac0 = { - .hw.init = &(struct clk_init_data){ - .name = "cts_vdac0", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "cts_vdac0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_vdac0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1539,7 +1721,9 @@ static struct clk_regmap meson8b_hdmi_sys_sel = { - .name = "hdmi_sys_sel", - .ops = &clk_regmap_mux_ro_ops, - /* FIXME: all other parents are unknown */ -- .parent_names = (const char *[]){ "xtal" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, - }, -@@ -1554,7 +1738,9 @@ static struct clk_regmap meson8b_hdmi_sys_div = { - .hw.init = &(struct clk_init_data){ - .name = "hdmi_sys_div", - .ops = &clk_regmap_divider_ro_ops, -- .parent_names = (const char *[]){ "hdmi_sys_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_hdmi_sys_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1568,7 +1754,9 @@ static struct clk_regmap meson8b_hdmi_sys = { - .hw.init = &(struct clk_init_data) { - .name = "hdmi_sys", - .ops = &clk_regmap_gate_ro_ops, -- .parent_names = (const char *[]){ "hdmi_sys_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_hdmi_sys_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1579,9 +1767,14 @@ static struct clk_regmap meson8b_hdmi_sys = { - * muxed by a glitch-free switch on Meson8b and Meson8m2. Meson8 only - * has mali_0 and no glitch-free mux. - */ --static const char * const meson8b_mali_0_1_parent_names[] = { -- "xtal", "mpll2", "mpll1", "fclk_div7", "fclk_div4", "fclk_div3", -- "fclk_div5" -+static const struct clk_hw *meson8b_mali_0_1_parent_hws[] = { -+ &meson8b_xtal.hw, -+ &meson8b_mpll2.hw, -+ &meson8b_mpll1.hw, -+ &meson8b_fclk_div7.hw, -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div5.hw, - }; - - static u32 meson8b_mali_0_1_mux_table[] = { 0, 2, 3, 4, 5, 6, 7 }; -@@ -1596,8 +1789,8 @@ static struct clk_regmap meson8b_mali_0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_mali_0_1_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_names), -+ .parent_hws = meson8b_mali_0_1_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_hws), - /* - * Don't propagate rate changes up because the only changeable - * parents are mpll1 and mpll2 but we need those for audio and -@@ -1617,7 +1810,9 @@ static struct clk_regmap meson8b_mali_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mali_0_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mali_0_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1631,7 +1826,9 @@ static struct clk_regmap meson8b_mali_0 = { - .hw.init = &(struct clk_init_data){ - .name = "mali_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mali_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mali_0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1647,8 +1844,8 @@ static struct clk_regmap meson8b_mali_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_mali_0_1_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_names), -+ .parent_hws = meson8b_mali_0_1_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_hws), - /* - * Don't propagate rate changes up because the only changeable - * parents are mpll1 and mpll2 but we need those for audio and -@@ -1668,7 +1865,9 @@ static struct clk_regmap meson8b_mali_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "mali_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mali_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1682,7 +1881,9 @@ static struct clk_regmap meson8b_mali_1 = { - .hw.init = &(struct clk_init_data){ - .name = "mali_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "mali_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mali_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1697,7 +1898,10 @@ static struct clk_regmap meson8b_mali = { - .hw.init = &(struct clk_init_data){ - .name = "mali", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "mali_0", "mali_1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_mali_0.hw, -+ &meson8b_mali_1.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1740,7 +1944,9 @@ static struct clk_regmap meson8m2_gp_pll_dco = { - .hw.init = &(struct clk_init_data){ - .name = "gp_pll_dco", - .ops = &meson_clk_pll_ops, -- .parent_names = (const char *[]){ "xtal" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_xtal.hw -+ }, - .num_parents = 1, - }, - }; -@@ -1755,18 +1961,26 @@ static struct clk_regmap meson8m2_gp_pll = { - .hw.init = &(struct clk_init_data){ - .name = "gp_pll", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "gp_pll_dco" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8m2_gp_pll_dco.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - --static const char * const meson8b_vpu_0_1_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7" -+static const struct clk_hw *meson8b_vpu_0_1_parent_hws[] = { -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div5.hw, -+ &meson8b_fclk_div7.hw, - }; - --static const char * const mmeson8m2_vpu_0_1_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "gp_pll" -+static const struct clk_hw *mmeson8m2_vpu_0_1_parent_hws[] = { -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div5.hw, -+ &meson8m2_gp_pll.hw, - }; - - static struct clk_regmap meson8b_vpu_0_sel = { -@@ -1778,8 +1992,8 @@ static struct clk_regmap meson8b_vpu_0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_vpu_0_1_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_names), -+ .parent_hws = meson8b_vpu_0_1_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1793,8 +2007,8 @@ static struct clk_regmap meson8m2_vpu_0_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_0_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = mmeson8m2_vpu_0_1_parent_names, -- .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_names), -+ .parent_hws = mmeson8m2_vpu_0_1_parent_hws, -+ .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1808,7 +2022,17 @@ static struct clk_regmap meson8b_vpu_0_div = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_0_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vpu_0_sel" }, -+ .parent_data = &(const struct clk_parent_data) { -+ /* -+ * Note: -+ * meson8b and meson8m2 have different vpu_0_sels (with -+ * different struct clk_hw). We fallback to the global -+ * naming string mechanism so vpu_0_div picks up the -+ * appropriate one. -+ */ -+ .name = "vpu_0_sel", -+ .index = -1, -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1822,7 +2046,9 @@ static struct clk_regmap meson8b_vpu_0 = { - .hw.init = &(struct clk_init_data) { - .name = "vpu_0", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vpu_0_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vpu_0_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1837,8 +2063,8 @@ static struct clk_regmap meson8b_vpu_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_vpu_0_1_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_names), -+ .parent_hws = meson8b_vpu_0_1_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1852,8 +2078,8 @@ static struct clk_regmap meson8m2_vpu_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = mmeson8m2_vpu_0_1_parent_names, -- .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_names), -+ .parent_hws = mmeson8m2_vpu_0_1_parent_hws, -+ .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1867,7 +2093,17 @@ static struct clk_regmap meson8b_vpu_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vpu_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vpu_1_sel" }, -+ .parent_data = &(const struct clk_parent_data) { -+ /* -+ * Note: -+ * meson8b and meson8m2 have different vpu_1_sels (with -+ * different struct clk_hw). We fallback to the global -+ * naming string mechanism so vpu_1_div picks up the -+ * appropriate one. -+ */ -+ .name = "vpu_1_sel", -+ .index = -1, -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1881,7 +2117,9 @@ static struct clk_regmap meson8b_vpu_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vpu_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vpu_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vpu_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1896,14 +2134,22 @@ static struct clk_regmap meson8b_vpu = { - .hw.init = &(struct clk_init_data){ - .name = "vpu", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "vpu_0", "vpu_1" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vpu_0.hw, -+ &meson8b_vpu_1.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; - --static const char * const meson8b_vdec_parent_names[] = { -- "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7", "mpll2", "mpll1" -+static const struct clk_hw *meson8b_vdec_parent_hws[] = { -+ &meson8b_fclk_div4.hw, -+ &meson8b_fclk_div3.hw, -+ &meson8b_fclk_div5.hw, -+ &meson8b_fclk_div7.hw, -+ &meson8b_mpll2.hw, -+ &meson8b_mpll1.hw, - }; - - static struct clk_regmap meson8b_vdec_1_sel = { -@@ -1916,8 +2162,8 @@ static struct clk_regmap meson8b_vdec_1_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_vdec_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_vdec_parent_names), -+ .parent_hws = meson8b_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -1932,7 +2178,9 @@ static struct clk_regmap meson8b_vdec_1_1_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_1_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1946,7 +2194,9 @@ static struct clk_regmap meson8b_vdec_1_1 = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_1_1", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_1_1_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_1_1_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1962,7 +2212,9 @@ static struct clk_regmap meson8b_vdec_1_2_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1_2_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_1_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_1_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1976,7 +2228,9 @@ static struct clk_regmap meson8b_vdec_1_2 = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_1_2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_1_2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_1_2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -1992,7 +2246,10 @@ static struct clk_regmap meson8b_vdec_1 = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_1", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "vdec_1_1", "vdec_1_2" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_1_1.hw, -+ &meson8b_vdec_1_2.hw, -+ }, - .num_parents = 2, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2008,8 +2265,8 @@ static struct clk_regmap meson8b_vdec_hcodec_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hcodec_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_vdec_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_vdec_parent_names), -+ .parent_hws = meson8b_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2024,7 +2281,9 @@ static struct clk_regmap meson8b_vdec_hcodec_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hcodec_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_hcodec_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_hcodec_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2038,7 +2297,9 @@ static struct clk_regmap meson8b_vdec_hcodec = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_hcodec", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_hcodec_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_hcodec_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2054,8 +2315,8 @@ static struct clk_regmap meson8b_vdec_2_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_2_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_vdec_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_vdec_parent_names), -+ .parent_hws = meson8b_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2070,7 +2331,9 @@ static struct clk_regmap meson8b_vdec_2_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_2_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_2_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_2_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2084,7 +2347,9 @@ static struct clk_regmap meson8b_vdec_2 = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_2", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_2_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_2_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2100,8 +2365,8 @@ static struct clk_regmap meson8b_vdec_hevc_sel = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevc_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_vdec_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_vdec_parent_names), -+ .parent_hws = meson8b_vdec_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws), - .flags = CLK_SET_RATE_PARENT, - }, - }; -@@ -2116,7 +2381,9 @@ static struct clk_regmap meson8b_vdec_hevc_div = { - .hw.init = &(struct clk_init_data){ - .name = "vdec_hevc_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "vdec_hevc_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_hevc_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2130,7 +2397,9 @@ static struct clk_regmap meson8b_vdec_hevc_en = { - .hw.init = &(struct clk_init_data) { - .name = "vdec_hevc_en", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "vdec_hevc_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_hevc_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2147,15 +2416,19 @@ static struct clk_regmap meson8b_vdec_hevc = { - .name = "vdec_hevc", - .ops = &clk_regmap_mux_ops, - /* TODO: The second parent is currently unknown */ -- .parent_names = (const char *[]){ "vdec_hevc_en" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_vdec_hevc_en.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - - /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */ --static const char * const meson8b_cts_amclk_parent_names[] = { -- "mpll0", "mpll1", "mpll2" -+static const struct clk_hw *meson8b_cts_amclk_parent_hws[] = { -+ &meson8b_mpll0.hw, -+ &meson8b_mpll1.hw, -+ &meson8b_mpll2.hw - }; - - static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 }; -@@ -2171,8 +2444,8 @@ static struct clk_regmap meson8b_cts_amclk_sel = { - .hw.init = &(struct clk_init_data){ - .name = "cts_amclk_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_cts_amclk_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_names), -+ .parent_hws = meson8b_cts_amclk_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_hws), - }, - }; - -@@ -2186,7 +2459,9 @@ static struct clk_regmap meson8b_cts_amclk_div = { - .hw.init = &(struct clk_init_data){ - .name = "cts_amclk_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "cts_amclk_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_amclk_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2200,15 +2475,19 @@ static struct clk_regmap meson8b_cts_amclk = { - .hw.init = &(struct clk_init_data){ - .name = "cts_amclk", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_amclk_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_amclk_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; - - /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */ --static const char * const meson8b_cts_mclk_i958_parent_names[] = { -- "mpll0", "mpll1", "mpll2" -+static const struct clk_hw *meson8b_cts_mclk_i958_parent_hws[] = { -+ &meson8b_mpll0.hw, -+ &meson8b_mpll1.hw, -+ &meson8b_mpll2.hw - }; - - static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 }; -@@ -2224,8 +2503,8 @@ static struct clk_regmap meson8b_cts_mclk_i958_sel = { - .hw.init = &(struct clk_init_data) { - .name = "cts_mclk_i958_sel", - .ops = &clk_regmap_mux_ops, -- .parent_names = meson8b_cts_mclk_i958_parent_names, -- .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_names), -+ .parent_hws = meson8b_cts_mclk_i958_parent_hws, -+ .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_hws), - }, - }; - -@@ -2239,7 +2518,9 @@ static struct clk_regmap meson8b_cts_mclk_i958_div = { - .hw.init = &(struct clk_init_data) { - .name = "cts_mclk_i958_div", - .ops = &clk_regmap_divider_ops, -- .parent_names = (const char *[]){ "cts_mclk_i958_sel" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_mclk_i958_sel.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2253,7 +2534,9 @@ static struct clk_regmap meson8b_cts_mclk_i958 = { - .hw.init = &(struct clk_init_data){ - .name = "cts_mclk_i958", - .ops = &clk_regmap_gate_ops, -- .parent_names = (const char *[]){ "cts_mclk_i958_div" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_mclk_i958_div.hw -+ }, - .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, -@@ -2268,8 +2551,10 @@ static struct clk_regmap meson8b_cts_i958 = { - .hw.init = &(struct clk_init_data){ - .name = "cts_i958", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "cts_amclk", -- "cts_mclk_i958" }, -+ .parent_hws = (const struct clk_hw *[]) { -+ &meson8b_cts_amclk.hw, -+ &meson8b_cts_mclk_i958.hw -+ }, - .num_parents = 2, - /* - * The parent is specific to origin of the audio data. Let the --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-ASoC-core-allow-a-dt-node-to-provide-several.patch b/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-ASoC-core-allow-a-dt-node-to-provide-several.patch new file mode 100644 index 0000000000..11b2abada0 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-ASoC-core-allow-a-dt-node-to-provide-several.patch @@ -0,0 +1,42 @@ +From 25132741a2bda8a016d2d0870fbeb244d0cdd545 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:51 +0100 +Subject: [PATCH 012/146] FROMGIT: ASoC: core: allow a dt node to provide + several components + +At the moment, querying the dai_name will stop of the first component +matching the dt node. This does not allow a device (single dt node) to +provide several ASoC components which could then be used through DT. + +This change let the search go on if the xlate function of the component +returns an error, giving the possibility to another component to match +and return the dai_name. + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/soc-core.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index 068d809c349a..03b87427faa7 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -3102,6 +3102,14 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, + *dai_name = dai->driver->name; + if (!*dai_name) + *dai_name = pos->name; ++ } else if (ret) { ++ /* ++ * if another error than ENOTSUPP is returned go on and ++ * check if another component is provided with the same ++ * node. This may happen if a device provides several ++ * components ++ */ ++ continue; + } + + break; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-clk-meson-clk-regmap-migrate-to-new-parent-d.patch b/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-clk-meson-clk-regmap-migrate-to-new-parent-d.patch deleted file mode 100644 index daa1ebca67..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-clk-meson-clk-regmap-migrate-to-new-parent-d.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 3020618a2f27eed92c22026b8f2a5f49215bb668 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:36 +0200 -Subject: [PATCH 012/187] FROMGIT: clk: meson: clk-regmap: migrate to new - parent description method - -This clock controller use the string comparison method to describe parent -relation between the clocks, which is not optimized. - -Migrate to the new way by using .parent_hws where possible (ie. when -all clocks are local to the controller) and use .parent_data otherwise. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit 3a36044e7f3909c7ddb7ddfc727ab8104a563439 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/axg.c | 3 +++ - drivers/clk/meson/clk-regmap.h | 12 ++++++------ - drivers/clk/meson/g12a.c | 6 ++++++ - drivers/clk/meson/gxbb.c | 3 +++ - drivers/clk/meson/meson8b.c | 3 +++ - 5 files changed, 21 insertions(+), 6 deletions(-) - -diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c -index 7a3d795cc614..13fc0006f63d 100644 ---- a/drivers/clk/meson/axg.c -+++ b/drivers/clk/meson/axg.c -@@ -1096,6 +1096,9 @@ static struct clk_regmap axg_gen_clk = { - }, - }; - -+#define MESON_GATE(_name, _reg, _bit) \ -+ MESON_PCLK(_name, _reg, _bit, &axg_clk81.hw) -+ - /* Everything Else (EE) domain gates */ - static MESON_GATE(axg_ddr, HHI_GCLK_MPEG0, 0); - static MESON_GATE(axg_audio_locker, HHI_GCLK_MPEG0, 2); -diff --git a/drivers/clk/meson/clk-regmap.h b/drivers/clk/meson/clk-regmap.h -index 1dd0abe3ba91..c4a39604cffd 100644 ---- a/drivers/clk/meson/clk-regmap.h -+++ b/drivers/clk/meson/clk-regmap.h -@@ -111,7 +111,7 @@ clk_get_regmap_mux_data(struct clk_regmap *clk) - extern const struct clk_ops clk_regmap_mux_ops; - extern const struct clk_ops clk_regmap_mux_ro_ops; - --#define __MESON_GATE(_name, _reg, _bit, _ops) \ -+#define __MESON_PCLK(_name, _reg, _bit, _ops, _pname) \ - struct clk_regmap _name = { \ - .data = &(struct clk_regmap_gate_data){ \ - .offset = (_reg), \ -@@ -120,15 +120,15 @@ struct clk_regmap _name = { \ - .hw.init = &(struct clk_init_data) { \ - .name = #_name, \ - .ops = _ops, \ -- .parent_names = (const char *[]){ "clk81" }, \ -+ .parent_hws = (const struct clk_hw *[]) { _pname }, \ - .num_parents = 1, \ - .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), \ - }, \ - } - --#define MESON_GATE(_name, _reg, _bit) \ -- __MESON_GATE(_name, _reg, _bit, &clk_regmap_gate_ops) -+#define MESON_PCLK(_name, _reg, _bit, _pname) \ -+ __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ops, _pname) - --#define MESON_GATE_RO(_name, _reg, _bit) \ -- __MESON_GATE(_name, _reg, _bit, &clk_regmap_gate_ro_ops) -+#define MESON_PCLK_RO(_name, _reg, _bit, _pname) \ -+ __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ro_ops, _pname) - #endif /* __CLK_REGMAP_H */ -diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c -index 8cc7f5acf7ab..a8f706de811b 100644 ---- a/drivers/clk/meson/g12a.c -+++ b/drivers/clk/meson/g12a.c -@@ -3325,6 +3325,12 @@ static struct clk_regmap g12a_ts = { - }, - }; - -+#define MESON_GATE(_name, _reg, _bit) \ -+ MESON_PCLK(_name, _reg, _bit, &g12a_clk81.hw) -+ -+#define MESON_GATE_RO(_name, _reg, _bit) \ -+ MESON_PCLK_RO(_name, _reg, _bit, &g12a_clk81.hw) -+ - /* Everything Else (EE) domain gates */ - static MESON_GATE(g12a_ddr, HHI_GCLK_MPEG0, 0); - static MESON_GATE(g12a_dos, HHI_GCLK_MPEG0, 1); -diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c -index 67e466356d4b..7cfb998eeb3e 100644 ---- a/drivers/clk/meson/gxbb.c -+++ b/drivers/clk/meson/gxbb.c -@@ -2587,6 +2587,9 @@ static struct clk_regmap gxbb_gen_clk = { - }, - }; - -+#define MESON_GATE(_name, _reg, _bit) \ -+ MESON_PCLK(_name, _reg, _bit, &gxbb_clk81.hw) -+ - /* Everything Else (EE) domain gates */ - static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0); - static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1); -diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c -index b30279a5bfcc..67e6691e080c 100644 ---- a/drivers/clk/meson/meson8b.c -+++ b/drivers/clk/meson/meson8b.c -@@ -2564,6 +2564,9 @@ static struct clk_regmap meson8b_cts_i958 = { - }, - }; - -+#define MESON_GATE(_name, _reg, _bit) \ -+ MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw) -+ - /* Everything Else (EE) domain gates */ - - static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-ASoC-core-ensure-component-names-are-unique.patch b/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-ASoC-core-ensure-component-names-are-unique.patch new file mode 100644 index 0000000000..7520bab0f7 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-ASoC-core-ensure-component-names-are-unique.patch @@ -0,0 +1,73 @@ +From 04c2c7ba6ac38afcca0dcee7b02dcad68912ec33 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 14 Feb 2020 14:47:04 +0100 +Subject: [PATCH 013/146] FROMGIT: ASoC: core: ensure component names are + unique + +Make sure each ASoC component is registered with a unique name. +The component is derived from the device name. If a device registers more +than one component, the component names will be the same. + +This usually brings up a warning about the debugfs directory creation of +the component since directory already exists. + +In such case, start numbering the component of the device so the names +don't collide anymore. + +Signed-off-by: Jerome Brunet +Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com +Signed-off-by: Mark Brown +--- + sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index 03b87427faa7..6a58a8f6e3c4 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, + return ret; + } + ++static char *snd_soc_component_unique_name(struct device *dev, ++ struct snd_soc_component *component) ++{ ++ struct snd_soc_component *pos; ++ int count = 0; ++ char *name, *unique; ++ ++ name = fmt_single_name(dev, &component->id); ++ if (!name) ++ return name; ++ ++ /* Count the number of components registred by the device */ ++ for_each_component(pos) { ++ if (dev == pos->dev) ++ count++; ++ } ++ ++ /* Keep naming as it is for the 1st component */ ++ if (!count) ++ return name; ++ ++ unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); ++ devm_kfree(dev, name); ++ ++ return unique; ++} ++ + static int snd_soc_component_initialize(struct snd_soc_component *component, + const struct snd_soc_component_driver *driver, struct device *dev) + { +@@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, + INIT_LIST_HEAD(&component->card_list); + mutex_init(&component->io_mutex); + +- component->name = fmt_single_name(dev, &component->id); ++ component->name = snd_soc_component_unique_name(dev, component); + if (!component->name) { + dev_err(dev, "ASoC: Failed to allocate name\n"); + return -ENOMEM; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-clk-meson-remove-ee-input-bypass-clocks.patch b/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-clk-meson-remove-ee-input-bypass-clocks.patch deleted file mode 100644 index e56fccd080..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-clk-meson-remove-ee-input-bypass-clocks.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 5cbe82e753b44cbc47686f739a3ca914963dbee2 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:37 +0200 -Subject: [PATCH 013/187] FROMGIT: clk: meson: remove ee input bypass clocks - -During probe, bypass clocks (i.e. ee-in-xtal) are made from device-tree -inputs to provide input clocks which can be access through global name. -The cons of this method are the duplicated clocks, means more string -comparison. - -Specify parent directly with device-tree clock name. - -Remove the bypass clock registration from the ee probe function. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit b11cfaba5b4d6e287540a3d64c403e5b26dd2728 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/Kconfig | 1 - - drivers/clk/meson/meson-eeclk.c | 10 ---------- - drivers/clk/meson/meson-eeclk.h | 2 -- - 3 files changed, 13 deletions(-) - -diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig -index 178ee72ba4bc..72a37572501f 100644 ---- a/drivers/clk/meson/Kconfig -+++ b/drivers/clk/meson/Kconfig -@@ -38,7 +38,6 @@ config COMMON_CLK_MESON_AO_CLKC - config COMMON_CLK_MESON_EE_CLKC - tristate - select COMMON_CLK_MESON_REGMAP -- select COMMON_CLK_MESON_INPUT - - config COMMON_CLK_MESON8B - bool -diff --git a/drivers/clk/meson/meson-eeclk.c b/drivers/clk/meson/meson-eeclk.c -index 6ba2094be257..a7cb1e7aedc4 100644 ---- a/drivers/clk/meson/meson-eeclk.c -+++ b/drivers/clk/meson/meson-eeclk.c -@@ -10,7 +10,6 @@ - #include - #include - --#include "clk-input.h" - #include "clk-regmap.h" - #include "meson-eeclk.h" - -@@ -18,7 +17,6 @@ int meson_eeclkc_probe(struct platform_device *pdev) - { - const struct meson_eeclkc_data *data; - struct device *dev = &pdev->dev; -- struct clk_hw *input; - struct regmap *map; - int ret, i; - -@@ -37,14 +35,6 @@ int meson_eeclkc_probe(struct platform_device *pdev) - if (data->init_count) - regmap_multi_reg_write(map, data->init_regs, data->init_count); - -- input = meson_clk_hw_register_input(dev, "xtal", IN_PREFIX "xtal", 0); -- if (IS_ERR(input)) { -- ret = PTR_ERR(input); -- if (ret != -EPROBE_DEFER) -- dev_err(dev, "failed to get input clock"); -- return ret; -- } -- - /* Populate regmap for the regmap backed clocks */ - for (i = 0; i < data->regmap_clk_num; i++) - data->regmap_clks[i]->map = map; -diff --git a/drivers/clk/meson/meson-eeclk.h b/drivers/clk/meson/meson-eeclk.h -index 9ab5d6fa7ccb..77316207bde1 100644 ---- a/drivers/clk/meson/meson-eeclk.h -+++ b/drivers/clk/meson/meson-eeclk.h -@@ -10,8 +10,6 @@ - #include - #include "clk-regmap.h" - --#define IN_PREFIX "ee-in-" -- - struct platform_device; - - struct meson_eeclkc_data { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-ASoC-meson-g12a-extract-codec-to-codec-utils.patch b/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-ASoC-meson-g12a-extract-codec-to-codec-utils.patch new file mode 100644 index 0000000000..96244ded28 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-ASoC-meson-g12a-extract-codec-to-codec-utils.patch @@ -0,0 +1,567 @@ +From 9fcc658d50b1951e08ab53ca28adb607dbb46c18 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:52 +0100 +Subject: [PATCH 014/146] FROMGIT: ASoC: meson: g12a: extract codec-to-codec + utils + +The hdmi routing mechanism used on g12a hdmi is also used: +* other Amlogic SoC types +* for the internal DAC path + +Each of these codec glues are slightly different but the idea +behind it remains the same. This change extract some helper functions +from the g12a-tohdmitx driver to make them available for other Amlogic +codecs. + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/Kconfig | 4 + + sound/soc/meson/Makefile | 2 + + sound/soc/meson/g12a-tohdmitx.c | 219 ++++++----------------------- + sound/soc/meson/meson-codec-glue.c | 149 ++++++++++++++++++++ + sound/soc/meson/meson-codec-glue.h | 32 +++++ + 5 files changed, 230 insertions(+), 176 deletions(-) + create mode 100644 sound/soc/meson/meson-codec-glue.c + create mode 100644 sound/soc/meson/meson-codec-glue.h + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index 2e3676147cea..ee6d53949d45 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -85,9 +85,13 @@ config SND_MESON_AXG_PDM + Select Y or M to add support for PDM input embedded + in the Amlogic AXG SoC family + ++config SND_MESON_CODEC_GLUE ++ tristate ++ + config SND_MESON_G12A_TOHDMITX + tristate "Amlogic G12A To HDMI TX Control Support" + select REGMAP_MMIO ++ select SND_MESON_CODEC_GLUE + imply SND_SOC_HDMI_CODEC + help + Select Y or M to add support for HDMI audio on the g12a SoC +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index 1a8b1470ed84..529a807b3f37 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -11,6 +11,7 @@ snd-soc-meson-axg-sound-card-objs := axg-card.o + snd-soc-meson-axg-spdifin-objs := axg-spdifin.o + snd-soc-meson-axg-spdifout-objs := axg-spdifout.o + snd-soc-meson-axg-pdm-objs := axg-pdm.o ++snd-soc-meson-codec-glue-objs := meson-codec-glue.o + snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o + + obj-$(CONFIG_SND_MESON_AXG_FIFO) += snd-soc-meson-axg-fifo.o +@@ -24,4 +25,5 @@ obj-$(CONFIG_SND_MESON_AXG_SOUND_CARD) += snd-soc-meson-axg-sound-card.o + obj-$(CONFIG_SND_MESON_AXG_SPDIFIN) += snd-soc-meson-axg-spdifin.o + obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o + obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o ++obj-$(CONFIG_SND_MESON_CODEC_GLUE) += snd-soc-meson-codec-glue.o + obj-$(CONFIG_SND_MESON_G12A_TOHDMITX) += snd-soc-meson-g12a-tohdmitx.o +diff --git a/sound/soc/meson/g12a-tohdmitx.c b/sound/soc/meson/g12a-tohdmitx.c +index 9cfbd343a00c..f8853f2fba08 100644 +--- a/sound/soc/meson/g12a-tohdmitx.c ++++ b/sound/soc/meson/g12a-tohdmitx.c +@@ -12,112 +12,51 @@ + #include + + #include ++#include "meson-codec-glue.h" + + #define G12A_TOHDMITX_DRV_NAME "g12a-tohdmitx" + + #define TOHDMITX_CTRL0 0x0 + #define CTRL0_ENABLE_SHIFT 31 +-#define CTRL0_I2S_DAT_SEL GENMASK(13, 12) ++#define CTRL0_I2S_DAT_SEL_SHIFT 12 ++#define CTRL0_I2S_DAT_SEL (0x3 << CTRL0_I2S_DAT_SEL_SHIFT) + #define CTRL0_I2S_LRCLK_SEL GENMASK(9, 8) + #define CTRL0_I2S_BLK_CAP_INV BIT(7) + #define CTRL0_I2S_BCLK_O_INV BIT(6) + #define CTRL0_I2S_BCLK_SEL GENMASK(5, 4) + #define CTRL0_SPDIF_CLK_CAP_INV BIT(3) + #define CTRL0_SPDIF_CLK_O_INV BIT(2) +-#define CTRL0_SPDIF_SEL BIT(1) ++#define CTRL0_SPDIF_SEL_SHIFT 1 ++#define CTRL0_SPDIF_SEL (0x1 << CTRL0_SPDIF_SEL_SHIFT) + #define CTRL0_SPDIF_CLK_SEL BIT(0) + +-struct g12a_tohdmitx_input { +- struct snd_soc_pcm_stream params; +- unsigned int fmt; +-}; +- +-static struct snd_soc_dapm_widget * +-g12a_tohdmitx_get_input(struct snd_soc_dapm_widget *w) +-{ +- struct snd_soc_dapm_path *p = NULL; +- struct snd_soc_dapm_widget *in; +- +- snd_soc_dapm_widget_for_each_source_path(w, p) { +- if (!p->connect) +- continue; +- +- /* Check that we still are in the same component */ +- if (snd_soc_dapm_to_component(w->dapm) != +- snd_soc_dapm_to_component(p->source->dapm)) +- continue; +- +- if (p->source->id == snd_soc_dapm_dai_in) +- return p->source; +- +- in = g12a_tohdmitx_get_input(p->source); +- if (in) +- return in; +- } +- +- return NULL; +-} +- +-static struct g12a_tohdmitx_input * +-g12a_tohdmitx_get_input_data(struct snd_soc_dapm_widget *w) +-{ +- struct snd_soc_dapm_widget *in = +- g12a_tohdmitx_get_input(w); +- struct snd_soc_dai *dai; +- +- if (WARN_ON(!in)) +- return NULL; +- +- dai = in->priv; +- +- return dai->playback_dma_data; +-} +- + static const char * const g12a_tohdmitx_i2s_mux_texts[] = { + "I2S A", "I2S B", "I2S C", + }; + +-static SOC_ENUM_SINGLE_EXT_DECL(g12a_tohdmitx_i2s_mux_enum, +- g12a_tohdmitx_i2s_mux_texts); +- +-static int g12a_tohdmitx_get_input_val(struct snd_soc_component *component, +- unsigned int mask) +-{ +- unsigned int val; +- +- snd_soc_component_read(component, TOHDMITX_CTRL0, &val); +- return (val & mask) >> __ffs(mask); +-} +- +-static int g12a_tohdmitx_i2s_mux_get_enum(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) +-{ +- struct snd_soc_component *component = +- snd_soc_dapm_kcontrol_component(kcontrol); +- +- ucontrol->value.enumerated.item[0] = +- g12a_tohdmitx_get_input_val(component, CTRL0_I2S_DAT_SEL); +- +- return 0; +-} +- + static int g12a_tohdmitx_i2s_mux_put_enum(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) ++ struct snd_ctl_elem_value *ucontrol) + { + struct snd_soc_component *component = + snd_soc_dapm_kcontrol_component(kcontrol); + struct snd_soc_dapm_context *dapm = + snd_soc_dapm_kcontrol_dapm(kcontrol); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; +- unsigned int mux = ucontrol->value.enumerated.item[0]; +- unsigned int val = g12a_tohdmitx_get_input_val(component, +- CTRL0_I2S_DAT_SEL); ++ unsigned int mux, changed; ++ ++ mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); ++ changed = snd_soc_component_test_bits(component, e->reg, ++ CTRL0_I2S_DAT_SEL, ++ FIELD_PREP(CTRL0_I2S_DAT_SEL, ++ mux)); ++ ++ if (!changed) ++ return 0; + + /* Force disconnect of the mux while updating */ +- if (val != mux) +- snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); + +- snd_soc_component_update_bits(component, TOHDMITX_CTRL0, ++ snd_soc_component_update_bits(component, e->reg, + CTRL0_I2S_DAT_SEL | + CTRL0_I2S_LRCLK_SEL | + CTRL0_I2S_BCLK_SEL, +@@ -130,30 +69,19 @@ static int g12a_tohdmitx_i2s_mux_put_enum(struct snd_kcontrol *kcontrol, + return 0; + } + ++static SOC_ENUM_SINGLE_DECL(g12a_tohdmitx_i2s_mux_enum, TOHDMITX_CTRL0, ++ CTRL0_I2S_DAT_SEL_SHIFT, ++ g12a_tohdmitx_i2s_mux_texts); ++ + static const struct snd_kcontrol_new g12a_tohdmitx_i2s_mux = + SOC_DAPM_ENUM_EXT("I2S Source", g12a_tohdmitx_i2s_mux_enum, +- g12a_tohdmitx_i2s_mux_get_enum, ++ snd_soc_dapm_get_enum_double, + g12a_tohdmitx_i2s_mux_put_enum); + + static const char * const g12a_tohdmitx_spdif_mux_texts[] = { + "SPDIF A", "SPDIF B", + }; + +-static SOC_ENUM_SINGLE_EXT_DECL(g12a_tohdmitx_spdif_mux_enum, +- g12a_tohdmitx_spdif_mux_texts); +- +-static int g12a_tohdmitx_spdif_mux_get_enum(struct snd_kcontrol *kcontrol, +- struct snd_ctl_elem_value *ucontrol) +-{ +- struct snd_soc_component *component = +- snd_soc_dapm_kcontrol_component(kcontrol); +- +- ucontrol->value.enumerated.item[0] = +- g12a_tohdmitx_get_input_val(component, CTRL0_SPDIF_SEL); +- +- return 0; +-} +- + static int g12a_tohdmitx_spdif_mux_put_enum(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +@@ -162,13 +90,18 @@ static int g12a_tohdmitx_spdif_mux_put_enum(struct snd_kcontrol *kcontrol, + struct snd_soc_dapm_context *dapm = + snd_soc_dapm_kcontrol_dapm(kcontrol); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; +- unsigned int mux = ucontrol->value.enumerated.item[0]; +- unsigned int val = g12a_tohdmitx_get_input_val(component, +- CTRL0_SPDIF_SEL); ++ unsigned int mux, changed; ++ ++ mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); ++ changed = snd_soc_component_test_bits(component, TOHDMITX_CTRL0, ++ CTRL0_SPDIF_SEL, ++ FIELD_PREP(CTRL0_SPDIF_SEL, mux)); ++ ++ if (!changed) ++ return 0; + + /* Force disconnect of the mux while updating */ +- if (val != mux) +- snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); + + snd_soc_component_update_bits(component, TOHDMITX_CTRL0, + CTRL0_SPDIF_SEL | +@@ -181,9 +114,13 @@ static int g12a_tohdmitx_spdif_mux_put_enum(struct snd_kcontrol *kcontrol, + return 0; + } + ++static SOC_ENUM_SINGLE_DECL(g12a_tohdmitx_spdif_mux_enum, TOHDMITX_CTRL0, ++ CTRL0_SPDIF_SEL_SHIFT, ++ g12a_tohdmitx_spdif_mux_texts); ++ + static const struct snd_kcontrol_new g12a_tohdmitx_spdif_mux = + SOC_DAPM_ENUM_EXT("SPDIF Source", g12a_tohdmitx_spdif_mux_enum, +- g12a_tohdmitx_spdif_mux_get_enum, ++ snd_soc_dapm_get_enum_double, + g12a_tohdmitx_spdif_mux_put_enum); + + static const struct snd_kcontrol_new g12a_tohdmitx_out_enable = +@@ -201,83 +138,13 @@ static const struct snd_soc_dapm_widget g12a_tohdmitx_widgets[] = { + &g12a_tohdmitx_out_enable), + }; + +-static int g12a_tohdmitx_input_probe(struct snd_soc_dai *dai) +-{ +- struct g12a_tohdmitx_input *data; +- +- data = kzalloc(sizeof(*data), GFP_KERNEL); +- if (!data) +- return -ENOMEM; +- +- dai->playback_dma_data = data; +- return 0; +-} +- +-static int g12a_tohdmitx_input_remove(struct snd_soc_dai *dai) +-{ +- kfree(dai->playback_dma_data); +- return 0; +-} +- +-static int g12a_tohdmitx_input_hw_params(struct snd_pcm_substream *substream, +- struct snd_pcm_hw_params *params, +- struct snd_soc_dai *dai) +-{ +- struct g12a_tohdmitx_input *data = dai->playback_dma_data; +- +- data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params)); +- data->params.rate_min = params_rate(params); +- data->params.rate_max = params_rate(params); +- data->params.formats = 1 << params_format(params); +- data->params.channels_min = params_channels(params); +- data->params.channels_max = params_channels(params); +- data->params.sig_bits = dai->driver->playback.sig_bits; +- +- return 0; +-} +- +- +-static int g12a_tohdmitx_input_set_fmt(struct snd_soc_dai *dai, +- unsigned int fmt) +-{ +- struct g12a_tohdmitx_input *data = dai->playback_dma_data; +- +- /* Save the source stream format for the downstream link */ +- data->fmt = fmt; +- return 0; +-} +- +-static int g12a_tohdmitx_output_startup(struct snd_pcm_substream *substream, +- struct snd_soc_dai *dai) +-{ +- struct snd_soc_pcm_runtime *rtd = substream->private_data; +- struct g12a_tohdmitx_input *in_data = +- g12a_tohdmitx_get_input_data(dai->capture_widget); +- +- if (!in_data) +- return -ENODEV; +- +- if (WARN_ON(!rtd->dai_link->params)) { +- dev_warn(dai->dev, "codec2codec link expected\n"); +- return -EINVAL; +- } +- +- /* Replace link params with the input params */ +- rtd->dai_link->params = &in_data->params; +- +- if (!in_data->fmt) +- return 0; +- +- return snd_soc_runtime_set_dai_fmt(rtd, in_data->fmt); +-} +- + static const struct snd_soc_dai_ops g12a_tohdmitx_input_ops = { +- .hw_params = g12a_tohdmitx_input_hw_params, +- .set_fmt = g12a_tohdmitx_input_set_fmt, ++ .hw_params = meson_codec_glue_input_hw_params, ++ .set_fmt = meson_codec_glue_input_set_fmt, + }; + + static const struct snd_soc_dai_ops g12a_tohdmitx_output_ops = { +- .startup = g12a_tohdmitx_output_startup, ++ .startup = meson_codec_glue_output_startup, + }; + + #define TOHDMITX_SPDIF_FORMATS \ +@@ -304,8 +171,8 @@ static const struct snd_soc_dai_ops g12a_tohdmitx_output_ops = { + .id = (xid), \ + .playback = TOHDMITX_STREAM(xname, "Playback", xfmt, xchmax), \ + .ops = &g12a_tohdmitx_input_ops, \ +- .probe = g12a_tohdmitx_input_probe, \ +- .remove = g12a_tohdmitx_input_remove, \ ++ .probe = meson_codec_glue_input_dai_probe, \ ++ .remove = meson_codec_glue_input_dai_remove, \ + } + + #define TOHDMITX_OUT(xname, xid, xfmt, xchmax) { \ +diff --git a/sound/soc/meson/meson-codec-glue.c b/sound/soc/meson/meson-codec-glue.c +new file mode 100644 +index 000000000000..97bbc967e176 +--- /dev/null ++++ b/sound/soc/meson/meson-codec-glue.c +@@ -0,0 +1,149 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2019 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++ ++#include "meson-codec-glue.h" ++ ++static struct snd_soc_dapm_widget * ++meson_codec_glue_get_input(struct snd_soc_dapm_widget *w) ++{ ++ struct snd_soc_dapm_path *p = NULL; ++ struct snd_soc_dapm_widget *in; ++ ++ snd_soc_dapm_widget_for_each_source_path(w, p) { ++ if (!p->connect) ++ continue; ++ ++ /* Check that we still are in the same component */ ++ if (snd_soc_dapm_to_component(w->dapm) != ++ snd_soc_dapm_to_component(p->source->dapm)) ++ continue; ++ ++ if (p->source->id == snd_soc_dapm_dai_in) ++ return p->source; ++ ++ in = meson_codec_glue_get_input(p->source); ++ if (in) ++ return in; ++ } ++ ++ return NULL; ++} ++ ++static void meson_codec_glue_input_set_data(struct snd_soc_dai *dai, ++ struct meson_codec_glue_input *data) ++{ ++ dai->playback_dma_data = data; ++} ++ ++struct meson_codec_glue_input * ++meson_codec_glue_input_get_data(struct snd_soc_dai *dai) ++{ ++ return dai->playback_dma_data; ++} ++EXPORT_SYMBOL_GPL(meson_codec_glue_input_get_data); ++ ++static struct meson_codec_glue_input * ++meson_codec_glue_output_get_input_data(struct snd_soc_dapm_widget *w) ++{ ++ struct snd_soc_dapm_widget *in = ++ meson_codec_glue_get_input(w); ++ struct snd_soc_dai *dai; ++ ++ if (WARN_ON(!in)) ++ return NULL; ++ ++ dai = in->priv; ++ ++ return meson_codec_glue_input_get_data(dai); ++} ++ ++int meson_codec_glue_input_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct meson_codec_glue_input *data = ++ meson_codec_glue_input_get_data(dai); ++ ++ data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params)); ++ data->params.rate_min = params_rate(params); ++ data->params.rate_max = params_rate(params); ++ data->params.formats = 1 << params_format(params); ++ data->params.channels_min = params_channels(params); ++ data->params.channels_max = params_channels(params); ++ data->params.sig_bits = dai->driver->playback.sig_bits; ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_codec_glue_input_hw_params); ++ ++int meson_codec_glue_input_set_fmt(struct snd_soc_dai *dai, ++ unsigned int fmt) ++{ ++ struct meson_codec_glue_input *data = ++ meson_codec_glue_input_get_data(dai); ++ ++ /* Save the source stream format for the downstream link */ ++ data->fmt = fmt; ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_codec_glue_input_set_fmt); ++ ++int meson_codec_glue_output_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct meson_codec_glue_input *in_data = ++ meson_codec_glue_output_get_input_data(dai->capture_widget); ++ ++ if (!in_data) ++ return -ENODEV; ++ ++ if (WARN_ON(!rtd->dai_link->params)) { ++ dev_warn(dai->dev, "codec2codec link expected\n"); ++ return -EINVAL; ++ } ++ ++ /* Replace link params with the input params */ ++ rtd->dai_link->params = &in_data->params; ++ ++ if (!in_data->fmt) ++ return 0; ++ ++ return snd_soc_runtime_set_dai_fmt(rtd, in_data->fmt); ++} ++EXPORT_SYMBOL_GPL(meson_codec_glue_output_startup); ++ ++int meson_codec_glue_input_dai_probe(struct snd_soc_dai *dai) ++{ ++ struct meson_codec_glue_input *data; ++ ++ data = kzalloc(sizeof(*data), GFP_KERNEL); ++ if (!data) ++ return -ENOMEM; ++ ++ meson_codec_glue_input_set_data(dai, data); ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_codec_glue_input_dai_probe); ++ ++int meson_codec_glue_input_dai_remove(struct snd_soc_dai *dai) ++{ ++ struct meson_codec_glue_input *data = ++ meson_codec_glue_input_get_data(dai); ++ ++ kfree(data); ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_codec_glue_input_dai_remove); ++ ++MODULE_AUTHOR("Jerome Brunet "); ++MODULE_DESCRIPTION("Amlogic Codec Glue Helpers"); ++MODULE_LICENSE("GPL v2"); ++ +diff --git a/sound/soc/meson/meson-codec-glue.h b/sound/soc/meson/meson-codec-glue.h +new file mode 100644 +index 000000000000..07f99446c0c6 +--- /dev/null ++++ b/sound/soc/meson/meson-codec-glue.h +@@ -0,0 +1,32 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (c) 2018 Baylibre SAS. ++ * Author: Jerome Brunet ++ */ ++ ++#ifndef _MESON_CODEC_GLUE_H ++#define _MESON_CODEC_GLUE_H ++ ++#include ++ ++struct meson_codec_glue_input { ++ struct snd_soc_pcm_stream params; ++ unsigned int fmt; ++}; ++ ++/* Input helpers */ ++struct meson_codec_glue_input * ++meson_codec_glue_input_get_data(struct snd_soc_dai *dai); ++int meson_codec_glue_input_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai); ++int meson_codec_glue_input_set_fmt(struct snd_soc_dai *dai, ++ unsigned int fmt); ++int meson_codec_glue_input_dai_probe(struct snd_soc_dai *dai); ++int meson_codec_glue_input_dai_remove(struct snd_soc_dai *dai); ++ ++/* Output helpers */ ++int meson_codec_glue_output_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai); ++ ++#endif /* _MESON_CODEC_GLUE_H */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-clk-meson-remove-clk-input-helper.patch b/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-clk-meson-remove-clk-input-helper.patch deleted file mode 100644 index 33eb324638..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-clk-meson-remove-clk-input-helper.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 8d48d1551e26b76810bf19fc3aaad9033922f6d2 Mon Sep 17 00:00:00 2001 -From: Alexandre Mergnat -Date: Thu, 25 Jul 2019 18:42:38 +0200 -Subject: [PATCH 014/187] FROMGIT: clk: meson: remove clk input helper - -The clk input function which allows clock controllers to register a bypass -clock from a clock producer is no longer needed anymore since meson clock -controllers have migrated to a new parent allocation method. - -Signed-off-by: Alexandre Mergnat -Signed-off-by: Jerome Brunet -(cherry picked from commit e96c7612315a1183e12d5b6ebd523a3a93617510 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/Kconfig | 3 --- - drivers/clk/meson/Makefile | 1 - - drivers/clk/meson/clk-input.c | 49 ----------------------------------- - drivers/clk/meson/clk-input.h | 19 -------------- - 4 files changed, 72 deletions(-) - delete mode 100644 drivers/clk/meson/clk-input.c - delete mode 100644 drivers/clk/meson/clk-input.h - -diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig -index 72a37572501f..500be0b0d473 100644 ---- a/drivers/clk/meson/Kconfig -+++ b/drivers/clk/meson/Kconfig -@@ -1,7 +1,4 @@ - # SPDX-License-Identifier: GPL-2.0-only --config COMMON_CLK_MESON_INPUT -- tristate -- - config COMMON_CLK_MESON_REGMAP - tristate - select REGMAP -diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile -index bc35a4efd6b7..f09d83dc3d60 100644 ---- a/drivers/clk/meson/Makefile -+++ b/drivers/clk/meson/Makefile -@@ -4,7 +4,6 @@ - obj-$(CONFIG_COMMON_CLK_MESON_AO_CLKC) += meson-aoclk.o - obj-$(CONFIG_COMMON_CLK_MESON_DUALDIV) += clk-dualdiv.o - obj-$(CONFIG_COMMON_CLK_MESON_EE_CLKC) += meson-eeclk.o --obj-$(CONFIG_COMMON_CLK_MESON_INPUT) += clk-input.o - obj-$(CONFIG_COMMON_CLK_MESON_MPLL) += clk-mpll.o - obj-$(CONFIG_COMMON_CLK_MESON_PHASE) += clk-phase.o - obj-$(CONFIG_COMMON_CLK_MESON_PLL) += clk-pll.o -diff --git a/drivers/clk/meson/clk-input.c b/drivers/clk/meson/clk-input.c -deleted file mode 100644 -index 086226e9dba6..000000000000 ---- a/drivers/clk/meson/clk-input.c -+++ /dev/null -@@ -1,49 +0,0 @@ --// SPDX-License-Identifier: (GPL-2.0 OR MIT) --/* -- * Copyright (c) 2018 BayLibre, SAS. -- * Author: Jerome Brunet -- */ -- --#include --#include --#include --#include --#include "clk-input.h" -- --static const struct clk_ops meson_clk_no_ops = {}; -- --struct clk_hw *meson_clk_hw_register_input(struct device *dev, -- const char *of_name, -- const char *clk_name, -- unsigned long flags) --{ -- struct clk *parent_clk = devm_clk_get(dev, of_name); -- struct clk_init_data init; -- const char *parent_name; -- struct clk_hw *hw; -- int ret; -- -- if (IS_ERR(parent_clk)) -- return (struct clk_hw *)parent_clk; -- -- hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); -- if (!hw) -- return ERR_PTR(-ENOMEM); -- -- parent_name = __clk_get_name(parent_clk); -- init.name = clk_name; -- init.ops = &meson_clk_no_ops; -- init.flags = flags; -- init.parent_names = &parent_name; -- init.num_parents = 1; -- hw->init = &init; -- -- ret = devm_clk_hw_register(dev, hw); -- -- return ret ? ERR_PTR(ret) : hw; --} --EXPORT_SYMBOL_GPL(meson_clk_hw_register_input); -- --MODULE_DESCRIPTION("Amlogic clock input helper"); --MODULE_AUTHOR("Jerome Brunet "); --MODULE_LICENSE("GPL v2"); -diff --git a/drivers/clk/meson/clk-input.h b/drivers/clk/meson/clk-input.h -deleted file mode 100644 -index 4a541b9685a6..000000000000 ---- a/drivers/clk/meson/clk-input.h -+++ /dev/null -@@ -1,19 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0 */ --/* -- * Copyright (c) 2019 BayLibre, SAS. -- * Author: Jerome Brunet -- */ -- --#ifndef __MESON_CLK_INPUT_H --#define __MESON_CLK_INPUT_H -- --#include -- --struct device; -- --struct clk_hw *meson_clk_hw_register_input(struct device *dev, -- const char *of_name, -- const char *clk_name, -- unsigned long flags); -- --#endif /* __MESON_CLK_INPUT_H */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-ASoC-meson-aiu-add-audio-output-dt-bindings.patch b/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-ASoC-meson-aiu-add-audio-output-dt-bindings.patch new file mode 100644 index 0000000000..2a82e48ac3 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-ASoC-meson-aiu-add-audio-output-dt-bindings.patch @@ -0,0 +1,163 @@ +From 659dbb6904d527ac9a6eebddb849e40f5753edc7 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:53 +0100 +Subject: [PATCH 015/146] FROMGIT: ASoC: meson: aiu: add audio output + dt-bindings + +Add the dt-bindings and documentation of the AIU audio controller. +This component provides most of the audio outputs found on the Amlogic +Gx SoC family. + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + .../bindings/sound/amlogic,aiu.yaml | 111 ++++++++++++++++++ + include/dt-bindings/sound/meson-aiu.h | 18 +++ + 2 files changed, 129 insertions(+) + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,aiu.yaml + create mode 100644 include/dt-bindings/sound/meson-aiu.h + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml b/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml +new file mode 100644 +index 000000000000..3ef7632dcb59 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml +@@ -0,0 +1,111 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,aiu.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic AIU audio output controller ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 2 ++ ++ compatible: ++ items: ++ - enum: ++ - amlogic,aiu-gxbb ++ - amlogic,aiu-gxl ++ - const: ++ amlogic,aiu ++ ++ clocks: ++ items: ++ - description: AIU peripheral clock ++ - description: I2S peripheral clock ++ - description: I2S output clock ++ - description: I2S master clock ++ - description: I2S mixer clock ++ - description: SPDIF peripheral clock ++ - description: SPDIF output clock ++ - description: SPDIF master clock ++ - description: SPDIF master clock multiplexer ++ ++ clock-names: ++ items: ++ - const: pclk ++ - const: i2s_pclk ++ - const: i2s_aoclk ++ - const: i2s_mclk ++ - const: i2s_mixer ++ - const: spdif_pclk ++ - const: spdif_aoclk ++ - const: spdif_mclk ++ - const: spdif_mclk_sel ++ ++ interrupts: ++ items: ++ - description: I2S interrupt line ++ - description: SPDIF interrupt line ++ ++ interrupt-names: ++ items: ++ - const: i2s ++ - const: spdif ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - clocks ++ - clock-names ++ - interrupts ++ - interrupt-names ++ - reg ++ - resets ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ #include ++ ++ aiu: audio-controller@5400 { ++ compatible = "amlogic,aiu-gxl", "amlogic,aiu"; ++ #sound-dai-cells = <2>; ++ reg = <0x0 0x5400 0x0 0x2ac>; ++ interrupts = , ++ ; ++ interrupt-names = "i2s", "spdif"; ++ clocks = <&clkc CLKID_AIU_GLUE>, ++ <&clkc CLKID_I2S_OUT>, ++ <&clkc CLKID_AOCLK_GATE>, ++ <&clkc CLKID_CTS_AMCLK>, ++ <&clkc CLKID_MIXER_IFACE>, ++ <&clkc CLKID_IEC958>, ++ <&clkc CLKID_IEC958_GATE>, ++ <&clkc CLKID_CTS_MCLK_I958>, ++ <&clkc CLKID_CTS_I958>; ++ clock-names = "pclk", ++ "i2s_pclk", ++ "i2s_aoclk", ++ "i2s_mclk", ++ "i2s_mixer", ++ "spdif_pclk", ++ "spdif_aoclk", ++ "spdif_mclk", ++ "spdif_mclk_sel"; ++ resets = <&reset RESET_AIU>; ++ }; ++ +diff --git a/include/dt-bindings/sound/meson-aiu.h b/include/dt-bindings/sound/meson-aiu.h +new file mode 100644 +index 000000000000..1051b8af298b +--- /dev/null ++++ b/include/dt-bindings/sound/meson-aiu.h +@@ -0,0 +1,18 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __DT_MESON_AIU_H ++#define __DT_MESON_AIU_H ++ ++#define AIU_CPU 0 ++#define AIU_HDMI 1 ++#define AIU_ACODEC 2 ++ ++#define CPU_I2S_FIFO 0 ++#define CPU_SPDIF_FIFO 1 ++#define CPU_I2S_ENCODER 2 ++#define CPU_SPDIF_ENCODER 3 ++ ++#define CTRL_I2S 0 ++#define CTRL_PCM 1 ++#define CTRL_OUT 2 ++ ++#endif /* __DT_MESON_AIU_H */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-clk-core-introduce-clk_hw_set_parent.patch b/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-clk-core-introduce-clk_hw_set_parent.patch deleted file mode 100644 index 7e708f0332..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-clk-core-introduce-clk_hw_set_parent.patch +++ /dev/null @@ -1,56 +0,0 @@ -From a5eb5e115cf48475f0b68422cbcbe9bac00d470f Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 31 Jul 2019 10:40:16 +0200 -Subject: [PATCH 015/187] FROMGIT: clk: core: introduce clk_hw_set_parent() - -Introduce the clk_hw_set_parent() provider call to change parent of -a clock by using the clk_hw pointers. - -This eases the clock reparenting from clock rate notifiers and -implementing DVFS with simpler code avoiding the boilerplates -functions as __clk_lookup(clk_hw_get_name()) then clk_set_parent(). - -Signed-off-by: Neil Armstrong -Acked-by: Martin Blumenstingl -Acked-by: Stephen Boyd -Signed-off-by: Jerome Brunet -(cherry picked from commit 3567894b6914813299300019e028874927210880 - https://github.com/BayLibre/clk-meson v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/clk/clk.c | 6 ++++++ - include/linux/clk-provider.h | 1 + - 2 files changed, 7 insertions(+) - -diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c -index 1c46babeb093..ca99e9db6575 100644 ---- a/drivers/clk/clk.c -+++ b/drivers/clk/clk.c -@@ -2510,6 +2510,12 @@ static int clk_core_set_parent_nolock(struct clk_core *core, - return ret; - } - -+int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *parent) -+{ -+ return clk_core_set_parent_nolock(hw->core, parent->core); -+} -+EXPORT_SYMBOL_GPL(clk_hw_set_parent); -+ - /** - * clk_set_parent - switch the parent of a mux clk - * @clk: the mux clk whose input we are switching -diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h -index 2ae7604783dd..dce5521a9bf6 100644 ---- a/include/linux/clk-provider.h -+++ b/include/linux/clk-provider.h -@@ -817,6 +817,7 @@ unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); - struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); - struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, - unsigned int index); -+int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *new_parent); - unsigned int __clk_get_enable_count(struct clk *clk); - unsigned long clk_hw_get_rate(const struct clk_hw *hw); - unsigned long __clk_get_flags(struct clk *clk); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-ASoC-meson-aiu-add-i2s-and-spdif-support.patch b/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-ASoC-meson-aiu-add-i2s-and-spdif-support.patch new file mode 100644 index 0000000000..76171246b7 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-ASoC-meson-aiu-add-i2s-and-spdif-support.patch @@ -0,0 +1,1699 @@ +From 4aa0ea57e924c8498bbdcc7aa7e7f764adb1e5c9 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:54 +0100 +Subject: [PATCH 016/146] FROMGIT: ASoC: meson: aiu: add i2s and spdif support + +Add support for the i2s and spdif audio outputs (AIU) found in the +amlogic Gx SoC family + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/Kconfig | 7 + + sound/soc/meson/Makefile | 7 + + sound/soc/meson/aiu-encoder-i2s.c | 324 ++++++++++++++++++++++++++ + sound/soc/meson/aiu-encoder-spdif.c | 209 +++++++++++++++++ + sound/soc/meson/aiu-fifo-i2s.c | 153 ++++++++++++ + sound/soc/meson/aiu-fifo-spdif.c | 186 +++++++++++++++ + sound/soc/meson/aiu-fifo.c | 223 ++++++++++++++++++ + sound/soc/meson/aiu-fifo.h | 50 ++++ + sound/soc/meson/aiu.c | 348 ++++++++++++++++++++++++++++ + sound/soc/meson/aiu.h | 82 +++++++ + 10 files changed, 1589 insertions(+) + create mode 100644 sound/soc/meson/aiu-encoder-i2s.c + create mode 100644 sound/soc/meson/aiu-encoder-spdif.c + create mode 100644 sound/soc/meson/aiu-fifo-i2s.c + create mode 100644 sound/soc/meson/aiu-fifo-spdif.c + create mode 100644 sound/soc/meson/aiu-fifo.c + create mode 100644 sound/soc/meson/aiu-fifo.h + create mode 100644 sound/soc/meson/aiu.c + create mode 100644 sound/soc/meson/aiu.h + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index ee6d53949d45..ca269dedfc7f 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -2,6 +2,13 @@ + menu "ASoC support for Amlogic platforms" + depends on ARCH_MESON || COMPILE_TEST + ++config SND_MESON_AIU ++ tristate "Amlogic AIU" ++ select SND_PCM_IEC958 ++ help ++ Select Y or M to add support for the Audio output subsystem found ++ in the Amlogic GX SoC family ++ + config SND_MESON_AXG_FIFO + tristate + select REGMAP_MMIO +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index 529a807b3f37..a7b79d717288 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -1,5 +1,11 @@ + # SPDX-License-Identifier: (GPL-2.0 OR MIT) + ++snd-soc-meson-aiu-objs := aiu.o ++snd-soc-meson-aiu-objs += aiu-encoder-i2s.o ++snd-soc-meson-aiu-objs += aiu-encoder-spdif.o ++snd-soc-meson-aiu-objs += aiu-fifo.o ++snd-soc-meson-aiu-objs += aiu-fifo-i2s.o ++snd-soc-meson-aiu-objs += aiu-fifo-spdif.o + snd-soc-meson-axg-fifo-objs := axg-fifo.o + snd-soc-meson-axg-frddr-objs := axg-frddr.o + snd-soc-meson-axg-toddr-objs := axg-toddr.o +@@ -14,6 +20,7 @@ snd-soc-meson-axg-pdm-objs := axg-pdm.o + snd-soc-meson-codec-glue-objs := meson-codec-glue.o + snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o + ++obj-$(CONFIG_SND_MESON_AIU) += snd-soc-meson-aiu.o + obj-$(CONFIG_SND_MESON_AXG_FIFO) += snd-soc-meson-axg-fifo.o + obj-$(CONFIG_SND_MESON_AXG_FRDDR) += snd-soc-meson-axg-frddr.o + obj-$(CONFIG_SND_MESON_AXG_TODDR) += snd-soc-meson-axg-toddr.o +diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c +new file mode 100644 +index 000000000000..13bf029086a9 +--- /dev/null ++++ b/sound/soc/meson/aiu-encoder-i2s.c +@@ -0,0 +1,324 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "aiu.h" ++ ++#define AIU_I2S_SOURCE_DESC_MODE_8CH BIT(0) ++#define AIU_I2S_SOURCE_DESC_MODE_24BIT BIT(5) ++#define AIU_I2S_SOURCE_DESC_MODE_32BIT BIT(9) ++#define AIU_I2S_SOURCE_DESC_MODE_SPLIT BIT(11) ++#define AIU_RST_SOFT_I2S_FAST BIT(0) ++ ++#define AIU_I2S_DAC_CFG_MSB_FIRST BIT(2) ++#define AIU_I2S_MISC_HOLD_EN BIT(2) ++#define AIU_CLK_CTRL_I2S_DIV_EN BIT(0) ++#define AIU_CLK_CTRL_I2S_DIV GENMASK(3, 2) ++#define AIU_CLK_CTRL_AOCLK_INVERT BIT(6) ++#define AIU_CLK_CTRL_LRCLK_INVERT BIT(7) ++#define AIU_CLK_CTRL_LRCLK_SKEW GENMASK(9, 8) ++#define AIU_CLK_CTRL_MORE_HDMI_AMCLK BIT(6) ++#define AIU_CLK_CTRL_MORE_I2S_DIV GENMASK(5, 0) ++#define AIU_CODEC_DAC_LRCLK_CTRL_DIV GENMASK(11, 0) ++ ++struct aiu_encoder_i2s { ++ struct clk *aoclk; ++ struct clk *mclk; ++ struct clk *mixer; ++ struct clk *pclk; ++}; ++ ++static void aiu_encoder_i2s_divider_enable(struct snd_soc_component *component, ++ bool enable) ++{ ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL, ++ AIU_CLK_CTRL_I2S_DIV_EN, ++ enable ? AIU_CLK_CTRL_I2S_DIV_EN : 0); ++} ++ ++static void aiu_encoder_i2s_hold(struct snd_soc_component *component, ++ bool enable) ++{ ++ snd_soc_component_update_bits(component, AIU_I2S_MISC, ++ AIU_I2S_MISC_HOLD_EN, ++ enable ? AIU_I2S_MISC_HOLD_EN : 0); ++} ++ ++static int aiu_encoder_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ aiu_encoder_i2s_hold(component, false); ++ return 0; ++ ++ case SNDRV_PCM_TRIGGER_STOP: ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ aiu_encoder_i2s_hold(component, true); ++ return 0; ++ ++ default: ++ return -EINVAL; ++ } ++} ++ ++static int aiu_encoder_i2s_setup_desc(struct snd_soc_component *component, ++ struct snd_pcm_hw_params *params) ++{ ++ /* Always operate in split (classic interleaved) mode */ ++ unsigned int desc = AIU_I2S_SOURCE_DESC_MODE_SPLIT; ++ unsigned int val; ++ ++ /* Reset required to update the pipeline */ ++ snd_soc_component_write(component, AIU_RST_SOFT, AIU_RST_SOFT_I2S_FAST); ++ snd_soc_component_read(component, AIU_I2S_SYNC, &val); ++ ++ switch (params_physical_width(params)) { ++ case 16: /* Nothing to do */ ++ break; ++ ++ case 32: ++ desc |= (AIU_I2S_SOURCE_DESC_MODE_24BIT | ++ AIU_I2S_SOURCE_DESC_MODE_32BIT); ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ ++ switch (params_channels(params)) { ++ case 2: /* Nothing to do */ ++ break; ++ case 8: ++ desc |= AIU_I2S_SOURCE_DESC_MODE_8CH; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ snd_soc_component_update_bits(component, AIU_I2S_SOURCE_DESC, ++ AIU_I2S_SOURCE_DESC_MODE_8CH | ++ AIU_I2S_SOURCE_DESC_MODE_24BIT | ++ AIU_I2S_SOURCE_DESC_MODE_32BIT | ++ AIU_I2S_SOURCE_DESC_MODE_SPLIT, ++ desc); ++ ++ return 0; ++} ++ ++static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, ++ struct snd_pcm_hw_params *params) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(component); ++ unsigned int srate = params_rate(params); ++ unsigned int fs, bs; ++ ++ /* Get the oversampling factor */ ++ fs = DIV_ROUND_CLOSEST(clk_get_rate(aiu->i2s.clks[MCLK].clk), srate); ++ ++ if (fs % 64) ++ return -EINVAL; ++ ++ /* Send data MSB first */ ++ snd_soc_component_update_bits(component, AIU_I2S_DAC_CFG, ++ AIU_I2S_DAC_CFG_MSB_FIRST, ++ AIU_I2S_DAC_CFG_MSB_FIRST); ++ ++ /* Set bclk to lrlck ratio */ ++ snd_soc_component_update_bits(component, AIU_CODEC_DAC_LRCLK_CTRL, ++ AIU_CODEC_DAC_LRCLK_CTRL_DIV, ++ FIELD_PREP(AIU_CODEC_DAC_LRCLK_CTRL_DIV, ++ 64 - 1)); ++ ++ /* Use CLK_MORE for mclk to bclk divider */ ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL, ++ AIU_CLK_CTRL_I2S_DIV, 0); ++ ++ /* ++ * NOTE: this HW is odd. ++ * In most configuration, the i2s divider is 'mclk / blck'. ++ * However, in 16 bits - 8ch mode, this factor needs to be ++ * increased by 50% to get the correct output rate. ++ * No idea why ! ++ */ ++ bs = fs / 64; ++ if (params_width(params) == 16 && params_channels(params) == 8) { ++ if (bs % 2) { ++ dev_err(component->dev, ++ "Cannot increase i2s divider by 50%%\n"); ++ return -EINVAL; ++ } ++ bs += bs / 2; ++ } ++ ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, ++ AIU_CLK_CTRL_MORE_I2S_DIV, ++ FIELD_PREP(AIU_CLK_CTRL_MORE_I2S_DIV, ++ bs - 1)); ++ ++ /* Make sure amclk is used for HDMI i2s as well */ ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, ++ AIU_CLK_CTRL_MORE_HDMI_AMCLK, ++ AIU_CLK_CTRL_MORE_HDMI_AMCLK); ++ ++ return 0; ++} ++ ++static int aiu_encoder_i2s_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ int ret; ++ ++ /* Disable the clock while changing the settings */ ++ aiu_encoder_i2s_divider_enable(component, false); ++ ++ ret = aiu_encoder_i2s_setup_desc(component, params); ++ if (ret) { ++ dev_err(dai->dev, "setting i2s desc failed\n"); ++ return ret; ++ } ++ ++ ret = aiu_encoder_i2s_set_clocks(component, params); ++ if (ret) { ++ dev_err(dai->dev, "setting i2s clocks failed\n"); ++ return ret; ++ } ++ ++ aiu_encoder_i2s_divider_enable(component, true); ++ ++ return 0; ++} ++ ++static int aiu_encoder_i2s_hw_free(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ ++ aiu_encoder_i2s_divider_enable(component, false); ++ ++ return 0; ++} ++ ++static int aiu_encoder_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) ++{ ++ struct snd_soc_component *component = dai->component; ++ unsigned int inv = fmt & SND_SOC_DAIFMT_INV_MASK; ++ unsigned int val = 0; ++ unsigned int skew; ++ ++ /* Only CPU Master / Codec Slave supported ATM */ ++ if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) ++ return -EINVAL; ++ ++ if (inv == SND_SOC_DAIFMT_NB_IF || ++ inv == SND_SOC_DAIFMT_IB_IF) ++ val |= AIU_CLK_CTRL_LRCLK_INVERT; ++ ++ if (inv == SND_SOC_DAIFMT_IB_NF || ++ inv == SND_SOC_DAIFMT_IB_IF) ++ val |= AIU_CLK_CTRL_AOCLK_INVERT; ++ ++ /* Signal skew */ ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_I2S: ++ /* Invert sample clock for i2s */ ++ val ^= AIU_CLK_CTRL_LRCLK_INVERT; ++ skew = 1; ++ break; ++ case SND_SOC_DAIFMT_LEFT_J: ++ skew = 0; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ val |= FIELD_PREP(AIU_CLK_CTRL_LRCLK_SKEW, skew); ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL, ++ AIU_CLK_CTRL_LRCLK_INVERT | ++ AIU_CLK_CTRL_AOCLK_INVERT | ++ AIU_CLK_CTRL_LRCLK_SKEW, ++ val); ++ ++ return 0; ++} ++ ++static int aiu_encoder_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, ++ unsigned int freq, int dir) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(dai->component); ++ int ret; ++ ++ if (WARN_ON(clk_id != 0)) ++ return -EINVAL; ++ ++ if (dir == SND_SOC_CLOCK_IN) ++ return 0; ++ ++ ret = clk_set_rate(aiu->i2s.clks[MCLK].clk, freq); ++ if (ret) ++ dev_err(dai->dev, "Failed to set sysclk to %uHz", freq); ++ ++ return ret; ++} ++ ++static const unsigned int hw_channels[] = {2, 8}; ++static const struct snd_pcm_hw_constraint_list hw_channel_constraints = { ++ .list = hw_channels, ++ .count = ARRAY_SIZE(hw_channels), ++ .mask = 0, ++}; ++ ++static int aiu_encoder_i2s_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(dai->component); ++ int ret; ++ ++ /* Make sure the encoder gets either 2 or 8 channels */ ++ ret = snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_CHANNELS, ++ &hw_channel_constraints); ++ if (ret) { ++ dev_err(dai->dev, "adding channels constraints failed\n"); ++ return ret; ++ } ++ ++ ret = clk_bulk_prepare_enable(aiu->i2s.clk_num, aiu->i2s.clks); ++ if (ret) ++ dev_err(dai->dev, "failed to enable i2s clocks\n"); ++ ++ return ret; ++} ++ ++static void aiu_encoder_i2s_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(dai->component); ++ ++ clk_bulk_disable_unprepare(aiu->i2s.clk_num, aiu->i2s.clks); ++} ++ ++const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = { ++ .trigger = aiu_encoder_i2s_trigger, ++ .hw_params = aiu_encoder_i2s_hw_params, ++ .hw_free = aiu_encoder_i2s_hw_free, ++ .set_fmt = aiu_encoder_i2s_set_fmt, ++ .set_sysclk = aiu_encoder_i2s_set_sysclk, ++ .startup = aiu_encoder_i2s_startup, ++ .shutdown = aiu_encoder_i2s_shutdown, ++}; ++ +diff --git a/sound/soc/meson/aiu-encoder-spdif.c b/sound/soc/meson/aiu-encoder-spdif.c +new file mode 100644 +index 000000000000..de850913975f +--- /dev/null ++++ b/sound/soc/meson/aiu-encoder-spdif.c +@@ -0,0 +1,209 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "aiu.h" ++ ++#define AIU_958_MISC_NON_PCM BIT(0) ++#define AIU_958_MISC_MODE_16BITS BIT(1) ++#define AIU_958_MISC_16BITS_ALIGN GENMASK(6, 5) ++#define AIU_958_MISC_MODE_32BITS BIT(7) ++#define AIU_958_MISC_U_FROM_STREAM BIT(12) ++#define AIU_958_MISC_FORCE_LR BIT(13) ++#define AIU_958_CTRL_HOLD_EN BIT(0) ++#define AIU_CLK_CTRL_958_DIV_EN BIT(1) ++#define AIU_CLK_CTRL_958_DIV GENMASK(5, 4) ++#define AIU_CLK_CTRL_958_DIV_MORE BIT(12) ++ ++#define AIU_CS_WORD_LEN 4 ++#define AIU_958_INTERNAL_DIV 2 ++ ++static void ++aiu_encoder_spdif_divider_enable(struct snd_soc_component *component, ++ bool enable) ++{ ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL, ++ AIU_CLK_CTRL_958_DIV_EN, ++ enable ? AIU_CLK_CTRL_958_DIV_EN : 0); ++} ++ ++static void aiu_encoder_spdif_hold(struct snd_soc_component *component, ++ bool enable) ++{ ++ snd_soc_component_update_bits(component, AIU_958_CTRL, ++ AIU_958_CTRL_HOLD_EN, ++ enable ? AIU_958_CTRL_HOLD_EN : 0); ++} ++ ++static int ++aiu_encoder_spdif_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ aiu_encoder_spdif_hold(component, false); ++ return 0; ++ ++ case SNDRV_PCM_TRIGGER_STOP: ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ aiu_encoder_spdif_hold(component, true); ++ return 0; ++ ++ default: ++ return -EINVAL; ++ } ++} ++ ++static int aiu_encoder_spdif_setup_cs_word(struct snd_soc_component *component, ++ struct snd_pcm_hw_params *params) ++{ ++ u8 cs[AIU_CS_WORD_LEN]; ++ unsigned int val; ++ int ret; ++ ++ ret = snd_pcm_create_iec958_consumer_hw_params(params, cs, ++ AIU_CS_WORD_LEN); ++ if (ret < 0) ++ return ret; ++ ++ /* Write the 1st half word */ ++ val = cs[1] | cs[0] << 8; ++ snd_soc_component_write(component, AIU_958_CHSTAT_L0, val); ++ snd_soc_component_write(component, AIU_958_CHSTAT_R0, val); ++ ++ /* Write the 2nd half word */ ++ val = cs[3] | cs[2] << 8; ++ snd_soc_component_write(component, AIU_958_CHSTAT_L1, val); ++ snd_soc_component_write(component, AIU_958_CHSTAT_R1, val); ++ ++ return 0; ++} ++ ++static int aiu_encoder_spdif_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct aiu *aiu = snd_soc_component_get_drvdata(component); ++ unsigned int val = 0, mrate; ++ int ret; ++ ++ /* Disable the clock while changing the settings */ ++ aiu_encoder_spdif_divider_enable(component, false); ++ ++ switch (params_physical_width(params)) { ++ case 16: ++ val |= AIU_958_MISC_MODE_16BITS; ++ val |= FIELD_PREP(AIU_958_MISC_16BITS_ALIGN, 2); ++ break; ++ case 32: ++ val |= AIU_958_MISC_MODE_32BITS; ++ break; ++ default: ++ dev_err(dai->dev, "Unsupport physical width\n"); ++ return -EINVAL; ++ } ++ ++ snd_soc_component_update_bits(component, AIU_958_MISC, ++ AIU_958_MISC_NON_PCM | ++ AIU_958_MISC_MODE_16BITS | ++ AIU_958_MISC_16BITS_ALIGN | ++ AIU_958_MISC_MODE_32BITS | ++ AIU_958_MISC_FORCE_LR | ++ AIU_958_MISC_U_FROM_STREAM, ++ val); ++ ++ /* Set the stream channel status word */ ++ ret = aiu_encoder_spdif_setup_cs_word(component, params); ++ if (ret) { ++ dev_err(dai->dev, "failed to set channel status word\n"); ++ return ret; ++ } ++ ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL, ++ AIU_CLK_CTRL_958_DIV | ++ AIU_CLK_CTRL_958_DIV_MORE, ++ FIELD_PREP(AIU_CLK_CTRL_958_DIV, ++ __ffs(AIU_958_INTERNAL_DIV))); ++ ++ /* 2 * 32bits per subframe * 2 channels = 128 */ ++ mrate = params_rate(params) * 128 * AIU_958_INTERNAL_DIV; ++ ret = clk_set_rate(aiu->spdif.clks[MCLK].clk, mrate); ++ if (ret) { ++ dev_err(dai->dev, "failed to set mclk rate\n"); ++ return ret; ++ } ++ ++ aiu_encoder_spdif_divider_enable(component, true); ++ ++ return 0; ++} ++ ++static int aiu_encoder_spdif_hw_free(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ ++ aiu_encoder_spdif_divider_enable(component, false); ++ ++ return 0; ++} ++ ++static int aiu_encoder_spdif_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(dai->component); ++ int ret; ++ ++ /* ++ * NOTE: Make sure the spdif block is on its own divider. ++ * ++ * The spdif can be clocked by the i2s master clock or its own ++ * clock. We should (in theory) change the source depending on the ++ * origin of the data. ++ * ++ * However, considering the clocking scheme used on these platforms, ++ * the master clocks will pick the same PLL source when they are ++ * playing from the same FIFO. The clock should be in sync so, it ++ * should not be necessary to reparent the spdif master clock. ++ */ ++ ret = clk_set_parent(aiu->spdif.clks[MCLK].clk, ++ aiu->spdif_mclk); ++ if (ret) ++ return ret; ++ ++ ret = clk_bulk_prepare_enable(aiu->spdif.clk_num, aiu->spdif.clks); ++ if (ret) ++ dev_err(dai->dev, "failed to enable spdif clocks\n"); ++ ++ return ret; ++} ++ ++static void aiu_encoder_spdif_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(dai->component); ++ ++ clk_bulk_disable_unprepare(aiu->spdif.clk_num, aiu->spdif.clks); ++} ++ ++const struct snd_soc_dai_ops aiu_encoder_spdif_dai_ops = { ++ .trigger = aiu_encoder_spdif_trigger, ++ .hw_params = aiu_encoder_spdif_hw_params, ++ .hw_free = aiu_encoder_spdif_hw_free, ++ .startup = aiu_encoder_spdif_startup, ++ .shutdown = aiu_encoder_spdif_shutdown, ++}; +diff --git a/sound/soc/meson/aiu-fifo-i2s.c b/sound/soc/meson/aiu-fifo-i2s.c +new file mode 100644 +index 000000000000..9a5271ce80fe +--- /dev/null ++++ b/sound/soc/meson/aiu-fifo-i2s.c +@@ -0,0 +1,153 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "aiu.h" ++#include "aiu-fifo.h" ++ ++#define AIU_I2S_SOURCE_DESC_MODE_8CH BIT(0) ++#define AIU_I2S_SOURCE_DESC_MODE_24BIT BIT(5) ++#define AIU_I2S_SOURCE_DESC_MODE_32BIT BIT(9) ++#define AIU_I2S_SOURCE_DESC_MODE_SPLIT BIT(11) ++#define AIU_MEM_I2S_MASKS_IRQ_BLOCK GENMASK(31, 16) ++#define AIU_MEM_I2S_CONTROL_MODE_16BIT BIT(6) ++#define AIU_MEM_I2S_BUF_CNTL_INIT BIT(0) ++#define AIU_RST_SOFT_I2S_FAST BIT(0) ++ ++#define AIU_FIFO_I2S_BLOCK 256 ++ ++static struct snd_pcm_hardware fifo_i2s_pcm = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID | ++ SNDRV_PCM_INFO_PAUSE), ++ .formats = AIU_FORMATS, ++ .rate_min = 5512, ++ .rate_max = 192000, ++ .channels_min = 2, ++ .channels_max = 8, ++ .period_bytes_min = AIU_FIFO_I2S_BLOCK, ++ .period_bytes_max = AIU_FIFO_I2S_BLOCK * USHRT_MAX, ++ .periods_min = 2, ++ .periods_max = UINT_MAX, ++ ++ /* No real justification for this */ ++ .buffer_bytes_max = 1 * 1024 * 1024, ++}; ++ ++static int aiu_fifo_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ unsigned int val; ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ snd_soc_component_write(component, AIU_RST_SOFT, ++ AIU_RST_SOFT_I2S_FAST); ++ snd_soc_component_read(component, AIU_I2S_SYNC, &val); ++ break; ++ } ++ ++ return aiu_fifo_trigger(substream, cmd, dai); ++} ++ ++static int aiu_fifo_i2s_prepare(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ int ret; ++ ++ ret = aiu_fifo_prepare(substream, dai); ++ if (ret) ++ return ret; ++ ++ snd_soc_component_update_bits(component, ++ AIU_MEM_I2S_BUF_CNTL, ++ AIU_MEM_I2S_BUF_CNTL_INIT, ++ AIU_MEM_I2S_BUF_CNTL_INIT); ++ snd_soc_component_update_bits(component, ++ AIU_MEM_I2S_BUF_CNTL, ++ AIU_MEM_I2S_BUF_CNTL_INIT, 0); ++ ++ return 0; ++} ++ ++static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ unsigned int val; ++ int ret; ++ ++ ret = aiu_fifo_hw_params(substream, params, dai); ++ if (ret) ++ return ret; ++ ++ switch (params_physical_width(params)) { ++ case 16: ++ val = AIU_MEM_I2S_CONTROL_MODE_16BIT; ++ break; ++ case 32: ++ val = 0; ++ break; ++ default: ++ dev_err(dai->dev, "Unsupported physical width %u\n", ++ params_physical_width(params)); ++ return -EINVAL; ++ } ++ ++ snd_soc_component_update_bits(component, AIU_MEM_I2S_CONTROL, ++ AIU_MEM_I2S_CONTROL_MODE_16BIT, ++ val); ++ ++ /* Setup the irq periodicity */ ++ val = params_period_bytes(params) / fifo->fifo_block; ++ val = FIELD_PREP(AIU_MEM_I2S_MASKS_IRQ_BLOCK, val); ++ snd_soc_component_update_bits(component, AIU_MEM_I2S_MASKS, ++ AIU_MEM_I2S_MASKS_IRQ_BLOCK, val); ++ ++ return 0; ++} ++ ++const struct snd_soc_dai_ops aiu_fifo_i2s_dai_ops = { ++ .trigger = aiu_fifo_i2s_trigger, ++ .prepare = aiu_fifo_i2s_prepare, ++ .hw_params = aiu_fifo_i2s_hw_params, ++ .hw_free = aiu_fifo_hw_free, ++ .startup = aiu_fifo_startup, ++ .shutdown = aiu_fifo_shutdown, ++}; ++ ++int aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct aiu *aiu = snd_soc_component_get_drvdata(component); ++ struct aiu_fifo *fifo; ++ int ret; ++ ++ ret = aiu_fifo_dai_probe(dai); ++ if (ret) ++ return ret; ++ ++ fifo = dai->playback_dma_data; ++ ++ fifo->pcm = &fifo_i2s_pcm; ++ fifo->mem_offset = AIU_MEM_I2S_START; ++ fifo->fifo_block = AIU_FIFO_I2S_BLOCK; ++ fifo->pclk = aiu->i2s.clks[PCLK].clk; ++ fifo->irq = aiu->i2s.irq; ++ ++ return 0; ++} +diff --git a/sound/soc/meson/aiu-fifo-spdif.c b/sound/soc/meson/aiu-fifo-spdif.c +new file mode 100644 +index 000000000000..44eb6faacf44 +--- /dev/null ++++ b/sound/soc/meson/aiu-fifo-spdif.c +@@ -0,0 +1,186 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++ ++#include "aiu.h" ++#include "aiu-fifo.h" ++ ++#define AIU_IEC958_DCU_FF_CTRL_EN BIT(0) ++#define AIU_IEC958_DCU_FF_CTRL_AUTO_DISABLE BIT(1) ++#define AIU_IEC958_DCU_FF_CTRL_IRQ_MODE GENMASK(3, 2) ++#define AIU_IEC958_DCU_FF_CTRL_IRQ_OUT_THD BIT(2) ++#define AIU_IEC958_DCU_FF_CTRL_IRQ_FRAME_READ BIT(3) ++#define AIU_IEC958_DCU_FF_CTRL_SYNC_HEAD_EN BIT(4) ++#define AIU_IEC958_DCU_FF_CTRL_BYTE_SEEK BIT(5) ++#define AIU_IEC958_DCU_FF_CTRL_CONTINUE BIT(6) ++#define AIU_MEM_IEC958_CONTROL_ENDIAN GENMASK(5, 3) ++#define AIU_MEM_IEC958_CONTROL_RD_DDR BIT(6) ++#define AIU_MEM_IEC958_CONTROL_MODE_16BIT BIT(7) ++#define AIU_MEM_IEC958_CONTROL_MODE_LINEAR BIT(8) ++#define AIU_MEM_IEC958_BUF_CNTL_INIT BIT(0) ++ ++#define AIU_FIFO_SPDIF_BLOCK 8 ++ ++static struct snd_pcm_hardware fifo_spdif_pcm = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED | ++ SNDRV_PCM_INFO_MMAP | ++ SNDRV_PCM_INFO_MMAP_VALID | ++ SNDRV_PCM_INFO_PAUSE), ++ .formats = AIU_FORMATS, ++ .rate_min = 5512, ++ .rate_max = 192000, ++ .channels_min = 2, ++ .channels_max = 2, ++ .period_bytes_min = AIU_FIFO_SPDIF_BLOCK, ++ .period_bytes_max = AIU_FIFO_SPDIF_BLOCK * USHRT_MAX, ++ .periods_min = 2, ++ .periods_max = UINT_MAX, ++ ++ /* No real justification for this */ ++ .buffer_bytes_max = 1 * 1024 * 1024, ++}; ++ ++static void fifo_spdif_dcu_enable(struct snd_soc_component *component, ++ bool enable) ++{ ++ snd_soc_component_update_bits(component, AIU_IEC958_DCU_FF_CTRL, ++ AIU_IEC958_DCU_FF_CTRL_EN, ++ enable ? AIU_IEC958_DCU_FF_CTRL_EN : 0); ++} ++ ++static int fifo_spdif_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ int ret; ++ ++ ret = aiu_fifo_trigger(substream, cmd, dai); ++ if (ret) ++ return ret; ++ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ fifo_spdif_dcu_enable(component, true); ++ break; ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ case SNDRV_PCM_TRIGGER_STOP: ++ fifo_spdif_dcu_enable(component, false); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int fifo_spdif_prepare(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ int ret; ++ ++ ret = aiu_fifo_prepare(substream, dai); ++ if (ret) ++ return ret; ++ ++ snd_soc_component_update_bits(component, ++ AIU_MEM_IEC958_BUF_CNTL, ++ AIU_MEM_IEC958_BUF_CNTL_INIT, ++ AIU_MEM_IEC958_BUF_CNTL_INIT); ++ snd_soc_component_update_bits(component, ++ AIU_MEM_IEC958_BUF_CNTL, ++ AIU_MEM_IEC958_BUF_CNTL_INIT, 0); ++ ++ return 0; ++} ++ ++static int fifo_spdif_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ unsigned int val; ++ int ret; ++ ++ ret = aiu_fifo_hw_params(substream, params, dai); ++ if (ret) ++ return ret; ++ ++ val = AIU_MEM_IEC958_CONTROL_RD_DDR | ++ AIU_MEM_IEC958_CONTROL_MODE_LINEAR; ++ ++ switch (params_physical_width(params)) { ++ case 16: ++ val |= AIU_MEM_IEC958_CONTROL_MODE_16BIT; ++ break; ++ case 32: ++ break; ++ default: ++ dev_err(dai->dev, "Unsupported physical width %u\n", ++ params_physical_width(params)); ++ return -EINVAL; ++ } ++ ++ snd_soc_component_update_bits(component, AIU_MEM_IEC958_CONTROL, ++ AIU_MEM_IEC958_CONTROL_ENDIAN | ++ AIU_MEM_IEC958_CONTROL_RD_DDR | ++ AIU_MEM_IEC958_CONTROL_MODE_LINEAR | ++ AIU_MEM_IEC958_CONTROL_MODE_16BIT, ++ val); ++ ++ /* Number bytes read by the FIFO between each IRQ */ ++ snd_soc_component_write(component, AIU_IEC958_BPF, ++ params_period_bytes(params)); ++ ++ /* ++ * AUTO_DISABLE and SYNC_HEAD are enabled by default but ++ * this should be disabled in PCM (uncompressed) mode ++ */ ++ snd_soc_component_update_bits(component, AIU_IEC958_DCU_FF_CTRL, ++ AIU_IEC958_DCU_FF_CTRL_AUTO_DISABLE | ++ AIU_IEC958_DCU_FF_CTRL_IRQ_MODE | ++ AIU_IEC958_DCU_FF_CTRL_SYNC_HEAD_EN, ++ AIU_IEC958_DCU_FF_CTRL_IRQ_FRAME_READ); ++ ++ return 0; ++} ++ ++const struct snd_soc_dai_ops aiu_fifo_spdif_dai_ops = { ++ .trigger = fifo_spdif_trigger, ++ .prepare = fifo_spdif_prepare, ++ .hw_params = fifo_spdif_hw_params, ++ .hw_free = aiu_fifo_hw_free, ++ .startup = aiu_fifo_startup, ++ .shutdown = aiu_fifo_shutdown, ++}; ++ ++int aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct aiu *aiu = snd_soc_component_get_drvdata(component); ++ struct aiu_fifo *fifo; ++ int ret; ++ ++ ret = aiu_fifo_dai_probe(dai); ++ if (ret) ++ return ret; ++ ++ fifo = dai->playback_dma_data; ++ ++ fifo->pcm = &fifo_spdif_pcm; ++ fifo->mem_offset = AIU_MEM_IEC958_START; ++ fifo->fifo_block = 1; ++ fifo->pclk = aiu->spdif.clks[PCLK].clk; ++ fifo->irq = aiu->spdif.irq; ++ ++ return 0; ++} +diff --git a/sound/soc/meson/aiu-fifo.c b/sound/soc/meson/aiu-fifo.c +new file mode 100644 +index 000000000000..da8c098e8750 +--- /dev/null ++++ b/sound/soc/meson/aiu-fifo.c +@@ -0,0 +1,223 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "aiu-fifo.h" ++ ++#define AIU_MEM_START 0x00 ++#define AIU_MEM_RD 0x04 ++#define AIU_MEM_END 0x08 ++#define AIU_MEM_MASKS 0x0c ++#define AIU_MEM_MASK_CH_RD GENMASK(7, 0) ++#define AIU_MEM_MASK_CH_MEM GENMASK(15, 8) ++#define AIU_MEM_CONTROL 0x10 ++#define AIU_MEM_CONTROL_INIT BIT(0) ++#define AIU_MEM_CONTROL_FILL_EN BIT(1) ++#define AIU_MEM_CONTROL_EMPTY_EN BIT(2) ++ ++static struct snd_soc_dai *aiu_fifo_dai(struct snd_pcm_substream *ss) ++{ ++ struct snd_soc_pcm_runtime *rtd = ss->private_data; ++ ++ return rtd->cpu_dai; ++} ++ ++snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_dai *dai = aiu_fifo_dai(substream); ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ unsigned int addr; ++ ++ snd_soc_component_read(component, fifo->mem_offset + AIU_MEM_RD, ++ &addr); ++ ++ return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr); ++} ++ ++static void aiu_fifo_enable(struct snd_soc_dai *dai, bool enable) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ unsigned int en_mask = (AIU_MEM_CONTROL_FILL_EN | ++ AIU_MEM_CONTROL_EMPTY_EN); ++ ++ snd_soc_component_update_bits(component, ++ fifo->mem_offset + AIU_MEM_CONTROL, ++ en_mask, enable ? en_mask : 0); ++} ++ ++int aiu_fifo_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai) ++{ ++ switch (cmd) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ aiu_fifo_enable(dai, true); ++ break; ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ case SNDRV_PCM_TRIGGER_STOP: ++ aiu_fifo_enable(dai, false); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++int aiu_fifo_prepare(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ ++ snd_soc_component_update_bits(component, ++ fifo->mem_offset + AIU_MEM_CONTROL, ++ AIU_MEM_CONTROL_INIT, ++ AIU_MEM_CONTROL_INIT); ++ snd_soc_component_update_bits(component, ++ fifo->mem_offset + AIU_MEM_CONTROL, ++ AIU_MEM_CONTROL_INIT, 0); ++ return 0; ++} ++ ++int aiu_fifo_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ struct snd_soc_component *component = dai->component; ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ dma_addr_t end; ++ int ret; ++ ++ ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); ++ if (ret < 0) ++ return ret; ++ ++ /* Setup the fifo boundaries */ ++ end = runtime->dma_addr + runtime->dma_bytes - fifo->fifo_block; ++ snd_soc_component_write(component, fifo->mem_offset + AIU_MEM_START, ++ runtime->dma_addr); ++ snd_soc_component_write(component, fifo->mem_offset + AIU_MEM_RD, ++ runtime->dma_addr); ++ snd_soc_component_write(component, fifo->mem_offset + AIU_MEM_END, ++ end); ++ ++ /* Setup the fifo to read all the memory - no skip */ ++ snd_soc_component_update_bits(component, ++ fifo->mem_offset + AIU_MEM_MASKS, ++ AIU_MEM_MASK_CH_RD | AIU_MEM_MASK_CH_MEM, ++ FIELD_PREP(AIU_MEM_MASK_CH_RD, 0xff) | ++ FIELD_PREP(AIU_MEM_MASK_CH_MEM, 0xff)); ++ ++ return 0; ++} ++ ++int aiu_fifo_hw_free(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ return snd_pcm_lib_free_pages(substream); ++} ++ ++static irqreturn_t aiu_fifo_isr(int irq, void *dev_id) ++{ ++ struct snd_pcm_substream *playback = dev_id; ++ ++ snd_pcm_period_elapsed(playback); ++ ++ return IRQ_HANDLED; ++} ++ ++int aiu_fifo_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ int ret; ++ ++ snd_soc_set_runtime_hwparams(substream, fifo->pcm); ++ ++ /* ++ * Make sure the buffer and period size are multiple of the fifo burst ++ * size ++ */ ++ ret = snd_pcm_hw_constraint_step(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, ++ fifo->fifo_block); ++ if (ret) ++ return ret; ++ ++ ret = snd_pcm_hw_constraint_step(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, ++ fifo->fifo_block); ++ if (ret) ++ return ret; ++ ++ ret = clk_prepare_enable(fifo->pclk); ++ if (ret) ++ return ret; ++ ++ ret = request_irq(fifo->irq, aiu_fifo_isr, 0, dev_name(dai->dev), ++ substream); ++ if (ret) ++ clk_disable_unprepare(fifo->pclk); ++ ++ return ret; ++} ++ ++void aiu_fifo_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ ++ free_irq(fifo->irq, substream); ++ clk_disable_unprepare(fifo->pclk); ++} ++ ++int aiu_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_pcm_substream *substream = ++ rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; ++ struct snd_card *card = rtd->card->snd_card; ++ struct aiu_fifo *fifo = dai->playback_dma_data; ++ size_t size = fifo->pcm->buffer_bytes_max; ++ ++ snd_pcm_lib_preallocate_pages(substream, ++ SNDRV_DMA_TYPE_DEV, ++ card->dev, size, size); ++ ++ return 0; ++} ++ ++int aiu_fifo_dai_probe(struct snd_soc_dai *dai) ++{ ++ struct aiu_fifo *fifo; ++ ++ fifo = kzalloc(sizeof(*fifo), GFP_KERNEL); ++ if (!fifo) ++ return -ENOMEM; ++ ++ dai->playback_dma_data = fifo; ++ ++ return 0; ++} ++ ++int aiu_fifo_dai_remove(struct snd_soc_dai *dai) ++{ ++ kfree(dai->playback_dma_data); ++ ++ return 0; ++} ++ +diff --git a/sound/soc/meson/aiu-fifo.h b/sound/soc/meson/aiu-fifo.h +new file mode 100644 +index 000000000000..42ce266677cc +--- /dev/null ++++ b/sound/soc/meson/aiu-fifo.h +@@ -0,0 +1,50 @@ ++/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ ++/* ++ * Copyright (c) 2020 BayLibre, SAS. ++ * Author: Jerome Brunet ++ */ ++ ++#ifndef _MESON_AIU_FIFO_H ++#define _MESON_AIU_FIFO_H ++ ++struct snd_pcm_hardware; ++struct snd_soc_component_driver; ++struct snd_soc_dai_driver; ++struct clk; ++struct snd_pcm_ops; ++struct snd_pcm_substream; ++struct snd_soc_dai; ++struct snd_pcm_hw_params; ++struct platform_device; ++ ++struct aiu_fifo { ++ struct snd_pcm_hardware *pcm; ++ unsigned int mem_offset; ++ unsigned int fifo_block; ++ struct clk *pclk; ++ int irq; ++}; ++ ++int aiu_fifo_dai_probe(struct snd_soc_dai *dai); ++int aiu_fifo_dai_remove(struct snd_soc_dai *dai); ++ ++snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component, ++ struct snd_pcm_substream *substream); ++ ++int aiu_fifo_trigger(struct snd_pcm_substream *substream, int cmd, ++ struct snd_soc_dai *dai); ++int aiu_fifo_prepare(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai); ++int aiu_fifo_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai); ++int aiu_fifo_hw_free(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai); ++int aiu_fifo_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai); ++void aiu_fifo_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai); ++int aiu_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, ++ struct snd_soc_dai *dai); ++ ++#endif /* _MESON_AIU_FIFO_H */ +diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c +new file mode 100644 +index 000000000000..a62aced9b687 +--- /dev/null ++++ b/sound/soc/meson/aiu.c +@@ -0,0 +1,348 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "aiu.h" ++#include "aiu-fifo.h" ++ ++#define AIU_I2S_MISC_958_SRC_SHIFT 3 ++ ++static const char * const aiu_spdif_encode_sel_texts[] = { ++ "SPDIF", "I2S", ++}; ++ ++static SOC_ENUM_SINGLE_DECL(aiu_spdif_encode_sel_enum, AIU_I2S_MISC, ++ AIU_I2S_MISC_958_SRC_SHIFT, ++ aiu_spdif_encode_sel_texts); ++ ++static const struct snd_kcontrol_new aiu_spdif_encode_mux = ++ SOC_DAPM_ENUM("SPDIF Buffer Src", aiu_spdif_encode_sel_enum); ++ ++static const struct snd_soc_dapm_widget aiu_cpu_dapm_widgets[] = { ++ SND_SOC_DAPM_MUX("SPDIF SRC SEL", SND_SOC_NOPM, 0, 0, ++ &aiu_spdif_encode_mux), ++}; ++ ++static const struct snd_soc_dapm_route aiu_cpu_dapm_routes[] = { ++ { "I2S Encoder Playback", NULL, "I2S FIFO Playback" }, ++ { "SPDIF SRC SEL", "SPDIF", "SPDIF FIFO Playback" }, ++ { "SPDIF SRC SEL", "I2S", "I2S FIFO Playback" }, ++ { "SPDIF Encoder Playback", NULL, "SPDIF SRC SEL" }, ++}; ++ ++int aiu_of_xlate_dai_name(struct snd_soc_component *component, ++ struct of_phandle_args *args, ++ const char **dai_name, ++ unsigned int component_id) ++{ ++ struct snd_soc_dai *dai; ++ int id; ++ ++ if (args->args_count != 2) ++ return -EINVAL; ++ ++ if (args->args[0] != component_id) ++ return -EINVAL; ++ ++ id = args->args[1]; ++ ++ if (id < 0 || id >= component->num_dai) ++ return -EINVAL; ++ ++ for_each_component_dais(component, dai) { ++ if (id == 0) ++ break; ++ id--; ++ } ++ ++ *dai_name = dai->driver->name; ++ ++ return 0; ++} ++ ++static int aiu_cpu_of_xlate_dai_name(struct snd_soc_component *component, ++ struct of_phandle_args *args, ++ const char **dai_name) ++{ ++ return aiu_of_xlate_dai_name(component, args, dai_name, AIU_CPU); ++} ++ ++static int aiu_cpu_component_probe(struct snd_soc_component *component) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(component); ++ ++ /* Required for the SPDIF Source control operation */ ++ return clk_prepare_enable(aiu->i2s.clks[PCLK].clk); ++} ++ ++static void aiu_cpu_component_remove(struct snd_soc_component *component) ++{ ++ struct aiu *aiu = snd_soc_component_get_drvdata(component); ++ ++ clk_disable_unprepare(aiu->i2s.clks[PCLK].clk); ++} ++ ++static const struct snd_soc_component_driver aiu_cpu_component = { ++ .name = "AIU CPU", ++ .dapm_widgets = aiu_cpu_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(aiu_cpu_dapm_widgets), ++ .dapm_routes = aiu_cpu_dapm_routes, ++ .num_dapm_routes = ARRAY_SIZE(aiu_cpu_dapm_routes), ++ .of_xlate_dai_name = aiu_cpu_of_xlate_dai_name, ++ .pointer = aiu_fifo_pointer, ++ .probe = aiu_cpu_component_probe, ++ .remove = aiu_cpu_component_remove, ++}; ++ ++static struct snd_soc_dai_driver aiu_cpu_dai_drv[] = { ++ [CPU_I2S_FIFO] = { ++ .name = "I2S FIFO", ++ .playback = { ++ .stream_name = "I2S FIFO Playback", ++ .channels_min = 2, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .rate_min = 5512, ++ .rate_max = 192000, ++ .formats = AIU_FORMATS, ++ }, ++ .ops = &aiu_fifo_i2s_dai_ops, ++ .pcm_new = aiu_fifo_pcm_new, ++ .probe = aiu_fifo_i2s_dai_probe, ++ .remove = aiu_fifo_dai_remove, ++ }, ++ [CPU_SPDIF_FIFO] = { ++ .name = "SPDIF FIFO", ++ .playback = { ++ .stream_name = "SPDIF FIFO Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .rate_min = 5512, ++ .rate_max = 192000, ++ .formats = AIU_FORMATS, ++ }, ++ .ops = &aiu_fifo_spdif_dai_ops, ++ .pcm_new = aiu_fifo_pcm_new, ++ .probe = aiu_fifo_spdif_dai_probe, ++ .remove = aiu_fifo_dai_remove, ++ }, ++ [CPU_I2S_ENCODER] = { ++ .name = "I2S Encoder", ++ .playback = { ++ .stream_name = "I2S Encoder Playback", ++ .channels_min = 2, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = AIU_FORMATS, ++ }, ++ .ops = &aiu_encoder_i2s_dai_ops, ++ }, ++ [CPU_SPDIF_ENCODER] = { ++ .name = "SPDIF Encoder", ++ .playback = { ++ .stream_name = "SPDIF Encoder Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = (SNDRV_PCM_RATE_32000 | ++ SNDRV_PCM_RATE_44100 | ++ SNDRV_PCM_RATE_48000 | ++ SNDRV_PCM_RATE_88200 | ++ SNDRV_PCM_RATE_96000 | ++ SNDRV_PCM_RATE_176400 | ++ SNDRV_PCM_RATE_192000), ++ .formats = AIU_FORMATS, ++ }, ++ .ops = &aiu_encoder_spdif_dai_ops, ++ } ++}; ++ ++static const struct regmap_config aiu_regmap_cfg = { ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++ .max_register = 0x2ac, ++}; ++ ++static int aiu_clk_bulk_get(struct device *dev, ++ const char * const *ids, ++ unsigned int num, ++ struct aiu_interface *interface) ++{ ++ struct clk_bulk_data *clks; ++ int i, ret; ++ ++ clks = devm_kcalloc(dev, num, sizeof(clks), GFP_KERNEL); ++ if (!clks) ++ return -ENOMEM; ++ ++ for (i = 0; i < num; i++) ++ clks[i].id = ids[i]; ++ ++ ret = devm_clk_bulk_get(dev, num, clks); ++ if (ret < 0) ++ return ret; ++ ++ interface->clks = clks; ++ interface->clk_num = num; ++ return 0; ++} ++ ++static const char * const aiu_i2s_ids[] = { ++ [PCLK] = "i2s_pclk", ++ [AOCLK] = "i2s_aoclk", ++ [MCLK] = "i2s_mclk", ++ [MIXER] = "i2s_mixer", ++}; ++ ++static const char * const aiu_spdif_ids[] = { ++ [PCLK] = "spdif_pclk", ++ [AOCLK] = "spdif_aoclk", ++ [MCLK] = "spdif_mclk_sel" ++}; ++ ++static int aiu_clk_get(struct device *dev) ++{ ++ struct aiu *aiu = dev_get_drvdata(dev); ++ int ret; ++ ++ aiu->pclk = devm_clk_get(dev, "pclk"); ++ if (IS_ERR(aiu->pclk)) { ++ if (PTR_ERR(aiu->pclk) != -EPROBE_DEFER) ++ dev_err(dev, "Can't get the aiu pclk\n"); ++ return PTR_ERR(aiu->pclk); ++ } ++ ++ aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk"); ++ if (IS_ERR(aiu->spdif_mclk)) { ++ if (PTR_ERR(aiu->spdif_mclk) != -EPROBE_DEFER) ++ dev_err(dev, "Can't get the aiu spdif master clock\n"); ++ return PTR_ERR(aiu->spdif_mclk); ++ } ++ ++ ret = aiu_clk_bulk_get(dev, aiu_i2s_ids, ARRAY_SIZE(aiu_i2s_ids), ++ &aiu->i2s); ++ if (ret) { ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Can't get the i2s clocks\n"); ++ return ret; ++ } ++ ++ ret = aiu_clk_bulk_get(dev, aiu_spdif_ids, ARRAY_SIZE(aiu_spdif_ids), ++ &aiu->spdif); ++ if (ret) { ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Can't get the spdif clocks\n"); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(aiu->pclk); ++ if (ret) { ++ dev_err(dev, "peripheral clock enable failed\n"); ++ return ret; ++ } ++ ++ ret = devm_add_action_or_reset(dev, ++ (void(*)(void *))clk_disable_unprepare, ++ aiu->pclk); ++ if (ret) ++ dev_err(dev, "failed to add reset action on pclk"); ++ ++ return ret; ++} ++ ++static int aiu_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ void __iomem *regs; ++ struct regmap *map; ++ struct aiu *aiu; ++ int ret; ++ ++ aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL); ++ if (!aiu) ++ return -ENOMEM; ++ platform_set_drvdata(pdev, aiu); ++ ++ ret = device_reset(dev); ++ if (ret) { ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Failed to reset device\n"); ++ return ret; ++ } ++ ++ regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(regs)) ++ return PTR_ERR(regs); ++ ++ map = devm_regmap_init_mmio(dev, regs, &aiu_regmap_cfg); ++ if (IS_ERR(map)) { ++ dev_err(dev, "failed to init regmap: %ld\n", ++ PTR_ERR(map)); ++ return PTR_ERR(map); ++ } ++ ++ aiu->i2s.irq = platform_get_irq_byname(pdev, "i2s"); ++ if (aiu->i2s.irq < 0) { ++ dev_err(dev, "Can't get i2s irq\n"); ++ return aiu->i2s.irq; ++ } ++ ++ aiu->spdif.irq = platform_get_irq_byname(pdev, "spdif"); ++ if (aiu->spdif.irq < 0) { ++ dev_err(dev, "Can't get spdif irq\n"); ++ return aiu->spdif.irq; ++ } ++ ++ ret = aiu_clk_get(dev); ++ if (ret) ++ return ret; ++ ++ /* Register the cpu component of the aiu */ ++ ret = snd_soc_register_component(dev, &aiu_cpu_component, ++ aiu_cpu_dai_drv, ++ ARRAY_SIZE(aiu_cpu_dai_drv)); ++ if (ret) ++ dev_err(dev, "Failed to register cpu component\n"); ++ ++ return ret; ++} ++ ++static int aiu_remove(struct platform_device *pdev) ++{ ++ snd_soc_unregister_component(&pdev->dev); ++ ++ return 0; ++} ++ ++static const struct of_device_id aiu_of_match[] = { ++ { .compatible = "amlogic,aiu-gxbb", }, ++ { .compatible = "amlogic,aiu-gxl", }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, aiu_of_match); ++ ++static struct platform_driver aiu_pdrv = { ++ .probe = aiu_probe, ++ .remove = aiu_remove, ++ .driver = { ++ .name = "meson-aiu", ++ .of_match_table = aiu_of_match, ++ }, ++}; ++module_platform_driver(aiu_pdrv); ++ ++MODULE_DESCRIPTION("Meson AIU Driver"); ++MODULE_AUTHOR("Jerome Brunet "); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h +new file mode 100644 +index 000000000000..a3488027b9d5 +--- /dev/null ++++ b/sound/soc/meson/aiu.h +@@ -0,0 +1,82 @@ ++/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ ++/* ++ * Copyright (c) 2018 BayLibre, SAS. ++ * Author: Jerome Brunet ++ */ ++ ++#ifndef _MESON_AIU_H ++#define _MESON_AIU_H ++ ++struct clk; ++struct clk_bulk_data; ++struct device; ++struct of_phandle_args; ++struct snd_soc_component_driver; ++struct snd_soc_dai; ++struct snd_soc_dai_driver; ++struct snd_soc_dai_ops; ++ ++enum aiu_clk_ids { ++ PCLK = 0, ++ AOCLK, ++ MCLK, ++ MIXER ++}; ++ ++struct aiu_interface { ++ struct clk_bulk_data *clks; ++ unsigned int clk_num; ++ unsigned int irq; ++}; ++ ++struct aiu { ++ struct clk *pclk; ++ struct clk *spdif_mclk; ++ struct aiu_interface i2s; ++ struct aiu_interface spdif; ++}; ++ ++#define AIU_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ ++ SNDRV_PCM_FMTBIT_S20_LE | \ ++ SNDRV_PCM_FMTBIT_S24_LE) ++ ++int aiu_of_xlate_dai_name(struct snd_soc_component *component, ++ struct of_phandle_args *args, ++ const char **dai_name, ++ unsigned int component_id); ++ ++int aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai); ++int aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai); ++ ++extern const struct snd_soc_dai_ops aiu_fifo_i2s_dai_ops; ++extern const struct snd_soc_dai_ops aiu_fifo_spdif_dai_ops; ++extern const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops; ++extern const struct snd_soc_dai_ops aiu_encoder_spdif_dai_ops; ++ ++#define AIU_IEC958_BPF 0x000 ++#define AIU_958_MISC 0x010 ++#define AIU_IEC958_DCU_FF_CTRL 0x01c ++#define AIU_958_CHSTAT_L0 0x020 ++#define AIU_958_CHSTAT_L1 0x024 ++#define AIU_958_CTRL 0x028 ++#define AIU_I2S_SOURCE_DESC 0x034 ++#define AIU_I2S_DAC_CFG 0x040 ++#define AIU_I2S_SYNC 0x044 ++#define AIU_I2S_MISC 0x048 ++#define AIU_RST_SOFT 0x054 ++#define AIU_CLK_CTRL 0x058 ++#define AIU_CLK_CTRL_MORE 0x064 ++#define AIU_CODEC_DAC_LRCLK_CTRL 0x0a0 ++#define AIU_HDMI_CLK_DATA_CTRL 0x0a8 ++#define AIU_ACODEC_CTRL 0x0b0 ++#define AIU_958_CHSTAT_R0 0x0c0 ++#define AIU_958_CHSTAT_R1 0x0c4 ++#define AIU_MEM_I2S_START 0x180 ++#define AIU_MEM_I2S_MASKS 0x18c ++#define AIU_MEM_I2S_CONTROL 0x190 ++#define AIU_MEM_IEC958_START 0x194 ++#define AIU_MEM_IEC958_CONTROL 0x1a4 ++#define AIU_MEM_I2S_BUF_CNTL 0x1d8 ++#define AIU_MEM_IEC958_BUF_CNTL 0x1fc ++ ++#endif /* _MESON_AIU_H */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-clk-meson-add-g12a-cpu-dynamic-divider-drive.patch b/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-clk-meson-add-g12a-cpu-dynamic-divider-drive.patch deleted file mode 100644 index 834f29fe13..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-clk-meson-add-g12a-cpu-dynamic-divider-drive.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 4cd3b8d3e92cadcddcd4e2fb0d14b8f4b04eb176 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 31 Jul 2019 10:40:17 +0200 -Subject: [PATCH 016/187] FROMGIT: clk: meson: add g12a cpu dynamic divider - driver - -Add a clock driver for the cpu dynamic divider, this divider needs -to have a flag set before setting the divider value then removed -while writing the new value to the register. - -This drivers implements this behavior and will be used essentially -on the Amlogic G12A and G12B SoCs for cpu clock trees. - -Signed-off-by: Neil Armstrong -Reviewed-by: Martin Blumenstingl -Signed-off-by: Jerome Brunet -(cherry picked from commit 26d34431add04a98a60b8935c25765914fa773f7 - https://github.com/BayLibre/clk-meson v5.4/drivers) ---- - drivers/clk/meson/Kconfig | 5 ++ - drivers/clk/meson/Makefile | 1 + - drivers/clk/meson/clk-cpu-dyndiv.c | 73 ++++++++++++++++++++++++++++++ - drivers/clk/meson/clk-cpu-dyndiv.h | 20 ++++++++ - 4 files changed, 99 insertions(+) - create mode 100644 drivers/clk/meson/clk-cpu-dyndiv.c - create mode 100644 drivers/clk/meson/clk-cpu-dyndiv.h - -diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig -index 500be0b0d473..dabeb435d067 100644 ---- a/drivers/clk/meson/Kconfig -+++ b/drivers/clk/meson/Kconfig -@@ -36,6 +36,10 @@ config COMMON_CLK_MESON_EE_CLKC - tristate - select COMMON_CLK_MESON_REGMAP - -+config COMMON_CLK_MESON_CPU_DYNDIV -+ tristate -+ select COMMON_CLK_MESON_REGMAP -+ - config COMMON_CLK_MESON8B - bool - depends on ARCH_MESON -@@ -98,6 +102,7 @@ config COMMON_CLK_G12A - select COMMON_CLK_MESON_PLL - select COMMON_CLK_MESON_AO_CLKC - select COMMON_CLK_MESON_EE_CLKC -+ select COMMON_CLK_MESON_CPU_DYNDIV - select MFD_SYSCON - help - Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2 -diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile -index f09d83dc3d60..3939f218587a 100644 ---- a/drivers/clk/meson/Makefile -+++ b/drivers/clk/meson/Makefile -@@ -2,6 +2,7 @@ - # Amlogic clock drivers - - obj-$(CONFIG_COMMON_CLK_MESON_AO_CLKC) += meson-aoclk.o -+obj-$(CONFIG_COMMON_CLK_MESON_CPU_DYNDIV) += clk-cpu-dyndiv.o - obj-$(CONFIG_COMMON_CLK_MESON_DUALDIV) += clk-dualdiv.o - obj-$(CONFIG_COMMON_CLK_MESON_EE_CLKC) += meson-eeclk.o - obj-$(CONFIG_COMMON_CLK_MESON_MPLL) += clk-mpll.o -diff --git a/drivers/clk/meson/clk-cpu-dyndiv.c b/drivers/clk/meson/clk-cpu-dyndiv.c -new file mode 100644 -index 000000000000..36976927fe82 ---- /dev/null -+++ b/drivers/clk/meson/clk-cpu-dyndiv.c -@@ -0,0 +1,73 @@ -+// SPDX-License-Identifier: (GPL-2.0 OR MIT) -+/* -+ * Copyright (c) 2019 BayLibre, SAS. -+ * Author: Neil Armstrong -+ */ -+ -+#include -+#include -+ -+#include "clk-regmap.h" -+#include "clk-cpu-dyndiv.h" -+ -+static inline struct meson_clk_cpu_dyndiv_data * -+meson_clk_cpu_dyndiv_data(struct clk_regmap *clk) -+{ -+ return (struct meson_clk_cpu_dyndiv_data *)clk->data; -+} -+ -+static unsigned long meson_clk_cpu_dyndiv_recalc_rate(struct clk_hw *hw, -+ unsigned long prate) -+{ -+ struct clk_regmap *clk = to_clk_regmap(hw); -+ struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk); -+ -+ return divider_recalc_rate(hw, prate, -+ meson_parm_read(clk->map, &data->div), -+ NULL, 0, data->div.width); -+} -+ -+static long meson_clk_cpu_dyndiv_round_rate(struct clk_hw *hw, -+ unsigned long rate, -+ unsigned long *prate) -+{ -+ struct clk_regmap *clk = to_clk_regmap(hw); -+ struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk); -+ -+ return divider_round_rate(hw, rate, prate, NULL, data->div.width, 0); -+} -+ -+static int meson_clk_cpu_dyndiv_set_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long parent_rate) -+{ -+ struct clk_regmap *clk = to_clk_regmap(hw); -+ struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk); -+ unsigned int val; -+ int ret; -+ -+ ret = divider_get_val(rate, parent_rate, NULL, data->div.width, 0); -+ if (ret < 0) -+ return ret; -+ -+ val = (unsigned int)ret << data->div.shift; -+ -+ /* Write the SYS_CPU_DYN_ENABLE bit before changing the divider */ -+ meson_parm_write(clk->map, &data->dyn, 1); -+ -+ /* Update the divider while removing the SYS_CPU_DYN_ENABLE bit */ -+ return regmap_update_bits(clk->map, data->div.reg_off, -+ SETPMASK(data->div.width, data->div.shift) | -+ SETPMASK(data->dyn.width, data->dyn.shift), -+ val); -+}; -+ -+const struct clk_ops meson_clk_cpu_dyndiv_ops = { -+ .recalc_rate = meson_clk_cpu_dyndiv_recalc_rate, -+ .round_rate = meson_clk_cpu_dyndiv_round_rate, -+ .set_rate = meson_clk_cpu_dyndiv_set_rate, -+}; -+EXPORT_SYMBOL_GPL(meson_clk_cpu_dyndiv_ops); -+ -+MODULE_DESCRIPTION("Amlogic CPU Dynamic Clock divider"); -+MODULE_AUTHOR("Neil Armstrong "); -+MODULE_LICENSE("GPL v2"); -diff --git a/drivers/clk/meson/clk-cpu-dyndiv.h b/drivers/clk/meson/clk-cpu-dyndiv.h -new file mode 100644 -index 000000000000..f4908404792e ---- /dev/null -+++ b/drivers/clk/meson/clk-cpu-dyndiv.h -@@ -0,0 +1,20 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+/* -+ * Copyright (c) 2019 BayLibre, SAS. -+ * Author: Neil Armstrong -+ */ -+ -+#ifndef __MESON_CLK_CPU_DYNDIV_H -+#define __MESON_CLK_CPU_DYNDIV_H -+ -+#include -+#include "parm.h" -+ -+struct meson_clk_cpu_dyndiv_data { -+ struct parm div; -+ struct parm dyn; -+}; -+ -+extern const struct clk_ops meson_clk_cpu_dyndiv_ops; -+ -+#endif /* __MESON_CLK_CPU_DYNDIV_H */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-ASoC-meson-aiu-add-hdmi-codec-control-suppor.patch b/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-ASoC-meson-aiu-add-hdmi-codec-control-suppor.patch new file mode 100644 index 0000000000..e3f79a62d5 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-ASoC-meson-aiu-add-hdmi-codec-control-suppor.patch @@ -0,0 +1,281 @@ +From b31b05925df0a3fd7041e3263f033a4621cd0d55 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:55 +0100 +Subject: [PATCH 017/146] FROMGIT: ASoC: meson: aiu: add hdmi codec control + support + +Add the codec to codec component which handles the routing between +the audio producers (PCM and I2S) and the synopsys hdmi controller +on the amlogic GX SoC family + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/Kconfig | 2 + + sound/soc/meson/Makefile | 1 + + sound/soc/meson/aiu-codec-ctrl.c | 152 +++++++++++++++++++++++++++++++ + sound/soc/meson/aiu.c | 34 ++++++- + sound/soc/meson/aiu.h | 8 ++ + 5 files changed, 196 insertions(+), 1 deletion(-) + create mode 100644 sound/soc/meson/aiu-codec-ctrl.c + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index ca269dedfc7f..19de97ae4ce9 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -4,7 +4,9 @@ menu "ASoC support for Amlogic platforms" + + config SND_MESON_AIU + tristate "Amlogic AIU" ++ select SND_MESON_CODEC_GLUE + select SND_PCM_IEC958 ++ imply SND_SOC_HDMI_CODEC if DRM_MESON_DW_HDMI + help + Select Y or M to add support for the Audio output subsystem found + in the Amlogic GX SoC family +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index a7b79d717288..3b21f648e322 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: (GPL-2.0 OR MIT) + + snd-soc-meson-aiu-objs := aiu.o ++snd-soc-meson-aiu-objs += aiu-codec-ctrl.o + snd-soc-meson-aiu-objs += aiu-encoder-i2s.o + snd-soc-meson-aiu-objs += aiu-encoder-spdif.o + snd-soc-meson-aiu-objs += aiu-fifo.o +diff --git a/sound/soc/meson/aiu-codec-ctrl.c b/sound/soc/meson/aiu-codec-ctrl.c +new file mode 100644 +index 000000000000..8646a953e3b3 +--- /dev/null ++++ b/sound/soc/meson/aiu-codec-ctrl.c +@@ -0,0 +1,152 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include "aiu.h" ++#include "meson-codec-glue.h" ++ ++#define CTRL_CLK_SEL GENMASK(1, 0) ++#define CTRL_DATA_SEL_SHIFT 4 ++#define CTRL_DATA_SEL (0x3 << CTRL_DATA_SEL_SHIFT) ++ ++static const char * const aiu_codec_ctrl_mux_texts[] = { ++ "DISABLED", "PCM", "I2S", ++}; ++ ++static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_component *component = ++ snd_soc_dapm_kcontrol_component(kcontrol); ++ struct snd_soc_dapm_context *dapm = ++ snd_soc_dapm_kcontrol_dapm(kcontrol); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int mux, changed; ++ ++ mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); ++ changed = snd_soc_component_test_bits(component, e->reg, ++ CTRL_DATA_SEL, ++ FIELD_PREP(CTRL_DATA_SEL, mux)); ++ ++ if (!changed) ++ return 0; ++ ++ /* Force disconnect of the mux while updating */ ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); ++ ++ /* Reset the source first */ ++ snd_soc_component_update_bits(component, e->reg, ++ CTRL_CLK_SEL | ++ CTRL_DATA_SEL, ++ FIELD_PREP(CTRL_CLK_SEL, 0) | ++ FIELD_PREP(CTRL_DATA_SEL, 0)); ++ ++ /* Set the appropriate source */ ++ snd_soc_component_update_bits(component, e->reg, ++ CTRL_CLK_SEL | ++ CTRL_DATA_SEL, ++ FIELD_PREP(CTRL_CLK_SEL, mux) | ++ FIELD_PREP(CTRL_DATA_SEL, mux)); ++ ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ ++ return 0; ++} ++ ++static SOC_ENUM_SINGLE_DECL(aiu_hdmi_ctrl_mux_enum, AIU_HDMI_CLK_DATA_CTRL, ++ CTRL_DATA_SEL_SHIFT, ++ aiu_codec_ctrl_mux_texts); ++ ++static const struct snd_kcontrol_new aiu_hdmi_ctrl_mux = ++ SOC_DAPM_ENUM_EXT("HDMI Source", aiu_hdmi_ctrl_mux_enum, ++ snd_soc_dapm_get_enum_double, ++ aiu_codec_ctrl_mux_put_enum); ++ ++static const struct snd_soc_dapm_widget aiu_hdmi_ctrl_widgets[] = { ++ SND_SOC_DAPM_MUX("HDMI CTRL SRC", SND_SOC_NOPM, 0, 0, ++ &aiu_hdmi_ctrl_mux), ++}; ++ ++static const struct snd_soc_dai_ops aiu_codec_ctrl_input_ops = { ++ .hw_params = meson_codec_glue_input_hw_params, ++ .set_fmt = meson_codec_glue_input_set_fmt, ++}; ++ ++static const struct snd_soc_dai_ops aiu_codec_ctrl_output_ops = { ++ .startup = meson_codec_glue_output_startup, ++}; ++ ++#define AIU_CODEC_CTRL_FORMATS \ ++ (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ ++ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE | \ ++ SNDRV_PCM_FMTBIT_S32_LE) ++ ++#define AIU_CODEC_CTRL_STREAM(xname, xsuffix) \ ++{ \ ++ .stream_name = xname " " xsuffix, \ ++ .channels_min = 1, \ ++ .channels_max = 8, \ ++ .rate_min = 5512, \ ++ .rate_max = 192000, \ ++ .formats = AIU_CODEC_CTRL_FORMATS, \ ++} ++ ++#define AIU_CODEC_CTRL_INPUT(xname) { \ ++ .name = "CODEC CTRL " xname, \ ++ .playback = AIU_CODEC_CTRL_STREAM(xname, "Playback"), \ ++ .ops = &aiu_codec_ctrl_input_ops, \ ++ .probe = meson_codec_glue_input_dai_probe, \ ++ .remove = meson_codec_glue_input_dai_remove, \ ++} ++ ++#define AIU_CODEC_CTRL_OUTPUT(xname) { \ ++ .name = "CODEC CTRL " xname, \ ++ .capture = AIU_CODEC_CTRL_STREAM(xname, "Capture"), \ ++ .ops = &aiu_codec_ctrl_output_ops, \ ++} ++ ++static struct snd_soc_dai_driver aiu_hdmi_ctrl_dai_drv[] = { ++ [CTRL_I2S] = AIU_CODEC_CTRL_INPUT("HDMI I2S IN"), ++ [CTRL_PCM] = AIU_CODEC_CTRL_INPUT("HDMI PCM IN"), ++ [CTRL_OUT] = AIU_CODEC_CTRL_OUTPUT("HDMI OUT"), ++}; ++ ++static const struct snd_soc_dapm_route aiu_hdmi_ctrl_routes[] = { ++ { "HDMI CTRL SRC", "I2S", "HDMI I2S IN Playback" }, ++ { "HDMI CTRL SRC", "PCM", "HDMI PCM IN Playback" }, ++ { "HDMI OUT Capture", NULL, "HDMI CTRL SRC" }, ++}; ++ ++static int aiu_hdmi_of_xlate_dai_name(struct snd_soc_component *component, ++ struct of_phandle_args *args, ++ const char **dai_name) ++{ ++ return aiu_of_xlate_dai_name(component, args, dai_name, AIU_HDMI); ++} ++ ++static const struct snd_soc_component_driver aiu_hdmi_ctrl_component = { ++ .name = "AIU HDMI Codec Control", ++ .dapm_widgets = aiu_hdmi_ctrl_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(aiu_hdmi_ctrl_widgets), ++ .dapm_routes = aiu_hdmi_ctrl_routes, ++ .num_dapm_routes = ARRAY_SIZE(aiu_hdmi_ctrl_routes), ++ .of_xlate_dai_name = aiu_hdmi_of_xlate_dai_name, ++ .endianness = 1, ++ .non_legacy_dai_naming = 1, ++}; ++ ++int aiu_hdmi_ctrl_register_component(struct device *dev) ++{ ++ return aiu_add_component(dev, &aiu_hdmi_ctrl_component, ++ aiu_hdmi_ctrl_dai_drv, ++ ARRAY_SIZE(aiu_hdmi_ctrl_dai_drv), ++ "hdmi"); ++} ++ +diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c +index a62aced9b687..b765dfb70726 100644 +--- a/sound/soc/meson/aiu.c ++++ b/sound/soc/meson/aiu.c +@@ -71,6 +71,26 @@ int aiu_of_xlate_dai_name(struct snd_soc_component *component, + return 0; + } + ++int aiu_add_component(struct device *dev, ++ const struct snd_soc_component_driver *component_driver, ++ struct snd_soc_dai_driver *dai_drv, ++ int num_dai, ++ const char *debugfs_prefix) ++{ ++ struct snd_soc_component *component; ++ ++ component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); ++ if (!component) ++ return -ENOMEM; ++ ++#ifdef CONFIG_DEBUG_FS ++ component->debugfs_prefix = debugfs_prefix; ++#endif ++ ++ return snd_soc_add_component(dev, component, component_driver, ++ dai_drv, num_dai); ++} ++ + static int aiu_cpu_of_xlate_dai_name(struct snd_soc_component *component, + struct of_phandle_args *args, + const char **dai_name) +@@ -313,9 +333,21 @@ static int aiu_probe(struct platform_device *pdev) + ret = snd_soc_register_component(dev, &aiu_cpu_component, + aiu_cpu_dai_drv, + ARRAY_SIZE(aiu_cpu_dai_drv)); +- if (ret) ++ if (ret) { + dev_err(dev, "Failed to register cpu component\n"); ++ return ret; ++ } + ++ /* Register the hdmi codec control component */ ++ ret = aiu_hdmi_ctrl_register_component(dev); ++ if (ret) { ++ dev_err(dev, "Failed to register hdmi control component\n"); ++ goto err; ++ } ++ ++ return 0; ++err: ++ snd_soc_unregister_component(dev); + return ret; + } + +diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h +index a3488027b9d5..9242ab1ab64b 100644 +--- a/sound/soc/meson/aiu.h ++++ b/sound/soc/meson/aiu.h +@@ -45,6 +45,14 @@ int aiu_of_xlate_dai_name(struct snd_soc_component *component, + const char **dai_name, + unsigned int component_id); + ++int aiu_add_component(struct device *dev, ++ const struct snd_soc_component_driver *component_driver, ++ struct snd_soc_dai_driver *dai_drv, ++ int num_dai, ++ const char *debugfs_prefix); ++ ++int aiu_hdmi_ctrl_register_component(struct device *dev); ++ + int aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai); + int aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai); + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-clk-meson-g12a-add-notifiers-to-handle-cpu-c.patch b/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-clk-meson-g12a-add-notifiers-to-handle-cpu-c.patch deleted file mode 100644 index 6cd721b0a2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-clk-meson-g12a-add-notifiers-to-handle-cpu-c.patch +++ /dev/null @@ -1,872 +0,0 @@ -From 077c45ac06c1258147bdee852a5efbe57eaea493 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 31 Jul 2019 10:40:18 +0200 -Subject: [PATCH 017/187] FROMGIT: clk: meson: g12a: add notifiers to handle - cpu clock change - -In order to implement clock switching for the CLKID_CPU_CLK and -CLKID_CPUB_CLK, notifiers are added on specific points of the -clock tree : - -cpu_clk / cpub_clk -| \- cpu_clk_dyn -| | \- cpu_clk_premux0 -| | |- cpu_clk_postmux0 -| | | |- cpu_clk_dyn0_div -| | | \- xtal/fclk_div2/fclk_div3 -| | \- xtal/fclk_div2/fclk_div3 -| \- cpu_clk_premux1 -| |- cpu_clk_postmux1 -| | |- cpu_clk_dyn1_div -| | \- xtal/fclk_div2/fclk_div3 -| \- xtal/fclk_div2/fclk_div3 -\ sys_pll / sys1_pll - -This for each cluster, a single one for G12A, two for G12B. - -Each cpu_clk_premux1 tree is marked as read-only and CLK_SET_RATE_NO_REPARENT, -to be used as "parking" clock in a safe clock frequency. - -A notifier is added on each cpu_clk_premux0 to detech when CCF want to -change the frequency of the cpu_clk_dyn tree. -In this notifier, the cpu_clk_premux1 tree is configured to use the xtal -clock and then the cpu_clk_dyn is switch to cpu_clk_premux1 while CCF -updates the cpu_clk_premux0 tree. - -A notifier is added on each sys_pll/sys1_pll to detect when CCF wants to -change the PLL clock source of the cpu_clk. -In this notifier, the cpu_clk is switched to cpu_clk_dyn while CCF -updates the sys_pll/sys1_pll frequency. - -A third small notifier is added on each cpu_clk / cpub_clk and cpu_clk_dyn, -add a small delay at PRE_RATE_CHANGE/POST_RATE_CHANGE to let the other -notofiers change propagate before changing the cpu_clk_premux0 and sys_pll -clock trees. - -This notifier set permits switching the cpu_clk / cpub_clk without any -glitches and using a safe parking clock while switching between sub-GHz -clocks using the cpu_clk_dyn tree. - -This setup has been tested and validated on the Amlogic G12A and G12B -SoCs running the arm64 cpuburn at [1] and cycling between all the possible -cpufreq translations of each cluster and checking the final frequency using -the clock-measurer, script at [2]. - -[1] https://github.com/ssvb/cpuburn-arm/blob/master/cpuburn-a53.S -[2] https://gist.github.com/superna9999/d4de964dbc0f84b7d527e1df2ddea25f - -Signed-off-by: Neil Armstrong -Signed-off-by: Jerome Brunet -(cherry picked from commit ffae8475b90c045ca508675794c08a0c8c12d202 - https://github.com/BayLibre/clk-meson v5.4/drivers) ---- - drivers/clk/meson/g12a.c | 535 +++++++++++++++++++++++++++++++++++---- - 1 file changed, 481 insertions(+), 54 deletions(-) - -diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c -index a8f706de811b..c3f0ffc3280d 100644 ---- a/drivers/clk/meson/g12a.c -+++ b/drivers/clk/meson/g12a.c -@@ -14,10 +14,12 @@ - #include - #include - #include -+#include - - #include "clk-mpll.h" - #include "clk-pll.h" - #include "clk-regmap.h" -+#include "clk-cpu-dyndiv.h" - #include "vid-pll-div.h" - #include "meson-eeclk.h" - #include "g12a.h" -@@ -88,16 +90,9 @@ static struct clk_regmap g12a_fixed_pll = { - }, - }; - --/* -- * Internal sys pll emulation configuration parameters -- */ --static const struct reg_sequence g12a_sys_init_regs[] = { -- { .reg = HHI_SYS_PLL_CNTL1, .def = 0x00000000 }, -- { .reg = HHI_SYS_PLL_CNTL2, .def = 0x00000000 }, -- { .reg = HHI_SYS_PLL_CNTL3, .def = 0x48681c00 }, -- { .reg = HHI_SYS_PLL_CNTL4, .def = 0x88770290 }, -- { .reg = HHI_SYS_PLL_CNTL5, .def = 0x39272000 }, -- { .reg = HHI_SYS_PLL_CNTL6, .def = 0x56540000 }, -+static const struct pll_mult_range g12a_sys_pll_mult_range = { -+ .min = 128, -+ .max = 250, - }; - - static struct clk_regmap g12a_sys_pll_dco = { -@@ -127,16 +122,17 @@ static struct clk_regmap g12a_sys_pll_dco = { - .shift = 29, - .width = 1, - }, -- .init_regs = g12a_sys_init_regs, -- .init_count = ARRAY_SIZE(g12a_sys_init_regs), -+ .range = &g12a_sys_pll_mult_range, - }, - .hw.init = &(struct clk_init_data){ - .name = "sys_pll_dco", -- .ops = &meson_clk_pll_ro_ops, -+ .ops = &meson_clk_pll_ops, - .parent_data = &(const struct clk_parent_data) { - .fw_name = "xtal", - }, - .num_parents = 1, -+ /* This clock feeds the CPU, avoid disabling it */ -+ .flags = CLK_IS_CRITICAL, - }, - }; - -@@ -149,11 +145,12 @@ static struct clk_regmap g12a_sys_pll = { - }, - .hw.init = &(struct clk_init_data){ - .name = "sys_pll", -- .ops = &clk_regmap_divider_ro_ops, -+ .ops = &clk_regmap_divider_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_sys_pll_dco.hw - }, - .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -184,14 +181,17 @@ static struct clk_regmap g12b_sys1_pll_dco = { - .shift = 29, - .width = 1, - }, -+ .range = &g12a_sys_pll_mult_range, - }, - .hw.init = &(struct clk_init_data){ - .name = "sys1_pll_dco", -- .ops = &meson_clk_pll_ro_ops, -+ .ops = &meson_clk_pll_ops, - .parent_data = &(const struct clk_parent_data) { - .fw_name = "xtal", - }, - .num_parents = 1, -+ /* This clock feeds the CPU, avoid disabling it */ -+ .flags = CLK_IS_CRITICAL, - }, - }; - -@@ -204,11 +204,12 @@ static struct clk_regmap g12b_sys1_pll = { - }, - .hw.init = &(struct clk_init_data){ - .name = "sys1_pll", -- .ops = &clk_regmap_divider_ro_ops, -+ .ops = &clk_regmap_divider_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12b_sys1_pll_dco.hw - }, - .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -345,13 +346,15 @@ static struct clk_regmap g12a_cpu_clk_premux0 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn0_sel", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", }, - { .hw = &g12a_fclk_div2.hw }, - { .hw = &g12a_fclk_div3.hw }, - }, - .num_parents = 3, -+ /* This sub-tree is used a parking clock */ -+ .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; - -@@ -364,30 +367,40 @@ static struct clk_regmap g12a_cpu_clk_premux1 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn1_sel", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", }, - { .hw = &g12a_fclk_div2.hw }, - { .hw = &g12a_fclk_div3.hw }, - }, - .num_parents = 3, -+ /* This sub-tree is used a parking clock */ -+ .flags = CLK_SET_RATE_NO_REPARENT - }, - }; - - /* Datasheet names this field as "mux0_divn_tcnt" */ - static struct clk_regmap g12a_cpu_clk_mux0_div = { -- .data = &(struct clk_regmap_div_data){ -- .offset = HHI_SYS_CPU_CLK_CNTL0, -- .shift = 4, -- .width = 6, -+ .data = &(struct meson_clk_cpu_dyndiv_data){ -+ .div = { -+ .reg_off = HHI_SYS_CPU_CLK_CNTL0, -+ .shift = 4, -+ .width = 6, -+ }, -+ .dyn = { -+ .reg_off = HHI_SYS_CPU_CLK_CNTL0, -+ .shift = 26, -+ .width = 1, -+ }, - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn0_div", -- .ops = &clk_regmap_divider_ro_ops, -+ .ops = &meson_clk_cpu_dyndiv_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_cpu_clk_premux0.hw - }, - .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -400,12 +413,13 @@ static struct clk_regmap g12a_cpu_clk_postmux0 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn0", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_cpu_clk_premux0.hw, - &g12a_cpu_clk_mux0_div.hw, - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -435,12 +449,14 @@ static struct clk_regmap g12a_cpu_clk_postmux1 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn1", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_cpu_clk_premux1.hw, - &g12a_cpu_clk_mux1_div.hw, - }, - .num_parents = 2, -+ /* This sub-tree is used a parking clock */ -+ .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; - -@@ -453,12 +469,13 @@ static struct clk_regmap g12a_cpu_clk_dyn = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk_dyn", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_cpu_clk_postmux0.hw, - &g12a_cpu_clk_postmux1.hw, - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -471,12 +488,13 @@ static struct clk_regmap g12a_cpu_clk = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_cpu_clk_dyn.hw, - &g12a_sys_pll.hw, - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -489,12 +507,13 @@ static struct clk_regmap g12b_cpu_clk = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpu_clk", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12a_cpu_clk_dyn.hw, - &g12b_sys1_pll.hw - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -507,7 +526,7 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn0_sel", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", }, - { .hw = &g12a_fclk_div2.hw }, -@@ -519,18 +538,26 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { - - /* Datasheet names this field as "mux0_divn_tcnt" */ - static struct clk_regmap g12b_cpub_clk_mux0_div = { -- .data = &(struct clk_regmap_div_data){ -- .offset = HHI_SYS_CPUB_CLK_CNTL, -- .shift = 4, -- .width = 6, -+ .data = &(struct meson_clk_cpu_dyndiv_data){ -+ .div = { -+ .reg_off = HHI_SYS_CPUB_CLK_CNTL, -+ .shift = 4, -+ .width = 6, -+ }, -+ .dyn = { -+ .reg_off = HHI_SYS_CPUB_CLK_CNTL, -+ .shift = 26, -+ .width = 1, -+ }, - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn0_div", -- .ops = &clk_regmap_divider_ro_ops, -+ .ops = &meson_clk_cpu_dyndiv_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12b_cpub_clk_premux0.hw - }, - .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -543,12 +570,13 @@ static struct clk_regmap g12b_cpub_clk_postmux0 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn0", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12b_cpub_clk_premux0.hw, - &g12b_cpub_clk_mux0_div.hw - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -561,13 +589,15 @@ static struct clk_regmap g12b_cpub_clk_premux1 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn1_sel", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", }, - { .hw = &g12a_fclk_div2.hw }, - { .hw = &g12a_fclk_div3.hw }, - }, - .num_parents = 3, -+ /* This sub-tree is used a parking clock */ -+ .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; - -@@ -597,12 +627,14 @@ static struct clk_regmap g12b_cpub_clk_postmux1 = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn1", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12b_cpub_clk_premux1.hw, - &g12b_cpub_clk_mux1_div.hw - }, - .num_parents = 2, -+ /* This sub-tree is used a parking clock */ -+ .flags = CLK_SET_RATE_NO_REPARENT, - }, - }; - -@@ -615,12 +647,13 @@ static struct clk_regmap g12b_cpub_clk_dyn = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk_dyn", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12b_cpub_clk_postmux0.hw, - &g12b_cpub_clk_postmux1.hw - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -@@ -633,15 +666,227 @@ static struct clk_regmap g12b_cpub_clk = { - }, - .hw.init = &(struct clk_init_data){ - .name = "cpub_clk", -- .ops = &clk_regmap_mux_ro_ops, -+ .ops = &clk_regmap_mux_ops, - .parent_hws = (const struct clk_hw *[]) { - &g12b_cpub_clk_dyn.hw, - &g12a_sys_pll.hw - }, - .num_parents = 2, -+ .flags = CLK_SET_RATE_PARENT, - }, - }; - -+static int g12a_cpu_clk_mux_notifier_cb(struct notifier_block *nb, -+ unsigned long event, void *data) -+{ -+ if (event == POST_RATE_CHANGE || event == PRE_RATE_CHANGE) { -+ /* Wait for clock propagation before/after changing the mux */ -+ udelay(100); -+ return NOTIFY_OK; -+ } -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block g12a_cpu_clk_mux_nb = { -+ .notifier_call = g12a_cpu_clk_mux_notifier_cb, -+}; -+ -+struct g12a_cpu_clk_postmux_nb_data { -+ struct notifier_block nb; -+ struct clk_hw *xtal; -+ struct clk_hw *cpu_clk_dyn; -+ struct clk_hw *cpu_clk_postmux0; -+ struct clk_hw *cpu_clk_postmux1; -+ struct clk_hw *cpu_clk_premux1; -+}; -+ -+static int g12a_cpu_clk_postmux_notifier_cb(struct notifier_block *nb, -+ unsigned long event, void *data) -+{ -+ struct g12a_cpu_clk_postmux_nb_data *nb_data = -+ container_of(nb, struct g12a_cpu_clk_postmux_nb_data, nb); -+ -+ switch (event) { -+ case PRE_RATE_CHANGE: -+ /* -+ * This notifier means cpu_clk_postmux0 clock will be changed -+ * to feed cpu_clk, this is the current path : -+ * cpu_clk -+ * \- cpu_clk_dyn -+ * \- cpu_clk_postmux0 -+ * \- cpu_clk_muxX_div -+ * \- cpu_clk_premux0 -+ * \- fclk_div3 or fclk_div2 -+ * OR -+ * \- cpu_clk_premux0 -+ * \- fclk_div3 or fclk_div2 -+ */ -+ -+ /* Setup cpu_clk_premux1 to xtal */ -+ clk_hw_set_parent(nb_data->cpu_clk_premux1, -+ nb_data->xtal); -+ -+ /* Setup cpu_clk_postmux1 to bypass divider */ -+ clk_hw_set_parent(nb_data->cpu_clk_postmux1, -+ nb_data->cpu_clk_premux1); -+ -+ /* Switch to parking clk on cpu_clk_postmux1 */ -+ clk_hw_set_parent(nb_data->cpu_clk_dyn, -+ nb_data->cpu_clk_postmux1); -+ -+ /* -+ * Now, cpu_clk is 24MHz in the current path : -+ * cpu_clk -+ * \- cpu_clk_dyn -+ * \- cpu_clk_postmux1 -+ * \- cpu_clk_premux1 -+ * \- xtal -+ */ -+ -+ udelay(100); -+ -+ return NOTIFY_OK; -+ -+ case POST_RATE_CHANGE: -+ /* -+ * The cpu_clk_postmux0 has ben updated, now switch back -+ * cpu_clk_dyn to cpu_clk_postmux0 and take the changes -+ * in account. -+ */ -+ -+ /* Configure cpu_clk_dyn back to cpu_clk_postmux0 */ -+ clk_hw_set_parent(nb_data->cpu_clk_dyn, -+ nb_data->cpu_clk_postmux0); -+ -+ /* -+ * new path : -+ * cpu_clk -+ * \- cpu_clk_dyn -+ * \- cpu_clk_postmux0 -+ * \- cpu_clk_muxX_div -+ * \- cpu_clk_premux0 -+ * \- fclk_div3 or fclk_div2 -+ * OR -+ * \- cpu_clk_premux0 -+ * \- fclk_div3 or fclk_div2 -+ */ -+ -+ udelay(100); -+ -+ return NOTIFY_OK; -+ -+ default: -+ return NOTIFY_DONE; -+ } -+} -+ -+static struct g12a_cpu_clk_postmux_nb_data g12a_cpu_clk_postmux0_nb_data = { -+ .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw, -+ .cpu_clk_postmux0 = &g12a_cpu_clk_postmux0.hw, -+ .cpu_clk_postmux1 = &g12a_cpu_clk_postmux1.hw, -+ .cpu_clk_premux1 = &g12a_cpu_clk_premux1.hw, -+ .nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb, -+}; -+ -+static struct g12a_cpu_clk_postmux_nb_data g12b_cpub_clk_postmux0_nb_data = { -+ .cpu_clk_dyn = &g12b_cpub_clk_dyn.hw, -+ .cpu_clk_postmux0 = &g12b_cpub_clk_postmux0.hw, -+ .cpu_clk_postmux1 = &g12b_cpub_clk_postmux1.hw, -+ .cpu_clk_premux1 = &g12b_cpub_clk_premux1.hw, -+ .nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb, -+}; -+ -+struct g12a_sys_pll_nb_data { -+ struct notifier_block nb; -+ struct clk_hw *sys_pll; -+ struct clk_hw *cpu_clk; -+ struct clk_hw *cpu_clk_dyn; -+}; -+ -+static int g12a_sys_pll_notifier_cb(struct notifier_block *nb, -+ unsigned long event, void *data) -+{ -+ struct g12a_sys_pll_nb_data *nb_data = -+ container_of(nb, struct g12a_sys_pll_nb_data, nb); -+ -+ switch (event) { -+ case PRE_RATE_CHANGE: -+ /* -+ * This notifier means sys_pll clock will be changed -+ * to feed cpu_clk, this the current path : -+ * cpu_clk -+ * \- sys_pll -+ * \- sys_pll_dco -+ */ -+ -+ /* Configure cpu_clk to use cpu_clk_dyn */ -+ clk_hw_set_parent(nb_data->cpu_clk, -+ nb_data->cpu_clk_dyn); -+ -+ /* -+ * Now, cpu_clk uses the dyn path -+ * cpu_clk -+ * \- cpu_clk_dyn -+ * \- cpu_clk_dynX -+ * \- cpu_clk_dynX_sel -+ * \- cpu_clk_dynX_div -+ * \- xtal/fclk_div2/fclk_div3 -+ * \- xtal/fclk_div2/fclk_div3 -+ */ -+ -+ udelay(100); -+ -+ return NOTIFY_OK; -+ -+ case POST_RATE_CHANGE: -+ /* -+ * The sys_pll has ben updated, now switch back cpu_clk to -+ * sys_pll -+ */ -+ -+ /* Configure cpu_clk to use sys_pll */ -+ clk_hw_set_parent(nb_data->cpu_clk, -+ nb_data->sys_pll); -+ -+ udelay(100); -+ -+ /* new path : -+ * cpu_clk -+ * \- sys_pll -+ * \- sys_pll_dco -+ */ -+ -+ return NOTIFY_OK; -+ -+ default: -+ return NOTIFY_DONE; -+ } -+} -+ -+static struct g12a_sys_pll_nb_data g12a_sys_pll_nb_data = { -+ .sys_pll = &g12a_sys_pll.hw, -+ .cpu_clk = &g12a_cpu_clk.hw, -+ .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw, -+ .nb.notifier_call = g12a_sys_pll_notifier_cb, -+}; -+ -+/* G12B first CPU cluster uses sys1_pll */ -+static struct g12a_sys_pll_nb_data g12b_cpu_clk_sys1_pll_nb_data = { -+ .sys_pll = &g12b_sys1_pll.hw, -+ .cpu_clk = &g12b_cpu_clk.hw, -+ .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw, -+ .nb.notifier_call = g12a_sys_pll_notifier_cb, -+}; -+ -+/* G12B second CPU cluster uses sys_pll */ -+static struct g12a_sys_pll_nb_data g12b_cpub_clk_sys_pll_nb_data = { -+ .sys_pll = &g12a_sys_pll.hw, -+ .cpu_clk = &g12b_cpub_clk.hw, -+ .cpu_clk_dyn = &g12b_cpub_clk_dyn.hw, -+ .nb.notifier_call = g12a_sys_pll_notifier_cb, -+}; -+ - static struct clk_regmap g12a_cpu_clk_div16_en = { - .data = &(struct clk_regmap_gate_data){ - .offset = HHI_SYS_CPU_CLK_CNTL1, -@@ -4097,28 +4342,210 @@ static const struct reg_sequence g12a_init_regs[] = { - { .reg = HHI_MPLL_CNTL0, .def = 0x00000543 }, - }; - --static const struct meson_eeclkc_data g12a_clkc_data = { -- .regmap_clks = g12a_clk_regmaps, -- .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), -- .hw_onecell_data = &g12a_hw_onecell_data, -- .init_regs = g12a_init_regs, -- .init_count = ARRAY_SIZE(g12a_init_regs), --}; -- --static const struct meson_eeclkc_data g12b_clkc_data = { -- .regmap_clks = g12a_clk_regmaps, -- .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), -- .hw_onecell_data = &g12b_hw_onecell_data -+static int meson_g12a_dvfs_setup_common(struct platform_device *pdev, -+ struct clk_hw **hws) -+{ -+ const char *notifier_clk_name; -+ struct clk *notifier_clk; -+ struct clk_hw *xtal; -+ int ret; -+ -+ xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0); -+ -+ /* Setup clock notifier for cpu_clk_postmux0 */ -+ g12a_cpu_clk_postmux0_nb_data.xtal = xtal; -+ notifier_clk_name = clk_hw_get_name(&g12a_cpu_clk_postmux0.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, -+ &g12a_cpu_clk_postmux0_nb_data.nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpu_clk_postmux0 notifier\n"); -+ return ret; -+ } -+ -+ /* Setup clock notifier for cpu_clk_dyn mux */ -+ notifier_clk_name = clk_hw_get_name(&g12a_cpu_clk_dyn.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpu_clk_dyn notifier\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int meson_g12b_dvfs_setup(struct platform_device *pdev) -+{ -+ struct clk_hw **hws = g12b_hw_onecell_data.hws; -+ const char *notifier_clk_name; -+ struct clk *notifier_clk; -+ struct clk_hw *xtal; -+ int ret; -+ -+ ret = meson_g12a_dvfs_setup_common(pdev, hws); -+ if (ret) -+ return ret; -+ -+ xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0); -+ -+ /* Setup clock notifier for cpu_clk mux */ -+ notifier_clk_name = clk_hw_get_name(&g12b_cpu_clk.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpu_clk notifier\n"); -+ return ret; -+ } -+ -+ /* Setup clock notifier for sys1_pll */ -+ notifier_clk_name = clk_hw_get_name(&g12b_sys1_pll.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, -+ &g12b_cpu_clk_sys1_pll_nb_data.nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the sys1_pll notifier\n"); -+ return ret; -+ } -+ -+ /* Add notifiers for the second CPU cluster */ -+ -+ /* Setup clock notifier for cpub_clk_postmux0 */ -+ g12b_cpub_clk_postmux0_nb_data.xtal = xtal; -+ notifier_clk_name = clk_hw_get_name(&g12b_cpub_clk_postmux0.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, -+ &g12b_cpub_clk_postmux0_nb_data.nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpub_clk_postmux0 notifier\n"); -+ return ret; -+ } -+ -+ /* Setup clock notifier for cpub_clk_dyn mux */ -+ notifier_clk_name = clk_hw_get_name(&g12b_cpub_clk_dyn.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpub_clk_dyn notifier\n"); -+ return ret; -+ } -+ -+ /* Setup clock notifier for cpub_clk mux */ -+ notifier_clk_name = clk_hw_get_name(&g12b_cpub_clk.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpub_clk notifier\n"); -+ return ret; -+ } -+ -+ /* Setup clock notifier for sys_pll */ -+ notifier_clk_name = clk_hw_get_name(&g12a_sys_pll.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, -+ &g12b_cpub_clk_sys_pll_nb_data.nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the sys_pll notifier\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int meson_g12a_dvfs_setup(struct platform_device *pdev) -+{ -+ struct clk_hw **hws = g12a_hw_onecell_data.hws; -+ const char *notifier_clk_name; -+ struct clk *notifier_clk; -+ int ret; -+ -+ ret = meson_g12a_dvfs_setup_common(pdev, hws); -+ if (ret) -+ return ret; -+ -+ /* Setup clock notifier for cpu_clk mux */ -+ notifier_clk_name = clk_hw_get_name(&g12a_cpu_clk.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the cpu_clk notifier\n"); -+ return ret; -+ } -+ -+ /* Setup clock notifier for sys_pll */ -+ notifier_clk_name = clk_hw_get_name(&g12a_sys_pll.hw); -+ notifier_clk = __clk_lookup(notifier_clk_name); -+ ret = clk_notifier_register(notifier_clk, &g12a_sys_pll_nb_data.nb); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to register the sys_pll notifier\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+struct meson_g12a_data { -+ const struct meson_eeclkc_data eeclkc_data; -+ int (*dvfs_setup)(struct platform_device *pdev); -+}; -+ -+static int meson_g12a_probe(struct platform_device *pdev) -+{ -+ const struct meson_eeclkc_data *eeclkc_data; -+ const struct meson_g12a_data *g12a_data; -+ int ret; -+ -+ eeclkc_data = of_device_get_match_data(&pdev->dev); -+ if (!eeclkc_data) -+ return -EINVAL; -+ -+ ret = meson_eeclkc_probe(pdev); -+ if (ret) -+ return ret; -+ -+ g12a_data = container_of(eeclkc_data, struct meson_g12a_data, -+ eeclkc_data); -+ -+ if (g12a_data->dvfs_setup) -+ return g12a_data->dvfs_setup(pdev); -+ -+ return 0; -+} -+ -+static const struct meson_g12a_data g12a_clkc_data = { -+ .eeclkc_data = { -+ .regmap_clks = g12a_clk_regmaps, -+ .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), -+ .hw_onecell_data = &g12a_hw_onecell_data, -+ .init_regs = g12a_init_regs, -+ .init_count = ARRAY_SIZE(g12a_init_regs), -+ }, -+ .dvfs_setup = meson_g12a_dvfs_setup, -+}; -+ -+static const struct meson_g12a_data g12b_clkc_data = { -+ .eeclkc_data = { -+ .regmap_clks = g12a_clk_regmaps, -+ .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), -+ .hw_onecell_data = &g12b_hw_onecell_data, -+ }, -+ .dvfs_setup = meson_g12b_dvfs_setup, - }; - - static const struct of_device_id clkc_match_table[] = { -- { .compatible = "amlogic,g12a-clkc", .data = &g12a_clkc_data }, -- { .compatible = "amlogic,g12b-clkc", .data = &g12b_clkc_data }, -+ { -+ .compatible = "amlogic,g12a-clkc", -+ .data = &g12a_clkc_data.eeclkc_data -+ }, -+ { -+ .compatible = "amlogic,g12b-clkc", -+ .data = &g12b_clkc_data.eeclkc_data -+ }, - {} - }; - - static struct platform_driver g12a_driver = { -- .probe = meson_eeclkc_probe, -+ .probe = meson_g12a_probe, - .driver = { - .name = "g12a-clkc", - .of_match_table = clkc_match_table, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-ASoC-meson-aiu-add-internal-dac-codec-contro.patch b/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-ASoC-meson-aiu-add-internal-dac-codec-contro.patch new file mode 100644 index 0000000000..c2bea63833 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-ASoC-meson-aiu-add-internal-dac-codec-contro.patch @@ -0,0 +1,279 @@ +From 5104eb54c2ea560b6734c46c6185b71f6fd77cd2 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:56 +0100 +Subject: [PATCH 018/146] FROMGIT: ASoC: meson: aiu: add internal dac codec + control support + +Add the codec to codec component which handles the routing between +the audio producers and the internal audio DAC found on the amlogic GXL +SoC family + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/Makefile | 1 + + sound/soc/meson/aiu-acodec-ctrl.c | 205 ++++++++++++++++++++++++++++++ + sound/soc/meson/aiu.c | 10 ++ + sound/soc/meson/aiu.h | 1 + + 4 files changed, 217 insertions(+) + create mode 100644 sound/soc/meson/aiu-acodec-ctrl.c + +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index 3b21f648e322..80f9113701b3 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: (GPL-2.0 OR MIT) + + snd-soc-meson-aiu-objs := aiu.o ++snd-soc-meson-aiu-objs += aiu-acodec-ctrl.o + snd-soc-meson-aiu-objs += aiu-codec-ctrl.o + snd-soc-meson-aiu-objs += aiu-encoder-i2s.o + snd-soc-meson-aiu-objs += aiu-encoder-spdif.o +diff --git a/sound/soc/meson/aiu-acodec-ctrl.c b/sound/soc/meson/aiu-acodec-ctrl.c +new file mode 100644 +index 000000000000..12d8a4d351a1 +--- /dev/null ++++ b/sound/soc/meson/aiu-acodec-ctrl.c +@@ -0,0 +1,205 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include "aiu.h" ++#include "meson-codec-glue.h" ++ ++#define CTRL_DIN_EN 15 ++#define CTRL_CLK_INV BIT(14) ++#define CTRL_LRCLK_INV BIT(13) ++#define CTRL_I2S_IN_BCLK_SRC BIT(11) ++#define CTRL_DIN_LRCLK_SRC_SHIFT 6 ++#define CTRL_DIN_LRCLK_SRC (0x3 << CTRL_DIN_LRCLK_SRC_SHIFT) ++#define CTRL_BCLK_MCLK_SRC GENMASK(5, 4) ++#define CTRL_DIN_SKEW GENMASK(3, 2) ++#define CTRL_I2S_OUT_LANE_SRC 0 ++ ++#define AIU_ACODEC_OUT_CHMAX 2 ++ ++static const char * const aiu_acodec_ctrl_mux_texts[] = { ++ "DISABLED", "I2S", "PCM", ++}; ++ ++static int aiu_acodec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_component *component = ++ snd_soc_dapm_kcontrol_component(kcontrol); ++ struct snd_soc_dapm_context *dapm = ++ snd_soc_dapm_kcontrol_dapm(kcontrol); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int mux, changed; ++ ++ mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); ++ changed = snd_soc_component_test_bits(component, e->reg, ++ CTRL_DIN_LRCLK_SRC, ++ FIELD_PREP(CTRL_DIN_LRCLK_SRC, ++ mux)); ++ ++ if (!changed) ++ return 0; ++ ++ /* Force disconnect of the mux while updating */ ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); ++ ++ snd_soc_component_update_bits(component, e->reg, ++ CTRL_DIN_LRCLK_SRC | ++ CTRL_BCLK_MCLK_SRC, ++ FIELD_PREP(CTRL_DIN_LRCLK_SRC, mux) | ++ FIELD_PREP(CTRL_BCLK_MCLK_SRC, mux)); ++ ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ ++ return 0; ++} ++ ++static SOC_ENUM_SINGLE_DECL(aiu_acodec_ctrl_mux_enum, AIU_ACODEC_CTRL, ++ CTRL_DIN_LRCLK_SRC_SHIFT, ++ aiu_acodec_ctrl_mux_texts); ++ ++static const struct snd_kcontrol_new aiu_acodec_ctrl_mux = ++ SOC_DAPM_ENUM_EXT("ACodec Source", aiu_acodec_ctrl_mux_enum, ++ snd_soc_dapm_get_enum_double, ++ aiu_acodec_ctrl_mux_put_enum); ++ ++static const struct snd_kcontrol_new aiu_acodec_ctrl_out_enable = ++ SOC_DAPM_SINGLE_AUTODISABLE("Switch", AIU_ACODEC_CTRL, ++ CTRL_DIN_EN, 1, 0); ++ ++static const struct snd_soc_dapm_widget aiu_acodec_ctrl_widgets[] = { ++ SND_SOC_DAPM_MUX("ACODEC SRC", SND_SOC_NOPM, 0, 0, ++ &aiu_acodec_ctrl_mux), ++ SND_SOC_DAPM_SWITCH("ACODEC OUT EN", SND_SOC_NOPM, 0, 0, ++ &aiu_acodec_ctrl_out_enable), ++}; ++ ++static int aiu_acodec_ctrl_input_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct meson_codec_glue_input *data; ++ int ret; ++ ++ ret = meson_codec_glue_input_hw_params(substream, params, dai); ++ if (ret) ++ return ret; ++ ++ /* The glue will provide 1 lane out of the 4 to the output */ ++ data = meson_codec_glue_input_get_data(dai); ++ data->params.channels_min = min_t(unsigned int, AIU_ACODEC_OUT_CHMAX, ++ data->params.channels_min); ++ data->params.channels_max = min_t(unsigned int, AIU_ACODEC_OUT_CHMAX, ++ data->params.channels_max); ++ ++ return 0; ++} ++ ++static const struct snd_soc_dai_ops aiu_acodec_ctrl_input_ops = { ++ .hw_params = aiu_acodec_ctrl_input_hw_params, ++ .set_fmt = meson_codec_glue_input_set_fmt, ++}; ++ ++static const struct snd_soc_dai_ops aiu_acodec_ctrl_output_ops = { ++ .startup = meson_codec_glue_output_startup, ++}; ++ ++#define AIU_ACODEC_CTRL_FORMATS \ ++ (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ ++ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE | \ ++ SNDRV_PCM_FMTBIT_S32_LE) ++ ++#define AIU_ACODEC_STREAM(xname, xsuffix, xchmax) \ ++{ \ ++ .stream_name = xname " " xsuffix, \ ++ .channels_min = 1, \ ++ .channels_max = (xchmax), \ ++ .rate_min = 5512, \ ++ .rate_max = 192000, \ ++ .formats = AIU_ACODEC_CTRL_FORMATS, \ ++} ++ ++#define AIU_ACODEC_INPUT(xname) { \ ++ .name = "ACODEC CTRL " xname, \ ++ .name = xname, \ ++ .playback = AIU_ACODEC_STREAM(xname, "Playback", 8), \ ++ .ops = &aiu_acodec_ctrl_input_ops, \ ++ .probe = meson_codec_glue_input_dai_probe, \ ++ .remove = meson_codec_glue_input_dai_remove, \ ++} ++ ++#define AIU_ACODEC_OUTPUT(xname) { \ ++ .name = "ACODEC CTRL " xname, \ ++ .capture = AIU_ACODEC_STREAM(xname, "Capture", AIU_ACODEC_OUT_CHMAX), \ ++ .ops = &aiu_acodec_ctrl_output_ops, \ ++} ++ ++static struct snd_soc_dai_driver aiu_acodec_ctrl_dai_drv[] = { ++ [CTRL_I2S] = AIU_ACODEC_INPUT("ACODEC I2S IN"), ++ [CTRL_PCM] = AIU_ACODEC_INPUT("ACODEC PCM IN"), ++ [CTRL_OUT] = AIU_ACODEC_OUTPUT("ACODEC OUT"), ++}; ++ ++static const struct snd_soc_dapm_route aiu_acodec_ctrl_routes[] = { ++ { "ACODEC SRC", "I2S", "ACODEC I2S IN Playback" }, ++ { "ACODEC SRC", "PCM", "ACODEC PCM IN Playback" }, ++ { "ACODEC OUT EN", "Switch", "ACODEC SRC" }, ++ { "ACODEC OUT Capture", NULL, "ACODEC OUT EN" }, ++}; ++ ++static const struct snd_kcontrol_new aiu_acodec_ctrl_controls[] = { ++ SOC_SINGLE("ACODEC I2S Lane Select", AIU_ACODEC_CTRL, ++ CTRL_I2S_OUT_LANE_SRC, 3, 0), ++}; ++ ++static int aiu_acodec_of_xlate_dai_name(struct snd_soc_component *component, ++ struct of_phandle_args *args, ++ const char **dai_name) ++{ ++ return aiu_of_xlate_dai_name(component, args, dai_name, AIU_ACODEC); ++} ++ ++static int aiu_acodec_ctrl_component_probe(struct snd_soc_component *component) ++{ ++ /* ++ * NOTE: Din Skew setting ++ * According to the documentation, the following update adds one delay ++ * to the din line. Without this, the output saturates. This happens ++ * regardless of the link format (i2s or left_j) so it is not clear what ++ * it actually does but it seems to be required ++ */ ++ snd_soc_component_update_bits(component, AIU_ACODEC_CTRL, ++ CTRL_DIN_SKEW, ++ FIELD_PREP(CTRL_DIN_SKEW, 2)); ++ ++ return 0; ++} ++ ++static const struct snd_soc_component_driver aiu_acodec_ctrl_component = { ++ .name = "AIU Internal DAC Codec Control", ++ .probe = aiu_acodec_ctrl_component_probe, ++ .controls = aiu_acodec_ctrl_controls, ++ .num_controls = ARRAY_SIZE(aiu_acodec_ctrl_controls), ++ .dapm_widgets = aiu_acodec_ctrl_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(aiu_acodec_ctrl_widgets), ++ .dapm_routes = aiu_acodec_ctrl_routes, ++ .num_dapm_routes = ARRAY_SIZE(aiu_acodec_ctrl_routes), ++ .of_xlate_dai_name = aiu_acodec_of_xlate_dai_name, ++ .endianness = 1, ++ .non_legacy_dai_naming = 1, ++}; ++ ++int aiu_acodec_ctrl_register_component(struct device *dev) ++{ ++ return aiu_add_component(dev, &aiu_acodec_ctrl_component, ++ aiu_acodec_ctrl_dai_drv, ++ ARRAY_SIZE(aiu_acodec_ctrl_dai_drv), ++ "acodec"); ++} +diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c +index b765dfb70726..5c4845a23a34 100644 +--- a/sound/soc/meson/aiu.c ++++ b/sound/soc/meson/aiu.c +@@ -345,6 +345,16 @@ static int aiu_probe(struct platform_device *pdev) + goto err; + } + ++ /* Register the internal dac control component on gxl */ ++ if (of_device_is_compatible(dev->of_node, "amlogic,aiu-gxl")) { ++ ret = aiu_acodec_ctrl_register_component(dev); ++ if (ret) { ++ dev_err(dev, ++ "Failed to register acodec control component\n"); ++ goto err; ++ } ++ } ++ + return 0; + err: + snd_soc_unregister_component(dev); +diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h +index 9242ab1ab64b..a65a576e3400 100644 +--- a/sound/soc/meson/aiu.h ++++ b/sound/soc/meson/aiu.h +@@ -52,6 +52,7 @@ int aiu_add_component(struct device *dev, + const char *debugfs_prefix); + + int aiu_hdmi_ctrl_register_component(struct device *dev); ++int aiu_acodec_ctrl_register_component(struct device *dev); + + int aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai); + int aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-clk-meson-g12a-expose-CPUB-clock-ID-for-G12B.patch b/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-clk-meson-g12a-expose-CPUB-clock-ID-for-G12B.patch deleted file mode 100644 index b5f1c139f9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-clk-meson-g12a-expose-CPUB-clock-ID-for-G12B.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 98fd49222ea1bfb68f788b23cfa36fac90d65d93 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 31 Jul 2019 10:40:19 +0200 -Subject: [PATCH 018/187] FROMGIT: clk: meson: g12a: expose CPUB clock ID for - G12B - -Expose the CPUB clock id to add DVFS to the second CPU cluster of -the Amlogic G12B SoC. - -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong -Signed-off-by: Jerome Brunet -(cherry picked from commit 85ab9d954698961960240622de4fad85c7d8a61e - https://github.com/BayLibre/clk-meson v5.4/drivers) ---- - drivers/clk/meson/g12a.h | 1 - - include/dt-bindings/clock/g12a-clkc.h | 1 + - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/clk/meson/g12a.h b/drivers/clk/meson/g12a.h -index c8aed31fbe17..559a34cfdfeb 100644 ---- a/drivers/clk/meson/g12a.h -+++ b/drivers/clk/meson/g12a.h -@@ -216,7 +216,6 @@ - #define CLKID_CPUB_CLK_DYN1_DIV 221 - #define CLKID_CPUB_CLK_DYN1 222 - #define CLKID_CPUB_CLK_DYN 223 --#define CLKID_CPUB_CLK 224 - #define CLKID_CPUB_CLK_DIV16_EN 225 - #define CLKID_CPUB_CLK_DIV16 226 - #define CLKID_CPUB_CLK_DIV2 227 -diff --git a/include/dt-bindings/clock/g12a-clkc.h b/include/dt-bindings/clock/g12a-clkc.h -index b6b127e45634..8ccc29ac7a72 100644 ---- a/include/dt-bindings/clock/g12a-clkc.h -+++ b/include/dt-bindings/clock/g12a-clkc.h -@@ -137,5 +137,6 @@ - #define CLKID_VDEC_HEVC 207 - #define CLKID_VDEC_HEVCF 210 - #define CLKID_TS 212 -+#define CLKID_CPUB_CLK 224 - - #endif /* __G12A_CLKC_H */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-ASoC-meson-axg-extract-sound-card-utils.patch b/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-ASoC-meson-axg-extract-sound-card-utils.patch new file mode 100644 index 0000000000..4211635323 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-ASoC-meson-axg-extract-sound-card-utils.patch @@ -0,0 +1,1041 @@ +From 527a95de9b8cdff2c0dc87659b2015714048b91e Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:57 +0100 +Subject: [PATCH 019/146] FROMGIT: ASoC: meson: axg: extract sound card utils + +This prepares the addition of the GX SoC family sound card driver. +The GX sound card, while slightly different, will be similar to the +AXG one. The purpose of this change is to share the utils common to +both sound card driver. + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/Kconfig | 4 + + sound/soc/meson/Makefile | 2 + + sound/soc/meson/axg-card.c | 403 ++--------------------------- + sound/soc/meson/meson-card-utils.c | 385 +++++++++++++++++++++++++++ + sound/soc/meson/meson-card.h | 55 ++++ + 5 files changed, 473 insertions(+), 376 deletions(-) + create mode 100644 sound/soc/meson/meson-card-utils.c + create mode 100644 sound/soc/meson/meson-card.h + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index 19de97ae4ce9..347fa78e309a 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -59,6 +59,7 @@ config SND_MESON_AXG_TDMOUT + config SND_MESON_AXG_SOUND_CARD + tristate "Amlogic AXG Sound Card Support" + select SND_MESON_AXG_TDM_INTERFACE ++ select SND_MESON_CARD_UTILS + imply SND_MESON_AXG_FRDDR + imply SND_MESON_AXG_TODDR + imply SND_MESON_AXG_TDMIN +@@ -94,6 +95,9 @@ config SND_MESON_AXG_PDM + Select Y or M to add support for PDM input embedded + in the Amlogic AXG SoC family + ++config SND_MESON_CARD_UTILS ++ tristate ++ + config SND_MESON_CODEC_GLUE + tristate + +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index 80f9113701b3..bef2b72fd7a7 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -19,6 +19,7 @@ snd-soc-meson-axg-sound-card-objs := axg-card.o + snd-soc-meson-axg-spdifin-objs := axg-spdifin.o + snd-soc-meson-axg-spdifout-objs := axg-spdifout.o + snd-soc-meson-axg-pdm-objs := axg-pdm.o ++snd-soc-meson-card-utils-objs := meson-card-utils.o + snd-soc-meson-codec-glue-objs := meson-codec-glue.o + snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o + +@@ -34,5 +35,6 @@ obj-$(CONFIG_SND_MESON_AXG_SOUND_CARD) += snd-soc-meson-axg-sound-card.o + obj-$(CONFIG_SND_MESON_AXG_SPDIFIN) += snd-soc-meson-axg-spdifin.o + obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o + obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o ++obj-$(CONFIG_SND_MESON_CARD_UTILS) += snd-soc-meson-card-utils.o + obj-$(CONFIG_SND_MESON_CODEC_GLUE) += snd-soc-meson-codec-glue.o + obj-$(CONFIG_SND_MESON_G12A_TOHDMITX) += snd-soc-meson-g12a-tohdmitx.o +diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c +index 1f698adde506..372dc696cc8e 100644 +--- a/sound/soc/meson/axg-card.c ++++ b/sound/soc/meson/axg-card.c +@@ -9,11 +9,7 @@ + #include + + #include "axg-tdm.h" +- +-struct axg_card { +- struct snd_soc_card card; +- void **link_data; +-}; ++#include "meson-card.h" + + struct axg_dai_link_tdm_mask { + u32 tx; +@@ -41,161 +37,15 @@ static const struct snd_soc_pcm_stream codec_params = { + .channels_max = 8, + }; + +-#define PREFIX "amlogic," +- +-static int axg_card_reallocate_links(struct axg_card *priv, +- unsigned int num_links) +-{ +- struct snd_soc_dai_link *links; +- void **ldata; +- +- links = krealloc(priv->card.dai_link, +- num_links * sizeof(*priv->card.dai_link), +- GFP_KERNEL | __GFP_ZERO); +- ldata = krealloc(priv->link_data, +- num_links * sizeof(*priv->link_data), +- GFP_KERNEL | __GFP_ZERO); +- +- if (!links || !ldata) { +- dev_err(priv->card.dev, "failed to allocate links\n"); +- return -ENOMEM; +- } +- +- priv->card.dai_link = links; +- priv->link_data = ldata; +- priv->card.num_links = num_links; +- return 0; +-} +- +-static int axg_card_parse_dai(struct snd_soc_card *card, +- struct device_node *node, +- struct device_node **dai_of_node, +- const char **dai_name) +-{ +- struct of_phandle_args args; +- int ret; +- +- if (!dai_name || !dai_of_node || !node) +- return -EINVAL; +- +- ret = of_parse_phandle_with_args(node, "sound-dai", +- "#sound-dai-cells", 0, &args); +- if (ret) { +- if (ret != -EPROBE_DEFER) +- dev_err(card->dev, "can't parse dai %d\n", ret); +- return ret; +- } +- *dai_of_node = args.np; +- +- return snd_soc_get_dai_name(&args, dai_name); +-} +- +-static int axg_card_set_link_name(struct snd_soc_card *card, +- struct snd_soc_dai_link *link, +- struct device_node *node, +- const char *prefix) +-{ +- char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s", +- prefix, node->full_name); +- if (!name) +- return -ENOMEM; +- +- link->name = name; +- link->stream_name = name; +- +- return 0; +-} +- +-static void axg_card_clean_references(struct axg_card *priv) +-{ +- struct snd_soc_card *card = &priv->card; +- struct snd_soc_dai_link *link; +- struct snd_soc_dai_link_component *codec; +- struct snd_soc_aux_dev *aux; +- int i, j; +- +- if (card->dai_link) { +- for_each_card_prelinks(card, i, link) { +- if (link->cpus) +- of_node_put(link->cpus->of_node); +- for_each_link_codecs(link, j, codec) +- of_node_put(codec->of_node); +- } +- } +- +- if (card->aux_dev) { +- for_each_card_pre_auxs(card, i, aux) +- of_node_put(aux->dlc.of_node); +- } +- +- kfree(card->dai_link); +- kfree(priv->link_data); +-} +- +-static int axg_card_add_aux_devices(struct snd_soc_card *card) +-{ +- struct device_node *node = card->dev->of_node; +- struct snd_soc_aux_dev *aux; +- int num, i; +- +- num = of_count_phandle_with_args(node, "audio-aux-devs", NULL); +- if (num == -ENOENT) { +- /* +- * It is ok to have no auxiliary devices but for this card it +- * is a strange situtation. Let's warn the about it. +- */ +- dev_warn(card->dev, "card has no auxiliary devices\n"); +- return 0; +- } else if (num < 0) { +- dev_err(card->dev, "error getting auxiliary devices: %d\n", +- num); +- return num; +- } +- +- aux = devm_kcalloc(card->dev, num, sizeof(*aux), GFP_KERNEL); +- if (!aux) +- return -ENOMEM; +- card->aux_dev = aux; +- card->num_aux_devs = num; +- +- for_each_card_pre_auxs(card, i, aux) { +- aux->dlc.of_node = +- of_parse_phandle(node, "audio-aux-devs", i); +- if (!aux->dlc.of_node) +- return -EINVAL; +- } +- +- return 0; +-} +- + static int axg_card_tdm_be_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) + { + struct snd_soc_pcm_runtime *rtd = substream->private_data; +- struct axg_card *priv = snd_soc_card_get_drvdata(rtd->card); ++ struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); + struct axg_dai_link_tdm_data *be = + (struct axg_dai_link_tdm_data *)priv->link_data[rtd->num]; +- struct snd_soc_dai *codec_dai; +- unsigned int mclk; +- int ret, i; +- +- if (be->mclk_fs) { +- mclk = params_rate(params) * be->mclk_fs; +- +- for_each_rtd_codec_dai(rtd, i, codec_dai) { +- ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, +- SND_SOC_CLOCK_IN); +- if (ret && ret != -ENOTSUPP) +- return ret; +- } +- +- ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, 0, mclk, +- SND_SOC_CLOCK_OUT); +- if (ret && ret != -ENOTSUPP) +- return ret; +- } + +- return 0; ++ return meson_card_i2s_set_sysclk(substream, params, be->mclk_fs); + } + + static const struct snd_soc_ops axg_card_tdm_be_ops = { +@@ -204,7 +54,7 @@ static const struct snd_soc_ops axg_card_tdm_be_ops = { + + static int axg_card_tdm_dai_init(struct snd_soc_pcm_runtime *rtd) + { +- struct axg_card *priv = snd_soc_card_get_drvdata(rtd->card); ++ struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); + struct axg_dai_link_tdm_data *be = + (struct axg_dai_link_tdm_data *)priv->link_data[rtd->num]; + struct snd_soc_dai *codec_dai; +@@ -234,7 +84,7 @@ static int axg_card_tdm_dai_init(struct snd_soc_pcm_runtime *rtd) + + static int axg_card_tdm_dai_lb_init(struct snd_soc_pcm_runtime *rtd) + { +- struct axg_card *priv = snd_soc_card_get_drvdata(rtd->card); ++ struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); + struct axg_dai_link_tdm_data *be = + (struct axg_dai_link_tdm_data *)priv->link_data[rtd->num]; + int ret; +@@ -253,14 +103,14 @@ static int axg_card_tdm_dai_lb_init(struct snd_soc_pcm_runtime *rtd) + static int axg_card_add_tdm_loopback(struct snd_soc_card *card, + int *index) + { +- struct axg_card *priv = snd_soc_card_get_drvdata(card); ++ struct meson_card *priv = snd_soc_card_get_drvdata(card); + struct snd_soc_dai_link *pad = &card->dai_link[*index]; + struct snd_soc_dai_link *lb; + struct snd_soc_dai_link_component *dlc; + int ret; + + /* extend links */ +- ret = axg_card_reallocate_links(priv, card->num_links + 1); ++ ret = meson_card_reallocate_links(card, card->num_links + 1); + if (ret) + return ret; + +@@ -304,32 +154,6 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card, + return 0; + } + +-static unsigned int axg_card_parse_daifmt(struct device_node *node, +- struct device_node *cpu_node) +-{ +- struct device_node *bitclkmaster = NULL; +- struct device_node *framemaster = NULL; +- unsigned int daifmt; +- +- daifmt = snd_soc_of_parse_daifmt(node, PREFIX, +- &bitclkmaster, &framemaster); +- daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; +- +- /* If no master is provided, default to cpu master */ +- if (!bitclkmaster || bitclkmaster == cpu_node) { +- daifmt |= (!framemaster || framemaster == cpu_node) ? +- SND_SOC_DAIFMT_CBS_CFS : SND_SOC_DAIFMT_CBS_CFM; +- } else { +- daifmt |= (!framemaster || framemaster == cpu_node) ? +- SND_SOC_DAIFMT_CBM_CFS : SND_SOC_DAIFMT_CBM_CFM; +- } +- +- of_node_put(bitclkmaster); +- of_node_put(framemaster); +- +- return daifmt; +-} +- + static int axg_card_parse_cpu_tdm_slots(struct snd_soc_card *card, + struct snd_soc_dai_link *link, + struct device_node *node, +@@ -424,7 +248,7 @@ static int axg_card_parse_tdm(struct snd_soc_card *card, + struct device_node *node, + int *index) + { +- struct axg_card *priv = snd_soc_card_get_drvdata(card); ++ struct meson_card *priv = snd_soc_card_get_drvdata(card); + struct snd_soc_dai_link *link = &card->dai_link[*index]; + struct axg_dai_link_tdm_data *be; + int ret; +@@ -438,7 +262,7 @@ static int axg_card_parse_tdm(struct snd_soc_card *card, + /* Setup tdm link */ + link->ops = &axg_card_tdm_be_ops; + link->init = axg_card_tdm_dai_init; +- link->dai_fmt = axg_card_parse_daifmt(node, link->cpus->of_node); ++ link->dai_fmt = meson_card_parse_daifmt(node, link->cpus->of_node); + + of_property_read_u32(node, "mclk-fs", &be->mclk_fs); + +@@ -462,97 +286,24 @@ static int axg_card_parse_tdm(struct snd_soc_card *card, + return 0; + } + +-static int axg_card_set_be_link(struct snd_soc_card *card, +- struct snd_soc_dai_link *link, +- struct device_node *node) +-{ +- struct snd_soc_dai_link_component *codec; +- struct device_node *np; +- int ret, num_codecs; +- +- link->no_pcm = 1; +- link->dpcm_playback = 1; +- link->dpcm_capture = 1; +- +- num_codecs = of_get_child_count(node); +- if (!num_codecs) { +- dev_err(card->dev, "be link %s has no codec\n", +- node->full_name); +- return -EINVAL; +- } +- +- codec = devm_kcalloc(card->dev, num_codecs, sizeof(*codec), GFP_KERNEL); +- if (!codec) +- return -ENOMEM; +- +- link->codecs = codec; +- link->num_codecs = num_codecs; +- +- for_each_child_of_node(node, np) { +- ret = axg_card_parse_dai(card, np, &codec->of_node, +- &codec->dai_name); +- if (ret) { +- of_node_put(np); +- return ret; +- } +- +- codec++; +- } +- +- ret = axg_card_set_link_name(card, link, node, "be"); +- if (ret) +- dev_err(card->dev, "error setting %pOFn link name\n", np); +- +- return ret; +-} +- +-static int axg_card_set_fe_link(struct snd_soc_card *card, +- struct snd_soc_dai_link *link, +- struct device_node *node, +- bool is_playback) +-{ +- struct snd_soc_dai_link_component *codec; +- +- codec = devm_kzalloc(card->dev, sizeof(*codec), GFP_KERNEL); +- if (!codec) +- return -ENOMEM; +- +- link->codecs = codec; +- link->num_codecs = 1; +- +- link->dynamic = 1; +- link->dpcm_merged_format = 1; +- link->dpcm_merged_chan = 1; +- link->dpcm_merged_rate = 1; +- link->codecs->dai_name = "snd-soc-dummy-dai"; +- link->codecs->name = "snd-soc-dummy"; +- +- if (is_playback) +- link->dpcm_playback = 1; +- else +- link->dpcm_capture = 1; +- +- return axg_card_set_link_name(card, link, node, "fe"); +-} +- + static int axg_card_cpu_is_capture_fe(struct device_node *np) + { +- return of_device_is_compatible(np, PREFIX "axg-toddr"); ++ return of_device_is_compatible(np, DT_PREFIX "axg-toddr"); + } + + static int axg_card_cpu_is_playback_fe(struct device_node *np) + { +- return of_device_is_compatible(np, PREFIX "axg-frddr"); ++ return of_device_is_compatible(np, DT_PREFIX "axg-frddr"); + } + + static int axg_card_cpu_is_tdm_iface(struct device_node *np) + { +- return of_device_is_compatible(np, PREFIX "axg-tdm-iface"); ++ return of_device_is_compatible(np, DT_PREFIX "axg-tdm-iface"); + } + + static int axg_card_cpu_is_codec(struct device_node *np) + { +- return of_device_is_compatible(np, PREFIX "g12a-tohdmitx"); ++ return of_device_is_compatible(np, DT_PREFIX "g12a-tohdmitx"); + } + + static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, +@@ -569,17 +320,17 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, + dai_link->cpus = cpu; + dai_link->num_cpus = 1; + +- ret = axg_card_parse_dai(card, np, &dai_link->cpus->of_node, +- &dai_link->cpus->dai_name); ++ ret = meson_card_parse_dai(card, np, &dai_link->cpus->of_node, ++ &dai_link->cpus->dai_name); + if (ret) + return ret; + + if (axg_card_cpu_is_playback_fe(dai_link->cpus->of_node)) +- ret = axg_card_set_fe_link(card, dai_link, np, true); ++ ret = meson_card_set_fe_link(card, dai_link, np, true); + else if (axg_card_cpu_is_capture_fe(dai_link->cpus->of_node)) +- ret = axg_card_set_fe_link(card, dai_link, np, false); ++ ret = meson_card_set_fe_link(card, dai_link, np, false); + else +- ret = axg_card_set_be_link(card, dai_link, np); ++ ret = meson_card_set_be_link(card, dai_link, np); + + if (ret) + return ret; +@@ -592,121 +343,21 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, + return ret; + } + +-static int axg_card_add_links(struct snd_soc_card *card) +-{ +- struct axg_card *priv = snd_soc_card_get_drvdata(card); +- struct device_node *node = card->dev->of_node; +- struct device_node *np; +- int num, i, ret; +- +- num = of_get_child_count(node); +- if (!num) { +- dev_err(card->dev, "card has no links\n"); +- return -EINVAL; +- } +- +- ret = axg_card_reallocate_links(priv, num); +- if (ret) +- return ret; +- +- i = 0; +- for_each_child_of_node(node, np) { +- ret = axg_card_add_link(card, np, &i); +- if (ret) { +- of_node_put(np); +- return ret; +- } +- +- i++; +- } +- +- return 0; +-} +- +-static int axg_card_parse_of_optional(struct snd_soc_card *card, +- const char *propname, +- int (*func)(struct snd_soc_card *c, +- const char *p)) +-{ +- /* If property is not provided, don't fail ... */ +- if (!of_property_read_bool(card->dev->of_node, propname)) +- return 0; +- +- /* ... but do fail if it is provided and the parsing fails */ +- return func(card, propname); +-} ++static const struct meson_card_match_data axg_card_match_data = { ++ .add_link = axg_card_add_link, ++}; + + static const struct of_device_id axg_card_of_match[] = { +- { .compatible = "amlogic,axg-sound-card", }, +- {} ++ { ++ .compatible = "amlogic,axg-sound-card", ++ .data = &axg_card_match_data, ++ }, {} + }; + MODULE_DEVICE_TABLE(of, axg_card_of_match); + +-static int axg_card_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct axg_card *priv; +- int ret; +- +- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); +- if (!priv) +- return -ENOMEM; +- +- platform_set_drvdata(pdev, priv); +- snd_soc_card_set_drvdata(&priv->card, priv); +- +- priv->card.owner = THIS_MODULE; +- priv->card.dev = dev; +- +- ret = snd_soc_of_parse_card_name(&priv->card, "model"); +- if (ret < 0) +- return ret; +- +- ret = axg_card_parse_of_optional(&priv->card, "audio-routing", +- snd_soc_of_parse_audio_routing); +- if (ret) { +- dev_err(dev, "error while parsing routing\n"); +- return ret; +- } +- +- ret = axg_card_parse_of_optional(&priv->card, "audio-widgets", +- snd_soc_of_parse_audio_simple_widgets); +- if (ret) { +- dev_err(dev, "error while parsing widgets\n"); +- return ret; +- } +- +- ret = axg_card_add_links(&priv->card); +- if (ret) +- goto out_err; +- +- ret = axg_card_add_aux_devices(&priv->card); +- if (ret) +- goto out_err; +- +- ret = devm_snd_soc_register_card(dev, &priv->card); +- if (ret) +- goto out_err; +- +- return 0; +- +-out_err: +- axg_card_clean_references(priv); +- return ret; +-} +- +-static int axg_card_remove(struct platform_device *pdev) +-{ +- struct axg_card *priv = platform_get_drvdata(pdev); +- +- axg_card_clean_references(priv); +- +- return 0; +-} +- + static struct platform_driver axg_card_pdrv = { +- .probe = axg_card_probe, +- .remove = axg_card_remove, ++ .probe = meson_card_probe, ++ .remove = meson_card_remove, + .driver = { + .name = "axg-sound-card", + .of_match_table = axg_card_of_match, +diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c +new file mode 100644 +index 000000000000..a70d244ef88b +--- /dev/null ++++ b/sound/soc/meson/meson-card-utils.c +@@ -0,0 +1,385 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++ ++#include "meson-card.h" ++ ++int meson_card_i2s_set_sysclk(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ unsigned int mclk_fs) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai; ++ unsigned int mclk; ++ int ret, i; ++ ++ if (!mclk_fs) ++ return 0; ++ ++ mclk = params_rate(params) * mclk_fs; ++ ++ for_each_rtd_codec_dai(rtd, i, codec_dai) { ++ ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, ++ SND_SOC_CLOCK_IN); ++ if (ret && ret != -ENOTSUPP) ++ return ret; ++ } ++ ++ ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, 0, mclk, ++ SND_SOC_CLOCK_OUT); ++ if (ret && ret != -ENOTSUPP) ++ return ret; ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_card_i2s_set_sysclk); ++ ++int meson_card_reallocate_links(struct snd_soc_card *card, ++ unsigned int num_links) ++{ ++ struct meson_card *priv = snd_soc_card_get_drvdata(card); ++ struct snd_soc_dai_link *links; ++ void **ldata; ++ ++ links = krealloc(priv->card.dai_link, ++ num_links * sizeof(*priv->card.dai_link), ++ GFP_KERNEL | __GFP_ZERO); ++ ldata = krealloc(priv->link_data, ++ num_links * sizeof(*priv->link_data), ++ GFP_KERNEL | __GFP_ZERO); ++ ++ if (!links || !ldata) { ++ dev_err(priv->card.dev, "failed to allocate links\n"); ++ return -ENOMEM; ++ } ++ ++ priv->card.dai_link = links; ++ priv->link_data = ldata; ++ priv->card.num_links = num_links; ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_card_reallocate_links); ++ ++int meson_card_parse_dai(struct snd_soc_card *card, ++ struct device_node *node, ++ struct device_node **dai_of_node, ++ const char **dai_name) ++{ ++ struct of_phandle_args args; ++ int ret; ++ ++ if (!dai_name || !dai_of_node || !node) ++ return -EINVAL; ++ ++ ret = of_parse_phandle_with_args(node, "sound-dai", ++ "#sound-dai-cells", 0, &args); ++ if (ret) { ++ if (ret != -EPROBE_DEFER) ++ dev_err(card->dev, "can't parse dai %d\n", ret); ++ return ret; ++ } ++ *dai_of_node = args.np; ++ ++ return snd_soc_get_dai_name(&args, dai_name); ++} ++EXPORT_SYMBOL_GPL(meson_card_parse_dai); ++ ++static int meson_card_set_link_name(struct snd_soc_card *card, ++ struct snd_soc_dai_link *link, ++ struct device_node *node, ++ const char *prefix) ++{ ++ char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s", ++ prefix, node->full_name); ++ if (!name) ++ return -ENOMEM; ++ ++ link->name = name; ++ link->stream_name = name; ++ ++ return 0; ++} ++ ++unsigned int meson_card_parse_daifmt(struct device_node *node, ++ struct device_node *cpu_node) ++{ ++ struct device_node *bitclkmaster = NULL; ++ struct device_node *framemaster = NULL; ++ unsigned int daifmt; ++ ++ daifmt = snd_soc_of_parse_daifmt(node, DT_PREFIX, ++ &bitclkmaster, &framemaster); ++ daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; ++ ++ /* If no master is provided, default to cpu master */ ++ if (!bitclkmaster || bitclkmaster == cpu_node) { ++ daifmt |= (!framemaster || framemaster == cpu_node) ? ++ SND_SOC_DAIFMT_CBS_CFS : SND_SOC_DAIFMT_CBS_CFM; ++ } else { ++ daifmt |= (!framemaster || framemaster == cpu_node) ? ++ SND_SOC_DAIFMT_CBM_CFS : SND_SOC_DAIFMT_CBM_CFM; ++ } ++ ++ of_node_put(bitclkmaster); ++ of_node_put(framemaster); ++ ++ return daifmt; ++} ++EXPORT_SYMBOL_GPL(meson_card_parse_daifmt); ++ ++int meson_card_set_be_link(struct snd_soc_card *card, ++ struct snd_soc_dai_link *link, ++ struct device_node *node) ++{ ++ struct snd_soc_dai_link_component *codec; ++ struct device_node *np; ++ int ret, num_codecs; ++ ++ link->no_pcm = 1; ++ link->dpcm_playback = 1; ++ link->dpcm_capture = 1; ++ ++ num_codecs = of_get_child_count(node); ++ if (!num_codecs) { ++ dev_err(card->dev, "be link %s has no codec\n", ++ node->full_name); ++ return -EINVAL; ++ } ++ ++ codec = devm_kcalloc(card->dev, num_codecs, sizeof(*codec), GFP_KERNEL); ++ if (!codec) ++ return -ENOMEM; ++ ++ link->codecs = codec; ++ link->num_codecs = num_codecs; ++ ++ for_each_child_of_node(node, np) { ++ ret = meson_card_parse_dai(card, np, &codec->of_node, ++ &codec->dai_name); ++ if (ret) { ++ of_node_put(np); ++ return ret; ++ } ++ ++ codec++; ++ } ++ ++ ret = meson_card_set_link_name(card, link, node, "be"); ++ if (ret) ++ dev_err(card->dev, "error setting %pOFn link name\n", np); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(meson_card_set_be_link); ++ ++int meson_card_set_fe_link(struct snd_soc_card *card, ++ struct snd_soc_dai_link *link, ++ struct device_node *node, ++ bool is_playback) ++{ ++ struct snd_soc_dai_link_component *codec; ++ ++ codec = devm_kzalloc(card->dev, sizeof(*codec), GFP_KERNEL); ++ if (!codec) ++ return -ENOMEM; ++ ++ link->codecs = codec; ++ link->num_codecs = 1; ++ ++ link->dynamic = 1; ++ link->dpcm_merged_format = 1; ++ link->dpcm_merged_chan = 1; ++ link->dpcm_merged_rate = 1; ++ link->codecs->dai_name = "snd-soc-dummy-dai"; ++ link->codecs->name = "snd-soc-dummy"; ++ ++ if (is_playback) ++ link->dpcm_playback = 1; ++ else ++ link->dpcm_capture = 1; ++ ++ return meson_card_set_link_name(card, link, node, "fe"); ++} ++EXPORT_SYMBOL_GPL(meson_card_set_fe_link); ++ ++static int meson_card_add_links(struct snd_soc_card *card) ++{ ++ struct meson_card *priv = snd_soc_card_get_drvdata(card); ++ struct device_node *node = card->dev->of_node; ++ struct device_node *np; ++ int num, i, ret; ++ ++ num = of_get_child_count(node); ++ if (!num) { ++ dev_err(card->dev, "card has no links\n"); ++ return -EINVAL; ++ } ++ ++ ret = meson_card_reallocate_links(card, num); ++ if (ret) ++ return ret; ++ ++ i = 0; ++ for_each_child_of_node(node, np) { ++ ret = priv->match_data->add_link(card, np, &i); ++ if (ret) { ++ of_node_put(np); ++ return ret; ++ } ++ ++ i++; ++ } ++ ++ return 0; ++} ++ ++static int meson_card_parse_of_optional(struct snd_soc_card *card, ++ const char *propname, ++ int (*func)(struct snd_soc_card *c, ++ const char *p)) ++{ ++ /* If property is not provided, don't fail ... */ ++ if (!of_property_read_bool(card->dev->of_node, propname)) ++ return 0; ++ ++ /* ... but do fail if it is provided and the parsing fails */ ++ return func(card, propname); ++} ++ ++static int meson_card_add_aux_devices(struct snd_soc_card *card) ++{ ++ struct device_node *node = card->dev->of_node; ++ struct snd_soc_aux_dev *aux; ++ int num, i; ++ ++ num = of_count_phandle_with_args(node, "audio-aux-devs", NULL); ++ if (num == -ENOENT) { ++ return 0; ++ } else if (num < 0) { ++ dev_err(card->dev, "error getting auxiliary devices: %d\n", ++ num); ++ return num; ++ } ++ ++ aux = devm_kcalloc(card->dev, num, sizeof(*aux), GFP_KERNEL); ++ if (!aux) ++ return -ENOMEM; ++ card->aux_dev = aux; ++ card->num_aux_devs = num; ++ ++ for_each_card_pre_auxs(card, i, aux) { ++ aux->dlc.of_node = ++ of_parse_phandle(node, "audio-aux-devs", i); ++ if (!aux->dlc.of_node) ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static void meson_card_clean_references(struct meson_card *priv) ++{ ++ struct snd_soc_card *card = &priv->card; ++ struct snd_soc_dai_link *link; ++ struct snd_soc_dai_link_component *codec; ++ struct snd_soc_aux_dev *aux; ++ int i, j; ++ ++ if (card->dai_link) { ++ for_each_card_prelinks(card, i, link) { ++ if (link->cpus) ++ of_node_put(link->cpus->of_node); ++ for_each_link_codecs(link, j, codec) ++ of_node_put(codec->of_node); ++ } ++ } ++ ++ if (card->aux_dev) { ++ for_each_card_pre_auxs(card, i, aux) ++ of_node_put(aux->dlc.of_node); ++ } ++ ++ kfree(card->dai_link); ++ kfree(priv->link_data); ++} ++ ++int meson_card_probe(struct platform_device *pdev) ++{ ++ const struct meson_card_match_data *data; ++ struct device *dev = &pdev->dev; ++ struct meson_card *priv; ++ int ret; ++ ++ data = of_device_get_match_data(dev); ++ if (!data) { ++ dev_err(dev, "failed to match device\n"); ++ return -ENODEV; ++ } ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, priv); ++ snd_soc_card_set_drvdata(&priv->card, priv); ++ ++ priv->card.owner = THIS_MODULE; ++ priv->card.dev = dev; ++ priv->match_data = data; ++ ++ ret = snd_soc_of_parse_card_name(&priv->card, "model"); ++ if (ret < 0) ++ return ret; ++ ++ ret = meson_card_parse_of_optional(&priv->card, "audio-routing", ++ snd_soc_of_parse_audio_routing); ++ if (ret) { ++ dev_err(dev, "error while parsing routing\n"); ++ return ret; ++ } ++ ++ ret = meson_card_parse_of_optional(&priv->card, "audio-widgets", ++ snd_soc_of_parse_audio_simple_widgets); ++ if (ret) { ++ dev_err(dev, "error while parsing widgets\n"); ++ return ret; ++ } ++ ++ ret = meson_card_add_links(&priv->card); ++ if (ret) ++ goto out_err; ++ ++ ret = meson_card_add_aux_devices(&priv->card); ++ if (ret) ++ goto out_err; ++ ++ ret = devm_snd_soc_register_card(dev, &priv->card); ++ if (ret) ++ goto out_err; ++ ++ return 0; ++ ++out_err: ++ meson_card_clean_references(priv); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(meson_card_probe); ++ ++int meson_card_remove(struct platform_device *pdev) ++{ ++ struct meson_card *priv = platform_get_drvdata(pdev); ++ ++ meson_card_clean_references(priv); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_card_remove); ++ ++MODULE_DESCRIPTION("Amlogic Sound Card Utils"); ++MODULE_AUTHOR("Jerome Brunet "); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/meson/meson-card.h b/sound/soc/meson/meson-card.h +new file mode 100644 +index 000000000000..74314071c80d +--- /dev/null ++++ b/sound/soc/meson/meson-card.h +@@ -0,0 +1,55 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2020 BayLibre, SAS. ++ * Author: Jerome Brunet ++ */ ++ ++#ifndef _MESON_SND_CARD_H ++#define _MESON_SND_CARD_H ++ ++struct device_node; ++struct platform_device; ++ ++struct snd_soc_card; ++struct snd_pcm_substream; ++struct snd_pcm_hw_params; ++ ++#define DT_PREFIX "amlogic," ++ ++struct meson_card_match_data { ++ int (*add_link)(struct snd_soc_card *card, ++ struct device_node *node, ++ int *index); ++}; ++ ++struct meson_card { ++ const struct meson_card_match_data *match_data; ++ struct snd_soc_card card; ++ void **link_data; ++}; ++ ++unsigned int meson_card_parse_daifmt(struct device_node *node, ++ struct device_node *cpu_node); ++ ++int meson_card_i2s_set_sysclk(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ unsigned int mclk_fs); ++ ++int meson_card_reallocate_links(struct snd_soc_card *card, ++ unsigned int num_links); ++int meson_card_parse_dai(struct snd_soc_card *card, ++ struct device_node *node, ++ struct device_node **dai_of_node, ++ const char **dai_name); ++int meson_card_set_be_link(struct snd_soc_card *card, ++ struct snd_soc_dai_link *link, ++ struct device_node *node); ++int meson_card_set_fe_link(struct snd_soc_card *card, ++ struct snd_soc_dai_link *link, ++ struct device_node *node, ++ bool is_playback); ++ ++int meson_card_probe(struct platform_device *pdev); ++int meson_card_remove(struct platform_device *pdev); ++ ++#endif /* _MESON_SND_CARD_H */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-soc-amlogic-meson-clk-measure-protect-measur.patch b/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-soc-amlogic-meson-clk-measure-protect-measur.patch deleted file mode 100644 index 7f5824ad62..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-soc-amlogic-meson-clk-measure-protect-measur.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8bd2487a1685a03b18f96244000ec4d04878b6ed Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:02:17 +0200 -Subject: [PATCH 019/187] FROMGIT: soc: amlogic: meson-clk-measure: protect - measure with a mutex - -In order to protect clock measuring when multiple process asks for -a measure, protect the main measure function with mutexes. - -Reviewed-by: Kevin Hilman -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong -Signed-off-by: Kevin Hilman -(cherry picked from commit 3a760d986568b67d1f8411dab64608075817b90d - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/drivers) ---- - drivers/soc/amlogic/meson-clk-measure.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/drivers/soc/amlogic/meson-clk-measure.c b/drivers/soc/amlogic/meson-clk-measure.c -index 19d4cbc93a17..c470e24f1dfa 100644 ---- a/drivers/soc/amlogic/meson-clk-measure.c -+++ b/drivers/soc/amlogic/meson-clk-measure.c -@@ -11,6 +11,8 @@ - #include - #include - -+static DEFINE_MUTEX(measure_lock); -+ - #define MSR_CLK_DUTY 0x0 - #define MSR_CLK_REG0 0x4 - #define MSR_CLK_REG1 0x8 -@@ -360,6 +362,10 @@ static int meson_measure_id(struct meson_msr_id *clk_msr_id, - unsigned int val; - int ret; - -+ ret = mutex_lock_interruptible(&measure_lock); -+ if (ret) -+ return ret; -+ - regmap_write(priv->regmap, MSR_CLK_REG0, 0); - - /* Set measurement duration */ -@@ -377,8 +383,10 @@ static int meson_measure_id(struct meson_msr_id *clk_msr_id, - - ret = regmap_read_poll_timeout(priv->regmap, MSR_CLK_REG0, - val, !(val & MSR_BUSY), 10, 10000); -- if (ret) -+ if (ret) { -+ mutex_unlock(&measure_lock); - return ret; -+ } - - /* Disable */ - regmap_update_bits(priv->regmap, MSR_CLK_REG0, MSR_ENABLE, 0); -@@ -386,6 +394,8 @@ static int meson_measure_id(struct meson_msr_id *clk_msr_id, - /* Get the value in multiple of gate time counts */ - regmap_read(priv->regmap, MSR_CLK_REG2, &val); - -+ mutex_unlock(&measure_lock); -+ - if (val >= MSR_VAL_MASK) - return -EINVAL; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-ASoC-meson-gx-add-sound-card-dt-binding-docu.patch b/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-ASoC-meson-gx-add-sound-card-dt-binding-docu.patch new file mode 100644 index 0000000000..373bdeacd5 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-ASoC-meson-gx-add-sound-card-dt-binding-docu.patch @@ -0,0 +1,138 @@ +From d23068202d53370a8d4aa52219584943d8a526c8 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:58 +0100 +Subject: [PATCH 020/146] FROMGIT: ASoC: meson: gx: add sound card dt-binding + documentation + +Add the dt-binding documentation of sound card supporting the amlogic +GX SoC family + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + .../bindings/sound/amlogic,gx-sound-card.yaml | 113 ++++++++++++++++++ + 1 file changed, 113 insertions(+) + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml +new file mode 100644 +index 000000000000..fb374c659be1 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml +@@ -0,0 +1,113 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,gx-sound-card.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic GX sound card ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ compatible: ++ items: ++ - const: amlogic,gx-sound-card ++ ++ audio-aux-devs: ++ $ref: /schemas/types.yaml#/definitions/phandle-array ++ description: list of auxiliary devices ++ ++ audio-routing: ++ $ref: /schemas/types.yaml#/definitions/non-unique-string-array ++ minItems: 2 ++ description: |- ++ A list of the connections between audio components. Each entry is a ++ pair of strings, the first being the connection's sink, the second ++ being the connection's source. ++ ++ audio-widgets: ++ $ref: /schemas/types.yaml#/definitions/non-unique-string-array ++ minItems: 2 ++ description: |- ++ A list off component DAPM widget. Each entry is a pair of strings, ++ the first being the widget type, the second being the widget name ++ ++ model: ++ $ref: /schemas/types.yaml#/definitions/string ++ description: User specified audio sound card name ++ ++patternProperties: ++ "^dai-link-[0-9]+$": ++ type: object ++ description: |- ++ dai-link child nodes: ++ Container for dai-link level properties and the CODEC sub-nodes. ++ There should be at least one (and probably more) subnode of this type ++ ++ properties: ++ dai-format: ++ $ref: /schemas/types.yaml#/definitions/string ++ enum: [ i2s, left-j, dsp_a ] ++ ++ mclk-fs: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: |- ++ Multiplication factor between the frame rate and master clock ++ rate ++ ++ sound-dai: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: phandle of the CPU DAI ++ ++ patternProperties: ++ "^codec-[0-9]+$": ++ type: object ++ description: |- ++ Codecs: ++ dai-link representing backend links should have at least one subnode. ++ One subnode for each codec of the dai-link. dai-link representing ++ frontend links have no codec, therefore have no subnodes ++ ++ properties: ++ sound-dai: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: phandle of the codec DAI ++ ++ required: ++ - sound-dai ++ ++ required: ++ - sound-dai ++ ++required: ++ - model ++ - dai-link-0 ++ ++examples: ++ - | ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-ACME-S905X-FOO"; ++ audio-aux-devs = <&>; ++ audio-routing = "I2S ENCODER I2S IN", "I2S FIFO Playback"; ++ ++ dai-link-0 { ++ sound-dai = <&i2s_fifo>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&i2s_encoder>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&codec0>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&codec1>; ++ }; ++ }; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-soc-amlogic-meson-clk-measure-add-G12B-secon.patch b/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-soc-amlogic-meson-clk-measure-add-G12B-secon.patch deleted file mode 100644 index e06e40a36d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-soc-amlogic-meson-clk-measure-add-G12B-secon.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 83812e17ee43427df1b1de8b0de22834e7ecd394 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:02:18 +0200 -Subject: [PATCH 020/187] FROMGIT: soc: amlogic: meson-clk-measure: add G12B - second cluster cpu clk - -Add the G12B second CPU cluster CPU and SYS_PLL measure IDs. - -These IDs returns 0Hz on G12A. - -Reviewed-by: Kevin Hilman -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong -Signed-off-by: Kevin Hilman -(cherry picked from commit c33b2777d01eb0039a53f14f8c0e4cca8df501c7 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/drivers) -Signed-off-by: Neil Armstrong ---- - drivers/soc/amlogic/meson-clk-measure.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/soc/amlogic/meson-clk-measure.c b/drivers/soc/amlogic/meson-clk-measure.c -index c470e24f1dfa..f09b404b39d3 100644 ---- a/drivers/soc/amlogic/meson-clk-measure.c -+++ b/drivers/soc/amlogic/meson-clk-measure.c -@@ -324,6 +324,8 @@ static struct meson_msr_id clk_msr_g12a[CLK_MSR_MAX] = { - CLK_MSR_ID(84, "co_tx"), - CLK_MSR_ID(89, "hdmi_todig"), - CLK_MSR_ID(90, "hdmitx_sys"), -+ CLK_MSR_ID(91, "sys_cpub_div16"), -+ CLK_MSR_ID(92, "sys_pll_cpub_div16"), - CLK_MSR_ID(94, "eth_phy_rx"), - CLK_MSR_ID(95, "eth_phy_pll"), - CLK_MSR_ID(96, "vpu_b"), --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-ASoC-meson-gx-add-sound-card-support.patch b/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-ASoC-meson-gx-add-sound-card-support.patch new file mode 100644 index 0000000000..8954e028f2 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-ASoC-meson-gx-add-sound-card-support.patch @@ -0,0 +1,202 @@ +From 5e137ff2cdafade10881b0197e4d1b27319a418f Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 13 Feb 2020 16:51:59 +0100 +Subject: [PATCH 021/146] FROMGIT: ASoC: meson: gx: add sound card support + +Add support for the sound card used on the amlogic GX SoC family + +Signed-off-by: Jerome Brunet +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/Kconfig | 7 ++ + sound/soc/meson/Makefile | 2 + + sound/soc/meson/gx-card.c | 141 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 150 insertions(+) + create mode 100644 sound/soc/meson/gx-card.c + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index 347fa78e309a..22d2af75b59e 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -101,6 +101,13 @@ config SND_MESON_CARD_UTILS + config SND_MESON_CODEC_GLUE + tristate + ++config SND_MESON_GX_SOUND_CARD ++ tristate "Amlogic GX Sound Card Support" ++ select SND_MESON_CARD_UTILS ++ imply SND_MESON_AIU ++ help ++ Select Y or M to add support for the GXBB/GXL SoC sound card ++ + config SND_MESON_G12A_TOHDMITX + tristate "Amlogic G12A To HDMI TX Control Support" + select REGMAP_MMIO +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index bef2b72fd7a7..f9c90c391498 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -21,6 +21,7 @@ snd-soc-meson-axg-spdifout-objs := axg-spdifout.o + snd-soc-meson-axg-pdm-objs := axg-pdm.o + snd-soc-meson-card-utils-objs := meson-card-utils.o + snd-soc-meson-codec-glue-objs := meson-codec-glue.o ++snd-soc-meson-gx-sound-card-objs := gx-card.o + snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o + + obj-$(CONFIG_SND_MESON_AIU) += snd-soc-meson-aiu.o +@@ -37,4 +38,5 @@ obj-$(CONFIG_SND_MESON_AXG_SPDIFOUT) += snd-soc-meson-axg-spdifout.o + obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o + obj-$(CONFIG_SND_MESON_CARD_UTILS) += snd-soc-meson-card-utils.o + obj-$(CONFIG_SND_MESON_CODEC_GLUE) += snd-soc-meson-codec-glue.o ++obj-$(CONFIG_SND_MESON_GX_SOUND_CARD) += snd-soc-meson-gx-sound-card.o + obj-$(CONFIG_SND_MESON_G12A_TOHDMITX) += snd-soc-meson-g12a-tohdmitx.o +diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c +new file mode 100644 +index 000000000000..7b01dcb73e5e +--- /dev/null ++++ b/sound/soc/meson/gx-card.c +@@ -0,0 +1,141 @@ ++// SPDX-License-Identifier: (GPL-2.0 OR MIT) ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++ ++#include "meson-card.h" ++ ++struct gx_dai_link_i2s_data { ++ unsigned int mclk_fs; ++}; ++ ++/* ++ * Base params for the codec to codec links ++ * Those will be over-written by the CPU side of the link ++ */ ++static const struct snd_soc_pcm_stream codec_params = { ++ .formats = SNDRV_PCM_FMTBIT_S24_LE, ++ .rate_min = 5525, ++ .rate_max = 192000, ++ .channels_min = 1, ++ .channels_max = 8, ++}; ++ ++static int gx_card_i2s_be_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct meson_card *priv = snd_soc_card_get_drvdata(rtd->card); ++ struct gx_dai_link_i2s_data *be = ++ (struct gx_dai_link_i2s_data *)priv->link_data[rtd->num]; ++ ++ return meson_card_i2s_set_sysclk(substream, params, be->mclk_fs); ++} ++ ++static const struct snd_soc_ops gx_card_i2s_be_ops = { ++ .hw_params = gx_card_i2s_be_hw_params, ++}; ++ ++static int gx_card_parse_i2s(struct snd_soc_card *card, ++ struct device_node *node, ++ int *index) ++{ ++ struct meson_card *priv = snd_soc_card_get_drvdata(card); ++ struct snd_soc_dai_link *link = &card->dai_link[*index]; ++ struct gx_dai_link_i2s_data *be; ++ ++ /* Allocate i2s link parameters */ ++ be = devm_kzalloc(card->dev, sizeof(*be), GFP_KERNEL); ++ if (!be) ++ return -ENOMEM; ++ priv->link_data[*index] = be; ++ ++ /* Setup i2s link */ ++ link->ops = &gx_card_i2s_be_ops; ++ link->dai_fmt = meson_card_parse_daifmt(node, link->cpus->of_node); ++ ++ of_property_read_u32(node, "mclk-fs", &be->mclk_fs); ++ ++ return 0; ++} ++ ++static int gx_card_cpu_identify(struct snd_soc_dai_link_component *c, ++ char *match) ++{ ++ if (of_device_is_compatible(c->of_node, DT_PREFIX "aiu")) { ++ if (strstr(c->dai_name, match)) ++ return 1; ++ } ++ ++ /* dai not matched */ ++ return 0; ++} ++ ++static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np, ++ int *index) ++{ ++ struct snd_soc_dai_link *dai_link = &card->dai_link[*index]; ++ struct snd_soc_dai_link_component *cpu; ++ int ret; ++ ++ cpu = devm_kzalloc(card->dev, sizeof(*cpu), GFP_KERNEL); ++ if (!cpu) ++ return -ENOMEM; ++ ++ dai_link->cpus = cpu; ++ dai_link->num_cpus = 1; ++ ++ ret = meson_card_parse_dai(card, np, &dai_link->cpus->of_node, ++ &dai_link->cpus->dai_name); ++ if (ret) ++ return ret; ++ ++ if (gx_card_cpu_identify(dai_link->cpus, "FIFO")) ++ ret = meson_card_set_fe_link(card, dai_link, np, true); ++ else ++ ret = meson_card_set_be_link(card, dai_link, np); ++ ++ if (ret) ++ return ret; ++ ++ /* Check if the cpu is the i2s encoder and parse i2s data */ ++ if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) ++ ret = gx_card_parse_i2s(card, np, index); ++ ++ /* Or apply codec to codec params if necessary */ ++ else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) ++ dai_link->params = &codec_params; ++ ++ return ret; ++} ++ ++static const struct meson_card_match_data gx_card_match_data = { ++ .add_link = gx_card_add_link, ++}; ++ ++static const struct of_device_id gx_card_of_match[] = { ++ { ++ .compatible = "amlogic,gx-sound-card", ++ .data = &gx_card_match_data, ++ }, {} ++}; ++MODULE_DEVICE_TABLE(of, gx_card_of_match); ++ ++static struct platform_driver gx_card_pdrv = { ++ .probe = meson_card_probe, ++ .remove = meson_card_remove, ++ .driver = { ++ .name = "gx-sound-card", ++ .of_match_table = gx_card_of_match, ++ }, ++}; ++module_platform_driver(gx_card_pdrv); ++ ++MODULE_DESCRIPTION("Amlogic GX ALSA machine driver"); ++MODULE_AUTHOR("Jerome Brunet "); ++MODULE_LICENSE("GPL v2"); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-soc-amlogic-meson-gx-socinfo-add-A311D-id.patch b/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-soc-amlogic-meson-gx-socinfo-add-A311D-id.patch deleted file mode 100644 index 791aa576e9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-soc-amlogic-meson-gx-socinfo-add-A311D-id.patch +++ /dev/null @@ -1,32 +0,0 @@ -From feea12203ab6510323691e65967076d2cbd17c65 Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Wed, 31 Jul 2019 14:39:55 +0200 -Subject: [PATCH 021/187] FROMGIT: soc: amlogic: meson-gx-socinfo: add A311D id - -Add the SoC ID for the A311D Amlogic SoC. - -Signed-off-by: Christian Hewitt -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit 0baf212eab4daf8e4882afd624e1403846418610 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/drivers) ---- - drivers/soc/amlogic/meson-gx-socinfo.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c -index bca34954518e..ff86a75939e8 100644 ---- a/drivers/soc/amlogic/meson-gx-socinfo.c -+++ b/drivers/soc/amlogic/meson-gx-socinfo.c -@@ -65,6 +65,7 @@ static const struct meson_gx_package_id { - { "S905D2", 0x28, 0x10, 0xf0 }, - { "S905X2", 0x28, 0x40, 0xf0 }, - { "S922X", 0x29, 0x40, 0xf0 }, -+ { "A311D", 0x29, 0x10, 0xf0 }, - }; - - static inline unsigned int socinfo_to_major(u32 socinfo) --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-ASoC-meson-aiu-remove-unused-encoder-structu.patch b/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-ASoC-meson-aiu-remove-unused-encoder-structu.patch new file mode 100644 index 0000000000..8b8b2f496f --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-ASoC-meson-aiu-remove-unused-encoder-structu.patch @@ -0,0 +1,36 @@ +From 5c2913e476788639e41b07bbb8f60ee74a4a5db4 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 17 Feb 2020 02:47:55 +0000 +Subject: [PATCH 022/146] FROMGIT: ASoC: meson: aiu: remove unused encoder + structure + +Remove an unused structure definition which slipped through the initial +driver submission. + +Fixes: 6ae9ca9ce986 ("ASoC: meson: aiu: add i2s and spdif support") +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/aiu-encoder-i2s.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c +index 13bf029086a9..4900e38e7e49 100644 +--- a/sound/soc/meson/aiu-encoder-i2s.c ++++ b/sound/soc/meson/aiu-encoder-i2s.c +@@ -28,13 +28,6 @@ + #define AIU_CLK_CTRL_MORE_I2S_DIV GENMASK(5, 0) + #define AIU_CODEC_DAC_LRCLK_CTRL_DIV GENMASK(11, 0) + +-struct aiu_encoder_i2s { +- struct clk *aoclk; +- struct clk *mclk; +- struct clk *mixer; +- struct clk *pclk; +-}; +- + static void aiu_encoder_i2s_divider_enable(struct snd_soc_component *component, + bool enable) + { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-arm64-dts-move-common-G12A-G12B-modes-to-mes.patch b/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-arm64-dts-move-common-G12A-G12B-modes-to-mes.patch deleted file mode 100644 index 1d7c877325..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-arm64-dts-move-common-G12A-G12B-modes-to-mes.patch +++ /dev/null @@ -1,4935 +0,0 @@ -From 21c084785c33f4ffc068a12f41f6efbe9bd62515 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:17 +0200 -Subject: [PATCH 022/187] FROMGIT: arm64: dts: move common G12A & G12B modes to - meson-g12-common.dtsi - -To simplify the representation of differences betweem the G12A and G12B -SoCs, move the common nodes into a meson-g12-common.dtsi file and -express the CPU nodes and differences in meson-g12a.dtsi and meson-g12b.dtsi. - -This separation will help for DVFS and future Amlogic SM1 Family support. - -The sd_emmc_a quirk is added in the g12a/g12b since since it's already -known the sd_emmc_a controller is fixed in the next SM1 SoC family. - -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit c49051f9e3bfea3dcaf241095d81e52c9733cdcb - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - .../boot/dts/amlogic/meson-g12-common.dtsi | 2409 +++++++++++++++++ - arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 2406 +--------------- - arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 30 +- - 3 files changed, 2440 insertions(+), 2405 deletions(-) - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -new file mode 100644 -index 000000000000..06e186ca41e3 ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -0,0 +1,2409 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/ { -+ interrupt-parent = <&gic>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ -+ tdmif_a: audio-controller-0 { -+ compatible = "amlogic,axg-tdm-iface"; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "TDM_A"; -+ clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>, -+ <&clkc_audio AUD_CLKID_MST_A_SCLK>, -+ <&clkc_audio AUD_CLKID_MST_A_LRCLK>; -+ clock-names = "mclk", "sclk", "lrclk"; -+ status = "disabled"; -+ }; -+ -+ tdmif_b: audio-controller-1 { -+ compatible = "amlogic,axg-tdm-iface"; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "TDM_B"; -+ clocks = <&clkc_audio AUD_CLKID_MST_B_MCLK>, -+ <&clkc_audio AUD_CLKID_MST_B_SCLK>, -+ <&clkc_audio AUD_CLKID_MST_B_LRCLK>; -+ clock-names = "mclk", "sclk", "lrclk"; -+ status = "disabled"; -+ }; -+ -+ tdmif_c: audio-controller-2 { -+ compatible = "amlogic,axg-tdm-iface"; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "TDM_C"; -+ clocks = <&clkc_audio AUD_CLKID_MST_C_MCLK>, -+ <&clkc_audio AUD_CLKID_MST_C_SCLK>, -+ <&clkc_audio AUD_CLKID_MST_C_LRCLK>; -+ clock-names = "mclk", "sclk", "lrclk"; -+ status = "disabled"; -+ }; -+ -+ efuse: efuse { -+ compatible = "amlogic,meson-gxbb-efuse"; -+ clocks = <&clkc CLKID_EFUSE>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ read-only; -+ }; -+ -+ psci { -+ compatible = "arm,psci-1.0"; -+ method = "smc"; -+ }; -+ -+ reserved-memory { -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges; -+ -+ /* 3 MiB reserved for ARM Trusted Firmware (BL31) */ -+ secmon_reserved: secmon@5000000 { -+ reg = <0x0 0x05000000 0x0 0x300000>; -+ no-map; -+ }; -+ -+ linux,cma { -+ compatible = "shared-dma-pool"; -+ reusable; -+ size = <0x0 0x10000000>; -+ alignment = <0x0 0x400000>; -+ linux,cma-default; -+ }; -+ }; -+ -+ sm: secure-monitor { -+ compatible = "amlogic,meson-gxbb-sm"; -+ }; -+ -+ soc { -+ compatible = "simple-bus"; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges; -+ -+ ethmac: ethernet@ff3f0000 { -+ compatible = "amlogic,meson-axg-dwmac", -+ "snps,dwmac-3.70a", -+ "snps,dwmac"; -+ reg = <0x0 0xff3f0000 0x0 0x10000 -+ 0x0 0xff634540 0x0 0x8>; -+ interrupts = ; -+ interrupt-names = "macirq"; -+ clocks = <&clkc CLKID_ETH>, -+ <&clkc CLKID_FCLK_DIV2>, -+ <&clkc CLKID_MPLL2>; -+ clock-names = "stmmaceth", "clkin0", "clkin1"; -+ status = "disabled"; -+ -+ mdio0: mdio { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "snps,dwmac-mdio"; -+ }; -+ }; -+ -+ apb: bus@ff600000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0xff600000 0x0 0x200000>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0xff600000 0x0 0x200000>; -+ -+ hdmi_tx: hdmi-tx@0 { -+ compatible = "amlogic,meson-g12a-dw-hdmi"; -+ reg = <0x0 0x0 0x0 0x10000>; -+ interrupts = ; -+ resets = <&reset RESET_HDMITX_CAPB3>, -+ <&reset RESET_HDMITX_PHY>, -+ <&reset RESET_HDMITX>; -+ reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy"; -+ clocks = <&clkc CLKID_HDMI>, -+ <&clkc CLKID_HTX_PCLK>, -+ <&clkc CLKID_VPU_INTR>; -+ clock-names = "isfr", "iahb", "venci"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ #sound-dai-cells = <0>; -+ status = "disabled"; -+ -+ /* VPU VENC Input */ -+ hdmi_tx_venc_port: port@0 { -+ reg = <0>; -+ -+ hdmi_tx_in: endpoint { -+ remote-endpoint = <&hdmi_tx_out>; -+ }; -+ }; -+ -+ /* TMDS Output */ -+ hdmi_tx_tmds_port: port@1 { -+ reg = <1>; -+ }; -+ }; -+ -+ apb_efuse: bus@30000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0x30000 0x0 0x2000>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x30000 0x0 0x2000>; -+ -+ hwrng: rng@218 { -+ compatible = "amlogic,meson-rng"; -+ reg = <0x0 0x218 0x0 0x4>; -+ }; -+ }; -+ -+ periphs: bus@34400 { -+ compatible = "simple-bus"; -+ reg = <0x0 0x34400 0x0 0x400>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x34400 0x0 0x400>; -+ -+ periphs_pinctrl: pinctrl@40 { -+ compatible = "amlogic,meson-g12a-periphs-pinctrl"; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges; -+ -+ gpio: bank@40 { -+ reg = <0x0 0x40 0x0 0x4c>, -+ <0x0 0xe8 0x0 0x18>, -+ <0x0 0x120 0x0 0x18>, -+ <0x0 0x2c0 0x0 0x40>, -+ <0x0 0x340 0x0 0x1c>; -+ reg-names = "gpio", -+ "pull", -+ "pull-enable", -+ "mux", -+ "ds"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ gpio-ranges = <&periphs_pinctrl 0 0 86>; -+ }; -+ -+ cec_ao_a_h_pins: cec_ao_a_h { -+ mux { -+ groups = "cec_ao_a_h"; -+ function = "cec_ao_a_h"; -+ bias-disable; -+ }; -+ }; -+ -+ cec_ao_b_h_pins: cec_ao_b_h { -+ mux { -+ groups = "cec_ao_b_h"; -+ function = "cec_ao_b_h"; -+ bias-disable; -+ }; -+ }; -+ -+ emmc_pins: emmc { -+ mux-0 { -+ groups = "emmc_nand_d0", -+ "emmc_nand_d1", -+ "emmc_nand_d2", -+ "emmc_nand_d3", -+ "emmc_nand_d4", -+ "emmc_nand_d5", -+ "emmc_nand_d6", -+ "emmc_nand_d7", -+ "emmc_cmd"; -+ function = "emmc"; -+ bias-pull-up; -+ drive-strength-microamp = <4000>; -+ }; -+ -+ mux-1 { -+ groups = "emmc_clk"; -+ function = "emmc"; -+ bias-disable; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ emmc_ds_pins: emmc-ds { -+ mux { -+ groups = "emmc_nand_ds"; -+ function = "emmc"; -+ bias-pull-down; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ emmc_clk_gate_pins: emmc_clk_gate { -+ mux { -+ groups = "BOOT_8"; -+ function = "gpio_periphs"; -+ bias-pull-down; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ hdmitx_ddc_pins: hdmitx_ddc { -+ mux { -+ groups = "hdmitx_sda", -+ "hdmitx_sck"; -+ function = "hdmitx"; -+ bias-disable; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ hdmitx_hpd_pins: hdmitx_hpd { -+ mux { -+ groups = "hdmitx_hpd_in"; -+ function = "hdmitx"; -+ bias-disable; -+ }; -+ }; -+ -+ -+ i2c0_sda_c_pins: i2c0-sda-c { -+ mux { -+ groups = "i2c0_sda_c"; -+ function = "i2c0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ -+ }; -+ }; -+ -+ i2c0_sck_c_pins: i2c0-sck-c { -+ mux { -+ groups = "i2c0_sck_c"; -+ function = "i2c0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c0_sda_z0_pins: i2c0-sda-z0 { -+ mux { -+ groups = "i2c0_sda_z0"; -+ function = "i2c0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c0_sck_z1_pins: i2c0-sck-z1 { -+ mux { -+ groups = "i2c0_sck_z1"; -+ function = "i2c0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c0_sda_z7_pins: i2c0-sda-z7 { -+ mux { -+ groups = "i2c0_sda_z7"; -+ function = "i2c0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c0_sda_z8_pins: i2c0-sda-z8 { -+ mux { -+ groups = "i2c0_sda_z8"; -+ function = "i2c0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c1_sda_x_pins: i2c1-sda-x { -+ mux { -+ groups = "i2c1_sda_x"; -+ function = "i2c1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c1_sck_x_pins: i2c1-sck-x { -+ mux { -+ groups = "i2c1_sck_x"; -+ function = "i2c1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c1_sda_h2_pins: i2c1-sda-h2 { -+ mux { -+ groups = "i2c1_sda_h2"; -+ function = "i2c1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c1_sck_h3_pins: i2c1-sck-h3 { -+ mux { -+ groups = "i2c1_sck_h3"; -+ function = "i2c1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c1_sda_h6_pins: i2c1-sda-h6 { -+ mux { -+ groups = "i2c1_sda_h6"; -+ function = "i2c1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c1_sck_h7_pins: i2c1-sck-h7 { -+ mux { -+ groups = "i2c1_sck_h7"; -+ function = "i2c1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c2_sda_x_pins: i2c2-sda-x { -+ mux { -+ groups = "i2c2_sda_x"; -+ function = "i2c2"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c2_sck_x_pins: i2c2-sck-x { -+ mux { -+ groups = "i2c2_sck_x"; -+ function = "i2c2"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c2_sda_z_pins: i2c2-sda-z { -+ mux { -+ groups = "i2c2_sda_z"; -+ function = "i2c2"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c2_sck_z_pins: i2c2-sck-z { -+ mux { -+ groups = "i2c2_sck_z"; -+ function = "i2c2"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c3_sda_h_pins: i2c3-sda-h { -+ mux { -+ groups = "i2c3_sda_h"; -+ function = "i2c3"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c3_sck_h_pins: i2c3-sck-h { -+ mux { -+ groups = "i2c3_sck_h"; -+ function = "i2c3"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c3_sda_a_pins: i2c3-sda-a { -+ mux { -+ groups = "i2c3_sda_a"; -+ function = "i2c3"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c3_sck_a_pins: i2c3-sck-a { -+ mux { -+ groups = "i2c3_sck_a"; -+ function = "i2c3"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ mclk0_a_pins: mclk0-a { -+ mux { -+ groups = "mclk0_a"; -+ function = "mclk0"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ mclk1_a_pins: mclk1-a { -+ mux { -+ groups = "mclk1_a"; -+ function = "mclk1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ mclk1_x_pins: mclk1-x { -+ mux { -+ groups = "mclk1_x"; -+ function = "mclk1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ mclk1_z_pins: mclk1-z { -+ mux { -+ groups = "mclk1_z"; -+ function = "mclk1"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ pdm_din0_a_pins: pdm-din0-a { -+ mux { -+ groups = "pdm_din0_a"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din0_c_pins: pdm-din0-c { -+ mux { -+ groups = "pdm_din0_c"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din0_x_pins: pdm-din0-x { -+ mux { -+ groups = "pdm_din0_x"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din0_z_pins: pdm-din0-z { -+ mux { -+ groups = "pdm_din0_z"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din1_a_pins: pdm-din1-a { -+ mux { -+ groups = "pdm_din1_a"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din1_c_pins: pdm-din1-c { -+ mux { -+ groups = "pdm_din1_c"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din1_x_pins: pdm-din1-x { -+ mux { -+ groups = "pdm_din1_x"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din1_z_pins: pdm-din1-z { -+ mux { -+ groups = "pdm_din1_z"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din2_a_pins: pdm-din2-a { -+ mux { -+ groups = "pdm_din2_a"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din2_c_pins: pdm-din2-c { -+ mux { -+ groups = "pdm_din2_c"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din2_x_pins: pdm-din2-x { -+ mux { -+ groups = "pdm_din2_x"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din2_z_pins: pdm-din2-z { -+ mux { -+ groups = "pdm_din2_z"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din3_a_pins: pdm-din3-a { -+ mux { -+ groups = "pdm_din3_a"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din3_c_pins: pdm-din3-c { -+ mux { -+ groups = "pdm_din3_c"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din3_x_pins: pdm-din3-x { -+ mux { -+ groups = "pdm_din3_x"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_din3_z_pins: pdm-din3-z { -+ mux { -+ groups = "pdm_din3_z"; -+ function = "pdm"; -+ bias-disable; -+ }; -+ }; -+ -+ pdm_dclk_a_pins: pdm-dclk-a { -+ mux { -+ groups = "pdm_dclk_a"; -+ function = "pdm"; -+ bias-disable; -+ drive-strength-microamp = <500>; -+ }; -+ }; -+ -+ pdm_dclk_c_pins: pdm-dclk-c { -+ mux { -+ groups = "pdm_dclk_c"; -+ function = "pdm"; -+ bias-disable; -+ drive-strength-microamp = <500>; -+ }; -+ }; -+ -+ pdm_dclk_x_pins: pdm-dclk-x { -+ mux { -+ groups = "pdm_dclk_x"; -+ function = "pdm"; -+ bias-disable; -+ drive-strength-microamp = <500>; -+ }; -+ }; -+ -+ pdm_dclk_z_pins: pdm-dclk-z { -+ mux { -+ groups = "pdm_dclk_z"; -+ function = "pdm"; -+ bias-disable; -+ drive-strength-microamp = <500>; -+ }; -+ }; -+ -+ pwm_a_pins: pwm-a { -+ mux { -+ groups = "pwm_a"; -+ function = "pwm_a"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_b_x7_pins: pwm-b-x7 { -+ mux { -+ groups = "pwm_b_x7"; -+ function = "pwm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_b_x19_pins: pwm-b-x19 { -+ mux { -+ groups = "pwm_b_x19"; -+ function = "pwm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_c_c_pins: pwm-c-c { -+ mux { -+ groups = "pwm_c_c"; -+ function = "pwm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_c_x5_pins: pwm-c-x5 { -+ mux { -+ groups = "pwm_c_x5"; -+ function = "pwm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_c_x8_pins: pwm-c-x8 { -+ mux { -+ groups = "pwm_c_x8"; -+ function = "pwm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_d_x3_pins: pwm-d-x3 { -+ mux { -+ groups = "pwm_d_x3"; -+ function = "pwm_d"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_d_x6_pins: pwm-d-x6 { -+ mux { -+ groups = "pwm_d_x6"; -+ function = "pwm_d"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_e_pins: pwm-e { -+ mux { -+ groups = "pwm_e"; -+ function = "pwm_e"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_f_x_pins: pwm-f-x { -+ mux { -+ groups = "pwm_f_x"; -+ function = "pwm_f"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_f_h_pins: pwm-f-h { -+ mux { -+ groups = "pwm_f_h"; -+ function = "pwm_f"; -+ bias-disable; -+ }; -+ }; -+ -+ sdcard_c_pins: sdcard_c { -+ mux-0 { -+ groups = "sdcard_d0_c", -+ "sdcard_d1_c", -+ "sdcard_d2_c", -+ "sdcard_d3_c", -+ "sdcard_cmd_c"; -+ function = "sdcard"; -+ bias-pull-up; -+ drive-strength-microamp = <4000>; -+ }; -+ -+ mux-1 { -+ groups = "sdcard_clk_c"; -+ function = "sdcard"; -+ bias-disable; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ sdcard_clk_gate_c_pins: sdcard_clk_gate_c { -+ mux { -+ groups = "GPIOC_4"; -+ function = "gpio_periphs"; -+ bias-pull-down; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ sdcard_z_pins: sdcard_z { -+ mux-0 { -+ groups = "sdcard_d0_z", -+ "sdcard_d1_z", -+ "sdcard_d2_z", -+ "sdcard_d3_z", -+ "sdcard_cmd_z"; -+ function = "sdcard"; -+ bias-pull-up; -+ drive-strength-microamp = <4000>; -+ }; -+ -+ mux-1 { -+ groups = "sdcard_clk_z"; -+ function = "sdcard"; -+ bias-disable; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ sdcard_clk_gate_z_pins: sdcard_clk_gate_z { -+ mux { -+ groups = "GPIOZ_6"; -+ function = "gpio_periphs"; -+ bias-pull-down; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ sdio_pins: sdio { -+ mux { -+ groups = "sdio_d0", -+ "sdio_d1", -+ "sdio_d2", -+ "sdio_d3", -+ "sdio_clk", -+ "sdio_cmd"; -+ function = "sdio"; -+ bias-disable; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ sdio_clk_gate_pins: sdio_clk_gate { -+ mux { -+ groups = "GPIOX_4"; -+ function = "gpio_periphs"; -+ bias-pull-down; -+ drive-strength-microamp = <4000>; -+ }; -+ }; -+ -+ spdif_in_a10_pins: spdif-in-a10 { -+ mux { -+ groups = "spdif_in_a10"; -+ function = "spdif_in"; -+ bias-disable; -+ }; -+ }; -+ -+ spdif_in_a12_pins: spdif-in-a12 { -+ mux { -+ groups = "spdif_in_a12"; -+ function = "spdif_in"; -+ bias-disable; -+ }; -+ }; -+ -+ spdif_in_h_pins: spdif-in-h { -+ mux { -+ groups = "spdif_in_h"; -+ function = "spdif_in"; -+ bias-disable; -+ }; -+ }; -+ -+ spdif_out_h_pins: spdif-out-h { -+ mux { -+ groups = "spdif_out_h"; -+ function = "spdif_out"; -+ drive-strength-microamp = <500>; -+ bias-disable; -+ }; -+ }; -+ -+ spdif_out_a11_pins: spdif-out-a11 { -+ mux { -+ groups = "spdif_out_a11"; -+ function = "spdif_out"; -+ drive-strength-microamp = <500>; -+ bias-disable; -+ }; -+ }; -+ -+ spdif_out_a13_pins: spdif-out-a13 { -+ mux { -+ groups = "spdif_out_a13"; -+ function = "spdif_out"; -+ drive-strength-microamp = <500>; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_a_din0_pins: tdm-a-din0 { -+ mux { -+ groups = "tdm_a_din0"; -+ function = "tdm_a"; -+ bias-disable; -+ }; -+ }; -+ -+ -+ tdm_a_din1_pins: tdm-a-din1 { -+ mux { -+ groups = "tdm_a_din1"; -+ function = "tdm_a"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_a_dout0_pins: tdm-a-dout0 { -+ mux { -+ groups = "tdm_a_dout0"; -+ function = "tdm_a"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_a_dout1_pins: tdm-a-dout1 { -+ mux { -+ groups = "tdm_a_dout1"; -+ function = "tdm_a"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_a_fs_pins: tdm-a-fs { -+ mux { -+ groups = "tdm_a_fs"; -+ function = "tdm_a"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_a_sclk_pins: tdm-a-sclk { -+ mux { -+ groups = "tdm_a_sclk"; -+ function = "tdm_a"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_a_slv_fs_pins: tdm-a-slv-fs { -+ mux { -+ groups = "tdm_a_slv_fs"; -+ function = "tdm_a"; -+ bias-disable; -+ }; -+ }; -+ -+ -+ tdm_a_slv_sclk_pins: tdm-a-slv-sclk { -+ mux { -+ groups = "tdm_a_slv_sclk"; -+ function = "tdm_a"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_din0_pins: tdm-b-din0 { -+ mux { -+ groups = "tdm_b_din0"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_din1_pins: tdm-b-din1 { -+ mux { -+ groups = "tdm_b_din1"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_din2_pins: tdm-b-din2 { -+ mux { -+ groups = "tdm_b_din2"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_din3_a_pins: tdm-b-din3-a { -+ mux { -+ groups = "tdm_b_din3_a"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_din3_h_pins: tdm-b-din3-h { -+ mux { -+ groups = "tdm_b_din3_h"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_dout0_pins: tdm-b-dout0 { -+ mux { -+ groups = "tdm_b_dout0"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_dout1_pins: tdm-b-dout1 { -+ mux { -+ groups = "tdm_b_dout1"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_dout2_pins: tdm-b-dout2 { -+ mux { -+ groups = "tdm_b_dout2"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_dout3_a_pins: tdm-b-dout3-a { -+ mux { -+ groups = "tdm_b_dout3_a"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_dout3_h_pins: tdm-b-dout3-h { -+ mux { -+ groups = "tdm_b_dout3_h"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_fs_pins: tdm-b-fs { -+ mux { -+ groups = "tdm_b_fs"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_sclk_pins: tdm-b-sclk { -+ mux { -+ groups = "tdm_b_sclk"; -+ function = "tdm_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_b_slv_fs_pins: tdm-b-slv-fs { -+ mux { -+ groups = "tdm_b_slv_fs"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_b_slv_sclk_pins: tdm-b-slv-sclk { -+ mux { -+ groups = "tdm_b_slv_sclk"; -+ function = "tdm_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din0_a_pins: tdm-c-din0-a { -+ mux { -+ groups = "tdm_c_din0_a"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din0_z_pins: tdm-c-din0-z { -+ mux { -+ groups = "tdm_c_din0_z"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din1_a_pins: tdm-c-din1-a { -+ mux { -+ groups = "tdm_c_din1_a"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din1_z_pins: tdm-c-din1-z { -+ mux { -+ groups = "tdm_c_din1_z"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din2_a_pins: tdm-c-din2-a { -+ mux { -+ groups = "tdm_c_din2_a"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ eth_leds_pins: eth-leds { -+ mux { -+ groups = "eth_link_led", -+ "eth_act_led"; -+ function = "eth"; -+ bias-disable; -+ }; -+ }; -+ -+ eth_pins: eth { -+ mux { -+ groups = "eth_mdio", -+ "eth_mdc", -+ "eth_rgmii_rx_clk", -+ "eth_rx_dv", -+ "eth_rxd0", -+ "eth_rxd1", -+ "eth_txen", -+ "eth_txd0", -+ "eth_txd1"; -+ function = "eth"; -+ drive-strength-microamp = <4000>; -+ bias-disable; -+ }; -+ }; -+ -+ eth_rgmii_pins: eth-rgmii { -+ mux { -+ groups = "eth_rxd2_rgmii", -+ "eth_rxd3_rgmii", -+ "eth_rgmii_tx_clk", -+ "eth_txd2_rgmii", -+ "eth_txd3_rgmii"; -+ function = "eth"; -+ drive-strength-microamp = <4000>; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din2_z_pins: tdm-c-din2-z { -+ mux { -+ groups = "tdm_c_din2_z"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din3_a_pins: tdm-c-din3-a { -+ mux { -+ groups = "tdm_c_din3_a"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_din3_z_pins: tdm-c-din3-z { -+ mux { -+ groups = "tdm_c_din3_z"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_dout0_a_pins: tdm-c-dout0-a { -+ mux { -+ groups = "tdm_c_dout0_a"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout0_z_pins: tdm-c-dout0-z { -+ mux { -+ groups = "tdm_c_dout0_z"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout1_a_pins: tdm-c-dout1-a { -+ mux { -+ groups = "tdm_c_dout1_a"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout1_z_pins: tdm-c-dout1-z { -+ mux { -+ groups = "tdm_c_dout1_z"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout2_a_pins: tdm-c-dout2-a { -+ mux { -+ groups = "tdm_c_dout2_a"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout2_z_pins: tdm-c-dout2-z { -+ mux { -+ groups = "tdm_c_dout2_z"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout3_a_pins: tdm-c-dout3-a { -+ mux { -+ groups = "tdm_c_dout3_a"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_dout3_z_pins: tdm-c-dout3-z { -+ mux { -+ groups = "tdm_c_dout3_z"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_fs_a_pins: tdm-c-fs-a { -+ mux { -+ groups = "tdm_c_fs_a"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_fs_z_pins: tdm-c-fs-z { -+ mux { -+ groups = "tdm_c_fs_z"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_sclk_a_pins: tdm-c-sclk-a { -+ mux { -+ groups = "tdm_c_sclk_a"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_sclk_z_pins: tdm-c-sclk-z { -+ mux { -+ groups = "tdm_c_sclk_z"; -+ function = "tdm_c"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_c_slv_fs_a_pins: tdm-c-slv-fs-a { -+ mux { -+ groups = "tdm_c_slv_fs_a"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_slv_fs_z_pins: tdm-c-slv-fs-z { -+ mux { -+ groups = "tdm_c_slv_fs_z"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_slv_sclk_a_pins: tdm-c-slv-sclk-a { -+ mux { -+ groups = "tdm_c_slv_sclk_a"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_c_slv_sclk_z_pins: tdm-c-slv-sclk-z { -+ mux { -+ groups = "tdm_c_slv_sclk_z"; -+ function = "tdm_c"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_a_pins: uart-a { -+ mux { -+ groups = "uart_a_tx", -+ "uart_a_rx"; -+ function = "uart_a"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_a_cts_rts_pins: uart-a-cts-rts { -+ mux { -+ groups = "uart_a_cts", -+ "uart_a_rts"; -+ function = "uart_a"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_b_pins: uart-b { -+ mux { -+ groups = "uart_b_tx", -+ "uart_b_rx"; -+ function = "uart_b"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_c_pins: uart-c { -+ mux { -+ groups = "uart_c_tx", -+ "uart_c_rx"; -+ function = "uart_c"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_c_cts_rts_pins: uart-c-cts-rts { -+ mux { -+ groups = "uart_c_cts", -+ "uart_c_rts"; -+ function = "uart_c"; -+ bias-disable; -+ }; -+ }; -+ }; -+ }; -+ -+ usb2_phy0: phy@36000 { -+ compatible = "amlogic,g12a-usb2-phy"; -+ reg = <0x0 0x36000 0x0 0x2000>; -+ clocks = <&xtal>; -+ clock-names = "xtal"; -+ resets = <&reset RESET_USB_PHY20>; -+ reset-names = "phy"; -+ #phy-cells = <0>; -+ }; -+ -+ dmc: bus@38000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0x38000 0x0 0x400>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x38000 0x0 0x400>; -+ -+ canvas: video-lut@48 { -+ compatible = "amlogic,canvas"; -+ reg = <0x0 0x48 0x0 0x14>; -+ }; -+ }; -+ -+ usb2_phy1: phy@3a000 { -+ compatible = "amlogic,g12a-usb2-phy"; -+ reg = <0x0 0x3a000 0x0 0x2000>; -+ clocks = <&xtal>; -+ clock-names = "xtal"; -+ resets = <&reset RESET_USB_PHY21>; -+ reset-names = "phy"; -+ #phy-cells = <0>; -+ }; -+ -+ hiu: bus@3c000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0x3c000 0x0 0x1400>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x3c000 0x0 0x1400>; -+ -+ hhi: system-controller@0 { -+ compatible = "amlogic,meson-gx-hhi-sysctrl", -+ "simple-mfd", "syscon"; -+ reg = <0 0 0 0x400>; -+ -+ clkc: clock-controller { -+ compatible = "amlogic,g12a-clkc"; -+ #clock-cells = <1>; -+ clocks = <&xtal>; -+ clock-names = "xtal"; -+ }; -+ }; -+ }; -+ -+ pdm: audio-controller@40000 { -+ compatible = "amlogic,g12a-pdm", -+ "amlogic,axg-pdm"; -+ reg = <0x0 0x40000 0x0 0x34>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "PDM"; -+ clocks = <&clkc_audio AUD_CLKID_PDM>, -+ <&clkc_audio AUD_CLKID_PDM_DCLK>, -+ <&clkc_audio AUD_CLKID_PDM_SYSCLK>; -+ clock-names = "pclk", "dclk", "sysclk"; -+ status = "disabled"; -+ }; -+ -+ audio: bus@42000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0x42000 0x0 0x2000>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x42000 0x0 0x2000>; -+ -+ clkc_audio: clock-controller@0 { -+ status = "disabled"; -+ compatible = "amlogic,g12a-audio-clkc"; -+ reg = <0x0 0x0 0x0 0xb4>; -+ #clock-cells = <1>; -+ -+ clocks = <&clkc CLKID_AUDIO>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>, -+ <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL3>, -+ <&clkc CLKID_HIFI_PLL>, -+ <&clkc CLKID_FCLK_DIV3>, -+ <&clkc CLKID_FCLK_DIV4>, -+ <&clkc CLKID_GP0_PLL>; -+ clock-names = "pclk", -+ "mst_in0", -+ "mst_in1", -+ "mst_in2", -+ "mst_in3", -+ "mst_in4", -+ "mst_in5", -+ "mst_in6", -+ "mst_in7"; -+ -+ resets = <&reset RESET_AUDIO>; -+ }; -+ -+ toddr_a: audio-controller@100 { -+ compatible = "amlogic,g12a-toddr", -+ "amlogic,axg-toddr"; -+ reg = <0x0 0x100 0x0 0x1c>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "TODDR_A"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_TODDR_A>; -+ resets = <&arb AXG_ARB_TODDR_A>; -+ status = "disabled"; -+ }; -+ -+ toddr_b: audio-controller@140 { -+ compatible = "amlogic,g12a-toddr", -+ "amlogic,axg-toddr"; -+ reg = <0x0 0x140 0x0 0x1c>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "TODDR_B"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_TODDR_B>; -+ resets = <&arb AXG_ARB_TODDR_B>; -+ status = "disabled"; -+ }; -+ -+ toddr_c: audio-controller@180 { -+ compatible = "amlogic,g12a-toddr", -+ "amlogic,axg-toddr"; -+ reg = <0x0 0x180 0x0 0x1c>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "TODDR_C"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_TODDR_C>; -+ resets = <&arb AXG_ARB_TODDR_C>; -+ status = "disabled"; -+ }; -+ -+ frddr_a: audio-controller@1c0 { -+ compatible = "amlogic,g12a-frddr", -+ "amlogic,axg-frddr"; -+ reg = <0x0 0x1c0 0x0 0x1c>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "FRDDR_A"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_FRDDR_A>; -+ resets = <&arb AXG_ARB_FRDDR_A>; -+ status = "disabled"; -+ }; -+ -+ frddr_b: audio-controller@200 { -+ compatible = "amlogic,g12a-frddr", -+ "amlogic,axg-frddr"; -+ reg = <0x0 0x200 0x0 0x1c>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "FRDDR_B"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_FRDDR_B>; -+ resets = <&arb AXG_ARB_FRDDR_B>; -+ status = "disabled"; -+ }; -+ -+ frddr_c: audio-controller@240 { -+ compatible = "amlogic,g12a-frddr", -+ "amlogic,axg-frddr"; -+ reg = <0x0 0x240 0x0 0x1c>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "FRDDR_C"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_FRDDR_C>; -+ resets = <&arb AXG_ARB_FRDDR_C>; -+ status = "disabled"; -+ }; -+ -+ arb: reset-controller@280 { -+ status = "disabled"; -+ compatible = "amlogic,meson-axg-audio-arb"; -+ reg = <0x0 0x280 0x0 0x4>; -+ #reset-cells = <1>; -+ clocks = <&clkc_audio AUD_CLKID_DDR_ARB>; -+ }; -+ -+ tdmin_a: audio-controller@300 { -+ compatible = "amlogic,g12a-tdmin", -+ "amlogic,axg-tdmin"; -+ reg = <0x0 0x300 0x0 0x40>; -+ sound-name-prefix = "TDMIN_A"; -+ clocks = <&clkc_audio AUD_CLKID_TDMIN_A>, -+ <&clkc_audio AUD_CLKID_TDMIN_A_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_A_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ tdmin_b: audio-controller@340 { -+ compatible = "amlogic,g12a-tdmin", -+ "amlogic,axg-tdmin"; -+ reg = <0x0 0x340 0x0 0x40>; -+ sound-name-prefix = "TDMIN_B"; -+ clocks = <&clkc_audio AUD_CLKID_TDMIN_B>, -+ <&clkc_audio AUD_CLKID_TDMIN_B_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_B_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ tdmin_c: audio-controller@380 { -+ compatible = "amlogic,g12a-tdmin", -+ "amlogic,axg-tdmin"; -+ reg = <0x0 0x380 0x0 0x40>; -+ sound-name-prefix = "TDMIN_C"; -+ clocks = <&clkc_audio AUD_CLKID_TDMIN_C>, -+ <&clkc_audio AUD_CLKID_TDMIN_C_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_C_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ tdmin_lb: audio-controller@3c0 { -+ compatible = "amlogic,g12a-tdmin", -+ "amlogic,axg-tdmin"; -+ reg = <0x0 0x3c0 0x0 0x40>; -+ sound-name-prefix = "TDMIN_LB"; -+ clocks = <&clkc_audio AUD_CLKID_TDMIN_LB>, -+ <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ spdifin: audio-controller@400 { -+ compatible = "amlogic,g12a-spdifin", -+ "amlogic,axg-spdifin"; -+ reg = <0x0 0x400 0x0 0x30>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "SPDIFIN"; -+ interrupts = ; -+ clocks = <&clkc_audio AUD_CLKID_SPDIFIN>, -+ <&clkc_audio AUD_CLKID_SPDIFIN_CLK>; -+ clock-names = "pclk", "refclk"; -+ status = "disabled"; -+ }; -+ -+ spdifout: audio-controller@480 { -+ compatible = "amlogic,g12a-spdifout", -+ "amlogic,axg-spdifout"; -+ reg = <0x0 0x480 0x0 0x50>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "SPDIFOUT"; -+ clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>, -+ <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>; -+ clock-names = "pclk", "mclk"; -+ status = "disabled"; -+ }; -+ -+ tdmout_a: audio-controller@500 { -+ compatible = "amlogic,g12a-tdmout"; -+ reg = <0x0 0x500 0x0 0x40>; -+ sound-name-prefix = "TDMOUT_A"; -+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>, -+ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ tdmout_b: audio-controller@540 { -+ compatible = "amlogic,g12a-tdmout"; -+ reg = <0x0 0x540 0x0 0x40>; -+ sound-name-prefix = "TDMOUT_B"; -+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_B>, -+ <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ tdmout_c: audio-controller@580 { -+ compatible = "amlogic,g12a-tdmout"; -+ reg = <0x0 0x580 0x0 0x40>; -+ sound-name-prefix = "TDMOUT_C"; -+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_C>, -+ <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK>, -+ <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK_SEL>, -+ <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>, -+ <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>; -+ clock-names = "pclk", "sclk", "sclk_sel", -+ "lrclk", "lrclk_sel"; -+ status = "disabled"; -+ }; -+ -+ spdifout_b: audio-controller@680 { -+ compatible = "amlogic,g12a-spdifout", -+ "amlogic,axg-spdifout"; -+ reg = <0x0 0x680 0x0 0x50>; -+ #sound-dai-cells = <0>; -+ sound-name-prefix = "SPDIFOUT_B"; -+ clocks = <&clkc_audio AUD_CLKID_SPDIFOUT_B>, -+ <&clkc_audio AUD_CLKID_SPDIFOUT_B_CLK>; -+ clock-names = "pclk", "mclk"; -+ status = "disabled"; -+ }; -+ -+ tohdmitx: audio-controller@744 { -+ compatible = "amlogic,g12a-tohdmitx"; -+ reg = <0x0 0x744 0x0 0x4>; -+ #sound-dai-cells = <1>; -+ sound-name-prefix = "TOHDMITX"; -+ status = "disabled"; -+ }; -+ }; -+ -+ usb3_pcie_phy: phy@46000 { -+ compatible = "amlogic,g12a-usb3-pcie-phy"; -+ reg = <0x0 0x46000 0x0 0x2000>; -+ clocks = <&clkc CLKID_PCIE_PLL>; -+ clock-names = "ref_clk"; -+ resets = <&reset RESET_PCIE_PHY>; -+ reset-names = "phy"; -+ assigned-clocks = <&clkc CLKID_PCIE_PLL>; -+ assigned-clock-rates = <100000000>; -+ #phy-cells = <1>; -+ }; -+ -+ eth_phy: mdio-multiplexer@4c000 { -+ compatible = "amlogic,g12a-mdio-mux"; -+ reg = <0x0 0x4c000 0x0 0xa4>; -+ clocks = <&clkc CLKID_ETH_PHY>, -+ <&xtal>, -+ <&clkc CLKID_MPLL_50M>; -+ clock-names = "pclk", "clkin0", "clkin1"; -+ mdio-parent-bus = <&mdio0>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ext_mdio: mdio@0 { -+ reg = <0>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ -+ int_mdio: mdio@1 { -+ reg = <1>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ internal_ephy: ethernet_phy@8 { -+ compatible = "ethernet-phy-id0180.3301", -+ "ethernet-phy-ieee802.3-c22"; -+ interrupts = ; -+ reg = <8>; -+ max-speed = <100>; -+ }; -+ }; -+ }; -+ }; -+ -+ aobus: bus@ff800000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0xff800000 0x0 0x100000>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0xff800000 0x0 0x100000>; -+ -+ rti: sys-ctrl@0 { -+ compatible = "amlogic,meson-gx-ao-sysctrl", -+ "simple-mfd", "syscon"; -+ reg = <0x0 0x0 0x0 0x100>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x0 0x0 0x100>; -+ -+ clkc_AO: clock-controller { -+ compatible = "amlogic,meson-g12a-aoclkc"; -+ #clock-cells = <1>; -+ #reset-cells = <1>; -+ clocks = <&xtal>, <&clkc CLKID_CLK81>; -+ clock-names = "xtal", "mpeg-clk"; -+ }; -+ -+ pwrc_vpu: power-controller-vpu { -+ compatible = "amlogic,meson-g12a-pwrc-vpu"; -+ #power-domain-cells = <0>; -+ amlogic,hhi-sysctrl = <&hhi>; -+ resets = <&reset RESET_VIU>, -+ <&reset RESET_VENC>, -+ <&reset RESET_VCBUS>, -+ <&reset RESET_BT656>, -+ <&reset RESET_RDMA>, -+ <&reset RESET_VENCI>, -+ <&reset RESET_VENCP>, -+ <&reset RESET_VDAC>, -+ <&reset RESET_VDI6>, -+ <&reset RESET_VENCL>, -+ <&reset RESET_VID_LOCK>; -+ clocks = <&clkc CLKID_VPU>, -+ <&clkc CLKID_VAPB>; -+ clock-names = "vpu", "vapb"; -+ /* -+ * VPU clocking is provided by two identical clock paths -+ * VPU_0 and VPU_1 muxed to a single clock by a glitch -+ * free mux to safely change frequency while running. -+ * Same for VAPB but with a final gate after the glitch free mux. -+ */ -+ assigned-clocks = <&clkc CLKID_VPU_0_SEL>, -+ <&clkc CLKID_VPU_0>, -+ <&clkc CLKID_VPU>, /* Glitch free mux */ -+ <&clkc CLKID_VAPB_0_SEL>, -+ <&clkc CLKID_VAPB_0>, -+ <&clkc CLKID_VAPB_SEL>; /* Glitch free mux */ -+ assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>, -+ <0>, /* Do Nothing */ -+ <&clkc CLKID_VPU_0>, -+ <&clkc CLKID_FCLK_DIV4>, -+ <0>, /* Do Nothing */ -+ <&clkc CLKID_VAPB_0>; -+ assigned-clock-rates = <0>, /* Do Nothing */ -+ <666666666>, -+ <0>, /* Do Nothing */ -+ <0>, /* Do Nothing */ -+ <250000000>, -+ <0>; /* Do Nothing */ -+ }; -+ -+ ao_pinctrl: pinctrl@14 { -+ compatible = "amlogic,meson-g12a-aobus-pinctrl"; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges; -+ -+ gpio_ao: bank@14 { -+ reg = <0x0 0x14 0x0 0x8>, -+ <0x0 0x1c 0x0 0x8>, -+ <0x0 0x24 0x0 0x14>; -+ reg-names = "mux", -+ "ds", -+ "gpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ gpio-ranges = <&ao_pinctrl 0 0 15>; -+ }; -+ -+ i2c_ao_sck_pins: i2c_ao_sck_pins { -+ mux { -+ groups = "i2c_ao_sck"; -+ function = "i2c_ao"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c_ao_sda_pins: i2c_ao_sda { -+ mux { -+ groups = "i2c_ao_sda"; -+ function = "i2c_ao"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c_ao_sck_e_pins: i2c_ao_sck_e { -+ mux { -+ groups = "i2c_ao_sck_e"; -+ function = "i2c_ao"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ i2c_ao_sda_e_pins: i2c_ao_sda_e { -+ mux { -+ groups = "i2c_ao_sda_e"; -+ function = "i2c_ao"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ mclk0_ao_pins: mclk0-ao { -+ mux { -+ groups = "mclk0_ao"; -+ function = "mclk0_ao"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_ao_b_din0_pins: tdm-ao-b-din0 { -+ mux { -+ groups = "tdm_ao_b_din0"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ }; -+ }; -+ -+ spdif_ao_out_pins: spdif-ao-out { -+ mux { -+ groups = "spdif_ao_out"; -+ function = "spdif_ao_out"; -+ drive-strength-microamp = <500>; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_ao_b_din1_pins: tdm-ao-b-din1 { -+ mux { -+ groups = "tdm_ao_b_din1"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_ao_b_din2_pins: tdm-ao-b-din2 { -+ mux { -+ groups = "tdm_ao_b_din2"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_ao_b_dout0_pins: tdm-ao-b-dout0 { -+ mux { -+ groups = "tdm_ao_b_dout0"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_ao_b_dout1_pins: tdm-ao-b-dout1 { -+ mux { -+ groups = "tdm_ao_b_dout1"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_ao_b_dout2_pins: tdm-ao-b-dout2 { -+ mux { -+ groups = "tdm_ao_b_dout2"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_ao_b_fs_pins: tdm-ao-b-fs { -+ mux { -+ groups = "tdm_ao_b_fs"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_ao_b_sclk_pins: tdm-ao-b-sclk { -+ mux { -+ groups = "tdm_ao_b_sclk"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+ -+ tdm_ao_b_slv_fs_pins: tdm-ao-b-slv-fs { -+ mux { -+ groups = "tdm_ao_b_slv_fs"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ }; -+ }; -+ -+ tdm_ao_b_slv_sclk_pins: tdm-ao-b-slv-sclk { -+ mux { -+ groups = "tdm_ao_b_slv_sclk"; -+ function = "tdm_ao_b"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_ao_a_pins: uart-a-ao { -+ mux { -+ groups = "uart_ao_a_tx", -+ "uart_ao_a_rx"; -+ function = "uart_ao_a"; -+ bias-disable; -+ }; -+ }; -+ -+ uart_ao_a_cts_rts_pins: uart-ao-a-cts-rts { -+ mux { -+ groups = "uart_ao_a_cts", -+ "uart_ao_a_rts"; -+ function = "uart_ao_a"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_a_pins: pwm-ao-a { -+ mux { -+ groups = "pwm_ao_a"; -+ function = "pwm_ao_a"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_b_pins: pwm-ao-b { -+ mux { -+ groups = "pwm_ao_b"; -+ function = "pwm_ao_b"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_c_4_pins: pwm-ao-c-4 { -+ mux { -+ groups = "pwm_ao_c_4"; -+ function = "pwm_ao_c"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_c_6_pins: pwm-ao-c-6 { -+ mux { -+ groups = "pwm_ao_c_6"; -+ function = "pwm_ao_c"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_d_5_pins: pwm-ao-d-5 { -+ mux { -+ groups = "pwm_ao_d_5"; -+ function = "pwm_ao_d"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_d_10_pins: pwm-ao-d-10 { -+ mux { -+ groups = "pwm_ao_d_10"; -+ function = "pwm_ao_d"; -+ bias-disable; -+ }; -+ }; -+ -+ pwm_ao_d_e_pins: pwm-ao-d-e { -+ mux { -+ groups = "pwm_ao_d_e"; -+ function = "pwm_ao_d"; -+ }; -+ }; -+ -+ remote_input_ao_pins: remote-input-ao { -+ mux { -+ groups = "remote_ao_input"; -+ function = "remote_ao_input"; -+ bias-disable; -+ }; -+ }; -+ }; -+ }; -+ -+ cec_AO: cec@100 { -+ compatible = "amlogic,meson-gx-ao-cec"; -+ reg = <0x0 0x00100 0x0 0x14>; -+ interrupts = ; -+ clocks = <&clkc_AO CLKID_AO_CEC>; -+ clock-names = "core"; -+ status = "disabled"; -+ }; -+ -+ sec_AO: ao-secure@140 { -+ compatible = "amlogic,meson-gx-ao-secure", "syscon"; -+ reg = <0x0 0x140 0x0 0x140>; -+ amlogic,has-chip-id; -+ }; -+ -+ cecb_AO: cec@280 { -+ compatible = "amlogic,meson-g12a-ao-cec"; -+ reg = <0x0 0x00280 0x0 0x1c>; -+ interrupts = ; -+ clocks = <&clkc_AO CLKID_AO_CTS_OSCIN>; -+ clock-names = "oscin"; -+ status = "disabled"; -+ }; -+ -+ pwm_AO_cd: pwm@2000 { -+ compatible = "amlogic,meson-g12a-ao-pwm-cd"; -+ reg = <0x0 0x2000 0x0 0x20>; -+ #pwm-cells = <3>; -+ status = "disabled"; -+ }; -+ -+ uart_AO: serial@3000 { -+ compatible = "amlogic,meson-gx-uart", -+ "amlogic,meson-ao-uart"; -+ reg = <0x0 0x3000 0x0 0x18>; -+ interrupts = ; -+ clocks = <&xtal>, <&clkc_AO CLKID_AO_UART>, <&xtal>; -+ clock-names = "xtal", "pclk", "baud"; -+ status = "disabled"; -+ }; -+ -+ uart_AO_B: serial@4000 { -+ compatible = "amlogic,meson-gx-uart", -+ "amlogic,meson-ao-uart"; -+ reg = <0x0 0x4000 0x0 0x18>; -+ interrupts = ; -+ clocks = <&xtal>, <&clkc_AO CLKID_AO_UART2>, <&xtal>; -+ clock-names = "xtal", "pclk", "baud"; -+ status = "disabled"; -+ }; -+ -+ i2c_AO: i2c@5000 { -+ compatible = "amlogic,meson-axg-i2c"; -+ status = "disabled"; -+ reg = <0x0 0x05000 0x0 0x20>; -+ interrupts = ; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ clocks = <&clkc CLKID_I2C>; -+ }; -+ -+ pwm_AO_ab: pwm@7000 { -+ compatible = "amlogic,meson-g12a-ao-pwm-ab"; -+ reg = <0x0 0x7000 0x0 0x20>; -+ #pwm-cells = <3>; -+ status = "disabled"; -+ }; -+ -+ ir: ir@8000 { -+ compatible = "amlogic,meson-gxbb-ir"; -+ reg = <0x0 0x8000 0x0 0x20>; -+ interrupts = ; -+ status = "disabled"; -+ }; -+ -+ saradc: adc@9000 { -+ compatible = "amlogic,meson-g12a-saradc", -+ "amlogic,meson-saradc"; -+ reg = <0x0 0x9000 0x0 0x48>; -+ #io-channel-cells = <1>; -+ interrupts = ; -+ clocks = <&xtal>, -+ <&clkc_AO CLKID_AO_SAR_ADC>, -+ <&clkc_AO CLKID_AO_SAR_ADC_CLK>, -+ <&clkc_AO CLKID_AO_SAR_ADC_SEL>; -+ clock-names = "clkin", "core", "adc_clk", "adc_sel"; -+ status = "disabled"; -+ }; -+ }; -+ -+ vpu: vpu@ff900000 { -+ compatible = "amlogic,meson-g12a-vpu"; -+ reg = <0x0 0xff900000 0x0 0x100000>, -+ <0x0 0xff63c000 0x0 0x1000>; -+ reg-names = "vpu", "hhi"; -+ interrupts = ; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ amlogic,canvas = <&canvas>; -+ power-domains = <&pwrc_vpu>; -+ -+ /* CVBS VDAC output port */ -+ cvbs_vdac_port: port@0 { -+ reg = <0>; -+ }; -+ -+ /* HDMI-TX output port */ -+ hdmi_tx_port: port@1 { -+ reg = <1>; -+ -+ hdmi_tx_out: endpoint { -+ remote-endpoint = <&hdmi_tx_in>; -+ }; -+ }; -+ }; -+ -+ gic: interrupt-controller@ffc01000 { -+ compatible = "arm,gic-400"; -+ reg = <0x0 0xffc01000 0 0x1000>, -+ <0x0 0xffc02000 0 0x2000>, -+ <0x0 0xffc04000 0 0x2000>, -+ <0x0 0xffc06000 0 0x2000>; -+ interrupt-controller; -+ interrupts = ; -+ #interrupt-cells = <3>; -+ #address-cells = <0>; -+ }; -+ -+ cbus: bus@ffd00000 { -+ compatible = "simple-bus"; -+ reg = <0x0 0xffd00000 0x0 0x100000>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0xffd00000 0x0 0x100000>; -+ -+ reset: reset-controller@1004 { -+ compatible = "amlogic,meson-g12a-reset", -+ "amlogic,meson-axg-reset"; -+ reg = <0x0 0x1004 0x0 0x9c>; -+ #reset-cells = <1>; -+ }; -+ -+ gpio_intc: interrupt-controller@f080 { -+ compatible = "amlogic,meson-g12a-gpio-intc", -+ "amlogic,meson-gpio-intc"; -+ reg = <0x0 0xf080 0x0 0x10>; -+ interrupt-controller; -+ #interrupt-cells = <2>; -+ amlogic,channel-interrupts = <64 65 66 67 68 69 70 71>; -+ }; -+ -+ pwm_ef: pwm@19000 { -+ compatible = "amlogic,meson-g12a-ee-pwm"; -+ reg = <0x0 0x19000 0x0 0x20>; -+ #pwm-cells = <3>; -+ status = "disabled"; -+ }; -+ -+ pwm_cd: pwm@1a000 { -+ compatible = "amlogic,meson-g12a-ee-pwm"; -+ reg = <0x0 0x1a000 0x0 0x20>; -+ #pwm-cells = <3>; -+ status = "disabled"; -+ }; -+ -+ pwm_ab: pwm@1b000 { -+ compatible = "amlogic,meson-g12a-ee-pwm"; -+ reg = <0x0 0x1b000 0x0 0x20>; -+ #pwm-cells = <3>; -+ status = "disabled"; -+ }; -+ -+ i2c3: i2c@1c000 { -+ compatible = "amlogic,meson-axg-i2c"; -+ status = "disabled"; -+ reg = <0x0 0x1c000 0x0 0x20>; -+ interrupts = ; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ clocks = <&clkc CLKID_I2C>; -+ }; -+ -+ i2c2: i2c@1d000 { -+ compatible = "amlogic,meson-axg-i2c"; -+ status = "disabled"; -+ reg = <0x0 0x1d000 0x0 0x20>; -+ interrupts = ; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ clocks = <&clkc CLKID_I2C>; -+ }; -+ -+ i2c1: i2c@1e000 { -+ compatible = "amlogic,meson-axg-i2c"; -+ status = "disabled"; -+ reg = <0x0 0x1e000 0x0 0x20>; -+ interrupts = ; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ clocks = <&clkc CLKID_I2C>; -+ }; -+ -+ i2c0: i2c@1f000 { -+ compatible = "amlogic,meson-axg-i2c"; -+ status = "disabled"; -+ reg = <0x0 0x1f000 0x0 0x20>; -+ interrupts = ; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ clocks = <&clkc CLKID_I2C>; -+ }; -+ -+ clk_msr: clock-measure@18000 { -+ compatible = "amlogic,meson-g12a-clk-measure"; -+ reg = <0x0 0x18000 0x0 0x10>; -+ }; -+ -+ uart_C: serial@22000 { -+ compatible = "amlogic,meson-gx-uart"; -+ reg = <0x0 0x22000 0x0 0x18>; -+ interrupts = ; -+ clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>; -+ clock-names = "xtal", "pclk", "baud"; -+ status = "disabled"; -+ }; -+ -+ uart_B: serial@23000 { -+ compatible = "amlogic,meson-gx-uart"; -+ reg = <0x0 0x23000 0x0 0x18>; -+ interrupts = ; -+ clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>; -+ clock-names = "xtal", "pclk", "baud"; -+ status = "disabled"; -+ }; -+ -+ uart_A: serial@24000 { -+ compatible = "amlogic,meson-gx-uart"; -+ reg = <0x0 0x24000 0x0 0x18>; -+ interrupts = ; -+ clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>; -+ clock-names = "xtal", "pclk", "baud"; -+ status = "disabled"; -+ }; -+ }; -+ -+ sd_emmc_a: sd@ffe03000 { -+ compatible = "amlogic,meson-axg-mmc"; -+ reg = <0x0 0xffe03000 0x0 0x800>; -+ interrupts = ; -+ status = "disabled"; -+ clocks = <&clkc CLKID_SD_EMMC_A>, -+ <&clkc CLKID_SD_EMMC_A_CLK0>, -+ <&clkc CLKID_FCLK_DIV2>; -+ clock-names = "core", "clkin0", "clkin1"; -+ resets = <&reset RESET_SD_EMMC_A>; -+ }; -+ -+ sd_emmc_b: sd@ffe05000 { -+ compatible = "amlogic,meson-axg-mmc"; -+ reg = <0x0 0xffe05000 0x0 0x800>; -+ interrupts = ; -+ status = "disabled"; -+ clocks = <&clkc CLKID_SD_EMMC_B>, -+ <&clkc CLKID_SD_EMMC_B_CLK0>, -+ <&clkc CLKID_FCLK_DIV2>; -+ clock-names = "core", "clkin0", "clkin1"; -+ resets = <&reset RESET_SD_EMMC_B>; -+ }; -+ -+ sd_emmc_c: mmc@ffe07000 { -+ compatible = "amlogic,meson-axg-mmc"; -+ reg = <0x0 0xffe07000 0x0 0x800>; -+ interrupts = ; -+ status = "disabled"; -+ clocks = <&clkc CLKID_SD_EMMC_C>, -+ <&clkc CLKID_SD_EMMC_C_CLK0>, -+ <&clkc CLKID_FCLK_DIV2>; -+ clock-names = "core", "clkin0", "clkin1"; -+ resets = <&reset RESET_SD_EMMC_C>; -+ }; -+ -+ usb: usb@ffe09000 { -+ status = "disabled"; -+ compatible = "amlogic,meson-g12a-usb-ctrl"; -+ reg = <0x0 0xffe09000 0x0 0xa0>; -+ interrupts = ; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges; -+ -+ clocks = <&clkc CLKID_USB>; -+ resets = <&reset RESET_USB>; -+ -+ dr_mode = "otg"; -+ -+ phys = <&usb2_phy0>, <&usb2_phy1>, -+ <&usb3_pcie_phy PHY_TYPE_USB3>; -+ phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0"; -+ -+ dwc2: usb@ff400000 { -+ compatible = "amlogic,meson-g12a-usb", "snps,dwc2"; -+ reg = <0x0 0xff400000 0x0 0x40000>; -+ interrupts = ; -+ clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; -+ clock-names = "ddr"; -+ phys = <&usb2_phy1>; -+ phy-names = "usb2-phy"; -+ dr_mode = "peripheral"; -+ g-rx-fifo-size = <192>; -+ g-np-tx-fifo-size = <128>; -+ g-tx-fifo-size = <128 128 16 16 16>; -+ }; -+ -+ dwc3: usb@ff500000 { -+ compatible = "snps,dwc3"; -+ reg = <0x0 0xff500000 0x0 0x100000>; -+ interrupts = ; -+ dr_mode = "host"; -+ snps,dis_u2_susphy_quirk; -+ snps,quirk-frame-length-adjustment; -+ }; -+ }; -+ -+ mali: gpu@ffe40000 { -+ compatible = "amlogic,meson-g12a-mali", "arm,mali-bifrost"; -+ reg = <0x0 0xffe40000 0x0 0x40000>; -+ interrupt-parent = <&gic>; -+ interrupts = , -+ , -+ ; -+ interrupt-names = "gpu", "mmu", "job"; -+ clocks = <&clkc CLKID_MALI>; -+ resets = <&reset RESET_DVALIN_CAPB3>, <&reset RESET_DVALIN>; -+ -+ /* -+ * Mali clocking is provided by two identical clock paths -+ * MALI_0 and MALI_1 muxed to a single clock by a glitch -+ * free mux to safely change frequency while running. -+ */ -+ assigned-clocks = <&clkc CLKID_MALI_0_SEL>, -+ <&clkc CLKID_MALI_0>, -+ <&clkc CLKID_MALI>; /* Glitch free mux */ -+ assigned-clock-parents = <&clkc CLKID_FCLK_DIV2P5>, -+ <0>, /* Do Nothing */ -+ <&clkc CLKID_MALI_0>; -+ assigned-clock-rates = <0>, /* Do Nothing */ -+ <800000000>, -+ <0>; /* Do Nothing */ -+ }; -+ }; -+ -+ timer { -+ compatible = "arm,armv8-timer"; -+ interrupts = , -+ , -+ , -+ ; -+ }; -+ -+ xtal: xtal-clk { -+ compatible = "fixed-clock"; -+ clock-frequency = <24000000>; -+ clock-output-names = "xtal"; -+ #clock-cells = <0>; -+ }; -+ -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi -index 1785552d450c..ac15967bb7fa 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi -@@ -3,56 +3,11 @@ - * Copyright (c) 2018 Amlogic, Inc. All rights reserved. - */ - --#include --#include --#include --#include --#include --#include --#include --#include --#include -+#include "meson-g12-common.dtsi" - - / { - compatible = "amlogic,g12a"; - -- interrupt-parent = <&gic>; -- #address-cells = <2>; -- #size-cells = <2>; -- -- tdmif_a: audio-controller-0 { -- compatible = "amlogic,axg-tdm-iface"; -- #sound-dai-cells = <0>; -- sound-name-prefix = "TDM_A"; -- clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>, -- <&clkc_audio AUD_CLKID_MST_A_SCLK>, -- <&clkc_audio AUD_CLKID_MST_A_LRCLK>; -- clock-names = "mclk", "sclk", "lrclk"; -- status = "disabled"; -- }; -- -- tdmif_b: audio-controller-1 { -- compatible = "amlogic,axg-tdm-iface"; -- #sound-dai-cells = <0>; -- sound-name-prefix = "TDM_B"; -- clocks = <&clkc_audio AUD_CLKID_MST_B_MCLK>, -- <&clkc_audio AUD_CLKID_MST_B_SCLK>, -- <&clkc_audio AUD_CLKID_MST_B_LRCLK>; -- clock-names = "mclk", "sclk", "lrclk"; -- status = "disabled"; -- }; -- -- tdmif_c: audio-controller-2 { -- compatible = "amlogic,axg-tdm-iface"; -- #sound-dai-cells = <0>; -- sound-name-prefix = "TDM_C"; -- clocks = <&clkc_audio AUD_CLKID_MST_C_MCLK>, -- <&clkc_audio AUD_CLKID_MST_C_SCLK>, -- <&clkc_audio AUD_CLKID_MST_C_LRCLK>; -- clock-names = "mclk", "sclk", "lrclk"; -- status = "disabled"; -- }; -- - cpus { - #address-cells = <0x2>; - #size-cells = <0x0>; -@@ -93,2361 +48,8 @@ - compatible = "cache"; - }; - }; -+}; - -- efuse: efuse { -- compatible = "amlogic,meson-gxbb-efuse"; -- clocks = <&clkc CLKID_EFUSE>; -- #address-cells = <1>; -- #size-cells = <1>; -- read-only; -- }; -- -- psci { -- compatible = "arm,psci-1.0"; -- method = "smc"; -- }; -- -- reserved-memory { -- #address-cells = <2>; -- #size-cells = <2>; -- ranges; -- -- /* 3 MiB reserved for ARM Trusted Firmware (BL31) */ -- secmon_reserved: secmon@5000000 { -- reg = <0x0 0x05000000 0x0 0x300000>; -- no-map; -- }; -- -- linux,cma { -- compatible = "shared-dma-pool"; -- reusable; -- size = <0x0 0x10000000>; -- alignment = <0x0 0x400000>; -- linux,cma-default; -- }; -- }; -- -- sm: secure-monitor { -- compatible = "amlogic,meson-gxbb-sm"; -- }; -- -- soc { -- compatible = "simple-bus"; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges; -- -- ethmac: ethernet@ff3f0000 { -- compatible = "amlogic,meson-axg-dwmac", -- "snps,dwmac-3.70a", -- "snps,dwmac"; -- reg = <0x0 0xff3f0000 0x0 0x10000 -- 0x0 0xff634540 0x0 0x8>; -- interrupts = ; -- interrupt-names = "macirq"; -- clocks = <&clkc CLKID_ETH>, -- <&clkc CLKID_FCLK_DIV2>, -- <&clkc CLKID_MPLL2>; -- clock-names = "stmmaceth", "clkin0", "clkin1"; -- status = "disabled"; -- -- mdio0: mdio { -- #address-cells = <1>; -- #size-cells = <0>; -- compatible = "snps,dwmac-mdio"; -- }; -- }; -- -- apb: bus@ff600000 { -- compatible = "simple-bus"; -- reg = <0x0 0xff600000 0x0 0x200000>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0xff600000 0x0 0x200000>; -- -- hdmi_tx: hdmi-tx@0 { -- compatible = "amlogic,meson-g12a-dw-hdmi"; -- reg = <0x0 0x0 0x0 0x10000>; -- interrupts = ; -- resets = <&reset RESET_HDMITX_CAPB3>, -- <&reset RESET_HDMITX_PHY>, -- <&reset RESET_HDMITX>; -- reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy"; -- clocks = <&clkc CLKID_HDMI>, -- <&clkc CLKID_HTX_PCLK>, -- <&clkc CLKID_VPU_INTR>; -- clock-names = "isfr", "iahb", "venci"; -- #address-cells = <1>; -- #size-cells = <0>; -- #sound-dai-cells = <0>; -- status = "disabled"; -- -- /* VPU VENC Input */ -- hdmi_tx_venc_port: port@0 { -- reg = <0>; -- -- hdmi_tx_in: endpoint { -- remote-endpoint = <&hdmi_tx_out>; -- }; -- }; -- -- /* TMDS Output */ -- hdmi_tx_tmds_port: port@1 { -- reg = <1>; -- }; -- }; -- -- apb_efuse: bus@30000 { -- compatible = "simple-bus"; -- reg = <0x0 0x30000 0x0 0x2000>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0x30000 0x0 0x2000>; -- -- hwrng: rng@218 { -- compatible = "amlogic,meson-rng"; -- reg = <0x0 0x218 0x0 0x4>; -- }; -- }; -- -- periphs: bus@34400 { -- compatible = "simple-bus"; -- reg = <0x0 0x34400 0x0 0x400>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0x34400 0x0 0x400>; -- -- periphs_pinctrl: pinctrl@40 { -- compatible = "amlogic,meson-g12a-periphs-pinctrl"; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges; -- -- gpio: bank@40 { -- reg = <0x0 0x40 0x0 0x4c>, -- <0x0 0xe8 0x0 0x18>, -- <0x0 0x120 0x0 0x18>, -- <0x0 0x2c0 0x0 0x40>, -- <0x0 0x340 0x0 0x1c>; -- reg-names = "gpio", -- "pull", -- "pull-enable", -- "mux", -- "ds"; -- gpio-controller; -- #gpio-cells = <2>; -- gpio-ranges = <&periphs_pinctrl 0 0 86>; -- }; -- -- cec_ao_a_h_pins: cec_ao_a_h { -- mux { -- groups = "cec_ao_a_h"; -- function = "cec_ao_a_h"; -- bias-disable; -- }; -- }; -- -- cec_ao_b_h_pins: cec_ao_b_h { -- mux { -- groups = "cec_ao_b_h"; -- function = "cec_ao_b_h"; -- bias-disable; -- }; -- }; -- -- emmc_pins: emmc { -- mux-0 { -- groups = "emmc_nand_d0", -- "emmc_nand_d1", -- "emmc_nand_d2", -- "emmc_nand_d3", -- "emmc_nand_d4", -- "emmc_nand_d5", -- "emmc_nand_d6", -- "emmc_nand_d7", -- "emmc_cmd"; -- function = "emmc"; -- bias-pull-up; -- drive-strength-microamp = <4000>; -- }; -- -- mux-1 { -- groups = "emmc_clk"; -- function = "emmc"; -- bias-disable; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- emmc_ds_pins: emmc-ds { -- mux { -- groups = "emmc_nand_ds"; -- function = "emmc"; -- bias-pull-down; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- emmc_clk_gate_pins: emmc_clk_gate { -- mux { -- groups = "BOOT_8"; -- function = "gpio_periphs"; -- bias-pull-down; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- hdmitx_ddc_pins: hdmitx_ddc { -- mux { -- groups = "hdmitx_sda", -- "hdmitx_sck"; -- function = "hdmitx"; -- bias-disable; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- hdmitx_hpd_pins: hdmitx_hpd { -- mux { -- groups = "hdmitx_hpd_in"; -- function = "hdmitx"; -- bias-disable; -- }; -- }; -- -- -- i2c0_sda_c_pins: i2c0-sda-c { -- mux { -- groups = "i2c0_sda_c"; -- function = "i2c0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- -- }; -- }; -- -- i2c0_sck_c_pins: i2c0-sck-c { -- mux { -- groups = "i2c0_sck_c"; -- function = "i2c0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c0_sda_z0_pins: i2c0-sda-z0 { -- mux { -- groups = "i2c0_sda_z0"; -- function = "i2c0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c0_sck_z1_pins: i2c0-sck-z1 { -- mux { -- groups = "i2c0_sck_z1"; -- function = "i2c0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c0_sda_z7_pins: i2c0-sda-z7 { -- mux { -- groups = "i2c0_sda_z7"; -- function = "i2c0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c0_sda_z8_pins: i2c0-sda-z8 { -- mux { -- groups = "i2c0_sda_z8"; -- function = "i2c0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c1_sda_x_pins: i2c1-sda-x { -- mux { -- groups = "i2c1_sda_x"; -- function = "i2c1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c1_sck_x_pins: i2c1-sck-x { -- mux { -- groups = "i2c1_sck_x"; -- function = "i2c1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c1_sda_h2_pins: i2c1-sda-h2 { -- mux { -- groups = "i2c1_sda_h2"; -- function = "i2c1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c1_sck_h3_pins: i2c1-sck-h3 { -- mux { -- groups = "i2c1_sck_h3"; -- function = "i2c1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c1_sda_h6_pins: i2c1-sda-h6 { -- mux { -- groups = "i2c1_sda_h6"; -- function = "i2c1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c1_sck_h7_pins: i2c1-sck-h7 { -- mux { -- groups = "i2c1_sck_h7"; -- function = "i2c1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c2_sda_x_pins: i2c2-sda-x { -- mux { -- groups = "i2c2_sda_x"; -- function = "i2c2"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c2_sck_x_pins: i2c2-sck-x { -- mux { -- groups = "i2c2_sck_x"; -- function = "i2c2"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c2_sda_z_pins: i2c2-sda-z { -- mux { -- groups = "i2c2_sda_z"; -- function = "i2c2"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c2_sck_z_pins: i2c2-sck-z { -- mux { -- groups = "i2c2_sck_z"; -- function = "i2c2"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c3_sda_h_pins: i2c3-sda-h { -- mux { -- groups = "i2c3_sda_h"; -- function = "i2c3"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c3_sck_h_pins: i2c3-sck-h { -- mux { -- groups = "i2c3_sck_h"; -- function = "i2c3"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c3_sda_a_pins: i2c3-sda-a { -- mux { -- groups = "i2c3_sda_a"; -- function = "i2c3"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c3_sck_a_pins: i2c3-sck-a { -- mux { -- groups = "i2c3_sck_a"; -- function = "i2c3"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- mclk0_a_pins: mclk0-a { -- mux { -- groups = "mclk0_a"; -- function = "mclk0"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- mclk1_a_pins: mclk1-a { -- mux { -- groups = "mclk1_a"; -- function = "mclk1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- mclk1_x_pins: mclk1-x { -- mux { -- groups = "mclk1_x"; -- function = "mclk1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- mclk1_z_pins: mclk1-z { -- mux { -- groups = "mclk1_z"; -- function = "mclk1"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- pdm_din0_a_pins: pdm-din0-a { -- mux { -- groups = "pdm_din0_a"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din0_c_pins: pdm-din0-c { -- mux { -- groups = "pdm_din0_c"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din0_x_pins: pdm-din0-x { -- mux { -- groups = "pdm_din0_x"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din0_z_pins: pdm-din0-z { -- mux { -- groups = "pdm_din0_z"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din1_a_pins: pdm-din1-a { -- mux { -- groups = "pdm_din1_a"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din1_c_pins: pdm-din1-c { -- mux { -- groups = "pdm_din1_c"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din1_x_pins: pdm-din1-x { -- mux { -- groups = "pdm_din1_x"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din1_z_pins: pdm-din1-z { -- mux { -- groups = "pdm_din1_z"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din2_a_pins: pdm-din2-a { -- mux { -- groups = "pdm_din2_a"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din2_c_pins: pdm-din2-c { -- mux { -- groups = "pdm_din2_c"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din2_x_pins: pdm-din2-x { -- mux { -- groups = "pdm_din2_x"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din2_z_pins: pdm-din2-z { -- mux { -- groups = "pdm_din2_z"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din3_a_pins: pdm-din3-a { -- mux { -- groups = "pdm_din3_a"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din3_c_pins: pdm-din3-c { -- mux { -- groups = "pdm_din3_c"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din3_x_pins: pdm-din3-x { -- mux { -- groups = "pdm_din3_x"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_din3_z_pins: pdm-din3-z { -- mux { -- groups = "pdm_din3_z"; -- function = "pdm"; -- bias-disable; -- }; -- }; -- -- pdm_dclk_a_pins: pdm-dclk-a { -- mux { -- groups = "pdm_dclk_a"; -- function = "pdm"; -- bias-disable; -- drive-strength-microamp = <500>; -- }; -- }; -- -- pdm_dclk_c_pins: pdm-dclk-c { -- mux { -- groups = "pdm_dclk_c"; -- function = "pdm"; -- bias-disable; -- drive-strength-microamp = <500>; -- }; -- }; -- -- pdm_dclk_x_pins: pdm-dclk-x { -- mux { -- groups = "pdm_dclk_x"; -- function = "pdm"; -- bias-disable; -- drive-strength-microamp = <500>; -- }; -- }; -- -- pdm_dclk_z_pins: pdm-dclk-z { -- mux { -- groups = "pdm_dclk_z"; -- function = "pdm"; -- bias-disable; -- drive-strength-microamp = <500>; -- }; -- }; -- -- pwm_a_pins: pwm-a { -- mux { -- groups = "pwm_a"; -- function = "pwm_a"; -- bias-disable; -- }; -- }; -- -- pwm_b_x7_pins: pwm-b-x7 { -- mux { -- groups = "pwm_b_x7"; -- function = "pwm_b"; -- bias-disable; -- }; -- }; -- -- pwm_b_x19_pins: pwm-b-x19 { -- mux { -- groups = "pwm_b_x19"; -- function = "pwm_b"; -- bias-disable; -- }; -- }; -- -- pwm_c_c_pins: pwm-c-c { -- mux { -- groups = "pwm_c_c"; -- function = "pwm_c"; -- bias-disable; -- }; -- }; -- -- pwm_c_x5_pins: pwm-c-x5 { -- mux { -- groups = "pwm_c_x5"; -- function = "pwm_c"; -- bias-disable; -- }; -- }; -- -- pwm_c_x8_pins: pwm-c-x8 { -- mux { -- groups = "pwm_c_x8"; -- function = "pwm_c"; -- bias-disable; -- }; -- }; -- -- pwm_d_x3_pins: pwm-d-x3 { -- mux { -- groups = "pwm_d_x3"; -- function = "pwm_d"; -- bias-disable; -- }; -- }; -- -- pwm_d_x6_pins: pwm-d-x6 { -- mux { -- groups = "pwm_d_x6"; -- function = "pwm_d"; -- bias-disable; -- }; -- }; -- -- pwm_e_pins: pwm-e { -- mux { -- groups = "pwm_e"; -- function = "pwm_e"; -- bias-disable; -- }; -- }; -- -- pwm_f_x_pins: pwm-f-x { -- mux { -- groups = "pwm_f_x"; -- function = "pwm_f"; -- bias-disable; -- }; -- }; -- -- pwm_f_h_pins: pwm-f-h { -- mux { -- groups = "pwm_f_h"; -- function = "pwm_f"; -- bias-disable; -- }; -- }; -- -- sdcard_c_pins: sdcard_c { -- mux-0 { -- groups = "sdcard_d0_c", -- "sdcard_d1_c", -- "sdcard_d2_c", -- "sdcard_d3_c", -- "sdcard_cmd_c"; -- function = "sdcard"; -- bias-pull-up; -- drive-strength-microamp = <4000>; -- }; -- -- mux-1 { -- groups = "sdcard_clk_c"; -- function = "sdcard"; -- bias-disable; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- sdcard_clk_gate_c_pins: sdcard_clk_gate_c { -- mux { -- groups = "GPIOC_4"; -- function = "gpio_periphs"; -- bias-pull-down; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- sdcard_z_pins: sdcard_z { -- mux-0 { -- groups = "sdcard_d0_z", -- "sdcard_d1_z", -- "sdcard_d2_z", -- "sdcard_d3_z", -- "sdcard_cmd_z"; -- function = "sdcard"; -- bias-pull-up; -- drive-strength-microamp = <4000>; -- }; -- -- mux-1 { -- groups = "sdcard_clk_z"; -- function = "sdcard"; -- bias-disable; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- sdcard_clk_gate_z_pins: sdcard_clk_gate_z { -- mux { -- groups = "GPIOZ_6"; -- function = "gpio_periphs"; -- bias-pull-down; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- sdio_pins: sdio { -- mux { -- groups = "sdio_d0", -- "sdio_d1", -- "sdio_d2", -- "sdio_d3", -- "sdio_clk", -- "sdio_cmd"; -- function = "sdio"; -- bias-disable; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- sdio_clk_gate_pins: sdio_clk_gate { -- mux { -- groups = "GPIOX_4"; -- function = "gpio_periphs"; -- bias-pull-down; -- drive-strength-microamp = <4000>; -- }; -- }; -- -- spdif_in_a10_pins: spdif-in-a10 { -- mux { -- groups = "spdif_in_a10"; -- function = "spdif_in"; -- bias-disable; -- }; -- }; -- -- spdif_in_a12_pins: spdif-in-a12 { -- mux { -- groups = "spdif_in_a12"; -- function = "spdif_in"; -- bias-disable; -- }; -- }; -- -- spdif_in_h_pins: spdif-in-h { -- mux { -- groups = "spdif_in_h"; -- function = "spdif_in"; -- bias-disable; -- }; -- }; -- -- spdif_out_h_pins: spdif-out-h { -- mux { -- groups = "spdif_out_h"; -- function = "spdif_out"; -- drive-strength-microamp = <500>; -- bias-disable; -- }; -- }; -- -- spdif_out_a11_pins: spdif-out-a11 { -- mux { -- groups = "spdif_out_a11"; -- function = "spdif_out"; -- drive-strength-microamp = <500>; -- bias-disable; -- }; -- }; -- -- spdif_out_a13_pins: spdif-out-a13 { -- mux { -- groups = "spdif_out_a13"; -- function = "spdif_out"; -- drive-strength-microamp = <500>; -- bias-disable; -- }; -- }; -- -- tdm_a_din0_pins: tdm-a-din0 { -- mux { -- groups = "tdm_a_din0"; -- function = "tdm_a"; -- bias-disable; -- }; -- }; -- -- -- tdm_a_din1_pins: tdm-a-din1 { -- mux { -- groups = "tdm_a_din1"; -- function = "tdm_a"; -- bias-disable; -- }; -- }; -- -- tdm_a_dout0_pins: tdm-a-dout0 { -- mux { -- groups = "tdm_a_dout0"; -- function = "tdm_a"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_a_dout1_pins: tdm-a-dout1 { -- mux { -- groups = "tdm_a_dout1"; -- function = "tdm_a"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_a_fs_pins: tdm-a-fs { -- mux { -- groups = "tdm_a_fs"; -- function = "tdm_a"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_a_sclk_pins: tdm-a-sclk { -- mux { -- groups = "tdm_a_sclk"; -- function = "tdm_a"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_a_slv_fs_pins: tdm-a-slv-fs { -- mux { -- groups = "tdm_a_slv_fs"; -- function = "tdm_a"; -- bias-disable; -- }; -- }; -- -- -- tdm_a_slv_sclk_pins: tdm-a-slv-sclk { -- mux { -- groups = "tdm_a_slv_sclk"; -- function = "tdm_a"; -- bias-disable; -- }; -- }; -- -- tdm_b_din0_pins: tdm-b-din0 { -- mux { -- groups = "tdm_b_din0"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_b_din1_pins: tdm-b-din1 { -- mux { -- groups = "tdm_b_din1"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_b_din2_pins: tdm-b-din2 { -- mux { -- groups = "tdm_b_din2"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_b_din3_a_pins: tdm-b-din3-a { -- mux { -- groups = "tdm_b_din3_a"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_b_din3_h_pins: tdm-b-din3-h { -- mux { -- groups = "tdm_b_din3_h"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_b_dout0_pins: tdm-b-dout0 { -- mux { -- groups = "tdm_b_dout0"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_dout1_pins: tdm-b-dout1 { -- mux { -- groups = "tdm_b_dout1"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_dout2_pins: tdm-b-dout2 { -- mux { -- groups = "tdm_b_dout2"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_dout3_a_pins: tdm-b-dout3-a { -- mux { -- groups = "tdm_b_dout3_a"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_dout3_h_pins: tdm-b-dout3-h { -- mux { -- groups = "tdm_b_dout3_h"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_fs_pins: tdm-b-fs { -- mux { -- groups = "tdm_b_fs"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_sclk_pins: tdm-b-sclk { -- mux { -- groups = "tdm_b_sclk"; -- function = "tdm_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_b_slv_fs_pins: tdm-b-slv-fs { -- mux { -- groups = "tdm_b_slv_fs"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_b_slv_sclk_pins: tdm-b-slv-sclk { -- mux { -- groups = "tdm_b_slv_sclk"; -- function = "tdm_b"; -- bias-disable; -- }; -- }; -- -- tdm_c_din0_a_pins: tdm-c-din0-a { -- mux { -- groups = "tdm_c_din0_a"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_din0_z_pins: tdm-c-din0-z { -- mux { -- groups = "tdm_c_din0_z"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_din1_a_pins: tdm-c-din1-a { -- mux { -- groups = "tdm_c_din1_a"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_din1_z_pins: tdm-c-din1-z { -- mux { -- groups = "tdm_c_din1_z"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_din2_a_pins: tdm-c-din2-a { -- mux { -- groups = "tdm_c_din2_a"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- eth_leds_pins: eth-leds { -- mux { -- groups = "eth_link_led", -- "eth_act_led"; -- function = "eth"; -- bias-disable; -- }; -- }; -- -- eth_pins: eth { -- mux { -- groups = "eth_mdio", -- "eth_mdc", -- "eth_rgmii_rx_clk", -- "eth_rx_dv", -- "eth_rxd0", -- "eth_rxd1", -- "eth_txen", -- "eth_txd0", -- "eth_txd1"; -- function = "eth"; -- drive-strength-microamp = <4000>; -- bias-disable; -- }; -- }; -- -- eth_rgmii_pins: eth-rgmii { -- mux { -- groups = "eth_rxd2_rgmii", -- "eth_rxd3_rgmii", -- "eth_rgmii_tx_clk", -- "eth_txd2_rgmii", -- "eth_txd3_rgmii"; -- function = "eth"; -- drive-strength-microamp = <4000>; -- bias-disable; -- }; -- }; -- -- tdm_c_din2_z_pins: tdm-c-din2-z { -- mux { -- groups = "tdm_c_din2_z"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_din3_a_pins: tdm-c-din3-a { -- mux { -- groups = "tdm_c_din3_a"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_din3_z_pins: tdm-c-din3-z { -- mux { -- groups = "tdm_c_din3_z"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_dout0_a_pins: tdm-c-dout0-a { -- mux { -- groups = "tdm_c_dout0_a"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout0_z_pins: tdm-c-dout0-z { -- mux { -- groups = "tdm_c_dout0_z"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout1_a_pins: tdm-c-dout1-a { -- mux { -- groups = "tdm_c_dout1_a"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout1_z_pins: tdm-c-dout1-z { -- mux { -- groups = "tdm_c_dout1_z"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout2_a_pins: tdm-c-dout2-a { -- mux { -- groups = "tdm_c_dout2_a"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout2_z_pins: tdm-c-dout2-z { -- mux { -- groups = "tdm_c_dout2_z"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout3_a_pins: tdm-c-dout3-a { -- mux { -- groups = "tdm_c_dout3_a"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_dout3_z_pins: tdm-c-dout3-z { -- mux { -- groups = "tdm_c_dout3_z"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_fs_a_pins: tdm-c-fs-a { -- mux { -- groups = "tdm_c_fs_a"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_fs_z_pins: tdm-c-fs-z { -- mux { -- groups = "tdm_c_fs_z"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_sclk_a_pins: tdm-c-sclk-a { -- mux { -- groups = "tdm_c_sclk_a"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_sclk_z_pins: tdm-c-sclk-z { -- mux { -- groups = "tdm_c_sclk_z"; -- function = "tdm_c"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_c_slv_fs_a_pins: tdm-c-slv-fs-a { -- mux { -- groups = "tdm_c_slv_fs_a"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_slv_fs_z_pins: tdm-c-slv-fs-z { -- mux { -- groups = "tdm_c_slv_fs_z"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_slv_sclk_a_pins: tdm-c-slv-sclk-a { -- mux { -- groups = "tdm_c_slv_sclk_a"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- tdm_c_slv_sclk_z_pins: tdm-c-slv-sclk-z { -- mux { -- groups = "tdm_c_slv_sclk_z"; -- function = "tdm_c"; -- bias-disable; -- }; -- }; -- -- uart_a_pins: uart-a { -- mux { -- groups = "uart_a_tx", -- "uart_a_rx"; -- function = "uart_a"; -- bias-disable; -- }; -- }; -- -- uart_a_cts_rts_pins: uart-a-cts-rts { -- mux { -- groups = "uart_a_cts", -- "uart_a_rts"; -- function = "uart_a"; -- bias-disable; -- }; -- }; -- -- uart_b_pins: uart-b { -- mux { -- groups = "uart_b_tx", -- "uart_b_rx"; -- function = "uart_b"; -- bias-disable; -- }; -- }; -- -- uart_c_pins: uart-c { -- mux { -- groups = "uart_c_tx", -- "uart_c_rx"; -- function = "uart_c"; -- bias-disable; -- }; -- }; -- -- uart_c_cts_rts_pins: uart-c-cts-rts { -- mux { -- groups = "uart_c_cts", -- "uart_c_rts"; -- function = "uart_c"; -- bias-disable; -- }; -- }; -- }; -- }; -- -- usb2_phy0: phy@36000 { -- compatible = "amlogic,g12a-usb2-phy"; -- reg = <0x0 0x36000 0x0 0x2000>; -- clocks = <&xtal>; -- clock-names = "xtal"; -- resets = <&reset RESET_USB_PHY20>; -- reset-names = "phy"; -- #phy-cells = <0>; -- }; -- -- dmc: bus@38000 { -- compatible = "simple-bus"; -- reg = <0x0 0x38000 0x0 0x400>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0x38000 0x0 0x400>; -- -- canvas: video-lut@48 { -- compatible = "amlogic,canvas"; -- reg = <0x0 0x48 0x0 0x14>; -- }; -- }; -- -- usb2_phy1: phy@3a000 { -- compatible = "amlogic,g12a-usb2-phy"; -- reg = <0x0 0x3a000 0x0 0x2000>; -- clocks = <&xtal>; -- clock-names = "xtal"; -- resets = <&reset RESET_USB_PHY21>; -- reset-names = "phy"; -- #phy-cells = <0>; -- }; -- -- hiu: bus@3c000 { -- compatible = "simple-bus"; -- reg = <0x0 0x3c000 0x0 0x1400>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0x3c000 0x0 0x1400>; -- -- hhi: system-controller@0 { -- compatible = "amlogic,meson-gx-hhi-sysctrl", -- "simple-mfd", "syscon"; -- reg = <0 0 0 0x400>; -- -- clkc: clock-controller { -- compatible = "amlogic,g12a-clkc"; -- #clock-cells = <1>; -- clocks = <&xtal>; -- clock-names = "xtal"; -- }; -- }; -- }; -- -- pdm: audio-controller@40000 { -- compatible = "amlogic,g12a-pdm", -- "amlogic,axg-pdm"; -- reg = <0x0 0x40000 0x0 0x34>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "PDM"; -- clocks = <&clkc_audio AUD_CLKID_PDM>, -- <&clkc_audio AUD_CLKID_PDM_DCLK>, -- <&clkc_audio AUD_CLKID_PDM_SYSCLK>; -- clock-names = "pclk", "dclk", "sysclk"; -- status = "disabled"; -- }; -- -- audio: bus@42000 { -- compatible = "simple-bus"; -- reg = <0x0 0x42000 0x0 0x2000>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0x42000 0x0 0x2000>; -- -- clkc_audio: clock-controller@0 { -- status = "disabled"; -- compatible = "amlogic,g12a-audio-clkc"; -- reg = <0x0 0x0 0x0 0xb4>; -- #clock-cells = <1>; -- -- clocks = <&clkc CLKID_AUDIO>, -- <&clkc CLKID_MPLL0>, -- <&clkc CLKID_MPLL1>, -- <&clkc CLKID_MPLL2>, -- <&clkc CLKID_MPLL3>, -- <&clkc CLKID_HIFI_PLL>, -- <&clkc CLKID_FCLK_DIV3>, -- <&clkc CLKID_FCLK_DIV4>, -- <&clkc CLKID_GP0_PLL>; -- clock-names = "pclk", -- "mst_in0", -- "mst_in1", -- "mst_in2", -- "mst_in3", -- "mst_in4", -- "mst_in5", -- "mst_in6", -- "mst_in7"; -- -- resets = <&reset RESET_AUDIO>; -- }; -- -- toddr_a: audio-controller@100 { -- compatible = "amlogic,g12a-toddr", -- "amlogic,axg-toddr"; -- reg = <0x0 0x100 0x0 0x1c>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "TODDR_A"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_TODDR_A>; -- resets = <&arb AXG_ARB_TODDR_A>; -- status = "disabled"; -- }; -- -- toddr_b: audio-controller@140 { -- compatible = "amlogic,g12a-toddr", -- "amlogic,axg-toddr"; -- reg = <0x0 0x140 0x0 0x1c>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "TODDR_B"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_TODDR_B>; -- resets = <&arb AXG_ARB_TODDR_B>; -- status = "disabled"; -- }; -- -- toddr_c: audio-controller@180 { -- compatible = "amlogic,g12a-toddr", -- "amlogic,axg-toddr"; -- reg = <0x0 0x180 0x0 0x1c>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "TODDR_C"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_TODDR_C>; -- resets = <&arb AXG_ARB_TODDR_C>; -- status = "disabled"; -- }; -- -- frddr_a: audio-controller@1c0 { -- compatible = "amlogic,g12a-frddr", -- "amlogic,axg-frddr"; -- reg = <0x0 0x1c0 0x0 0x1c>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "FRDDR_A"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_FRDDR_A>; -- resets = <&arb AXG_ARB_FRDDR_A>; -- status = "disabled"; -- }; -- -- frddr_b: audio-controller@200 { -- compatible = "amlogic,g12a-frddr", -- "amlogic,axg-frddr"; -- reg = <0x0 0x200 0x0 0x1c>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "FRDDR_B"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_FRDDR_B>; -- resets = <&arb AXG_ARB_FRDDR_B>; -- status = "disabled"; -- }; -- -- frddr_c: audio-controller@240 { -- compatible = "amlogic,g12a-frddr", -- "amlogic,axg-frddr"; -- reg = <0x0 0x240 0x0 0x1c>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "FRDDR_C"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_FRDDR_C>; -- resets = <&arb AXG_ARB_FRDDR_C>; -- status = "disabled"; -- }; -- -- arb: reset-controller@280 { -- status = "disabled"; -- compatible = "amlogic,meson-axg-audio-arb"; -- reg = <0x0 0x280 0x0 0x4>; -- #reset-cells = <1>; -- clocks = <&clkc_audio AUD_CLKID_DDR_ARB>; -- }; -- -- tdmin_a: audio-controller@300 { -- compatible = "amlogic,g12a-tdmin", -- "amlogic,axg-tdmin"; -- reg = <0x0 0x300 0x0 0x40>; -- sound-name-prefix = "TDMIN_A"; -- clocks = <&clkc_audio AUD_CLKID_TDMIN_A>, -- <&clkc_audio AUD_CLKID_TDMIN_A_SCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_A_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- tdmin_b: audio-controller@340 { -- compatible = "amlogic,g12a-tdmin", -- "amlogic,axg-tdmin"; -- reg = <0x0 0x340 0x0 0x40>; -- sound-name-prefix = "TDMIN_B"; -- clocks = <&clkc_audio AUD_CLKID_TDMIN_B>, -- <&clkc_audio AUD_CLKID_TDMIN_B_SCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_B_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- tdmin_c: audio-controller@380 { -- compatible = "amlogic,g12a-tdmin", -- "amlogic,axg-tdmin"; -- reg = <0x0 0x380 0x0 0x40>; -- sound-name-prefix = "TDMIN_C"; -- clocks = <&clkc_audio AUD_CLKID_TDMIN_C>, -- <&clkc_audio AUD_CLKID_TDMIN_C_SCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_C_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- tdmin_lb: audio-controller@3c0 { -- compatible = "amlogic,g12a-tdmin", -- "amlogic,axg-tdmin"; -- reg = <0x0 0x3c0 0x0 0x40>; -- sound-name-prefix = "TDMIN_LB"; -- clocks = <&clkc_audio AUD_CLKID_TDMIN_LB>, -- <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- spdifin: audio-controller@400 { -- compatible = "amlogic,g12a-spdifin", -- "amlogic,axg-spdifin"; -- reg = <0x0 0x400 0x0 0x30>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "SPDIFIN"; -- interrupts = ; -- clocks = <&clkc_audio AUD_CLKID_SPDIFIN>, -- <&clkc_audio AUD_CLKID_SPDIFIN_CLK>; -- clock-names = "pclk", "refclk"; -- status = "disabled"; -- }; -- -- spdifout: audio-controller@480 { -- compatible = "amlogic,g12a-spdifout", -- "amlogic,axg-spdifout"; -- reg = <0x0 0x480 0x0 0x50>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "SPDIFOUT"; -- clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>, -- <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>; -- clock-names = "pclk", "mclk"; -- status = "disabled"; -- }; -- -- tdmout_a: audio-controller@500 { -- compatible = "amlogic,g12a-tdmout"; -- reg = <0x0 0x500 0x0 0x40>; -- sound-name-prefix = "TDMOUT_A"; -- clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>, -- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>, -- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- tdmout_b: audio-controller@540 { -- compatible = "amlogic,g12a-tdmout"; -- reg = <0x0 0x540 0x0 0x40>; -- sound-name-prefix = "TDMOUT_B"; -- clocks = <&clkc_audio AUD_CLKID_TDMOUT_B>, -- <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK>, -- <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- tdmout_c: audio-controller@580 { -- compatible = "amlogic,g12a-tdmout"; -- reg = <0x0 0x580 0x0 0x40>; -- sound-name-prefix = "TDMOUT_C"; -- clocks = <&clkc_audio AUD_CLKID_TDMOUT_C>, -- <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK>, -- <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK_SEL>, -- <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>, -- <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>; -- clock-names = "pclk", "sclk", "sclk_sel", -- "lrclk", "lrclk_sel"; -- status = "disabled"; -- }; -- -- spdifout_b: audio-controller@680 { -- compatible = "amlogic,g12a-spdifout", -- "amlogic,axg-spdifout"; -- reg = <0x0 0x680 0x0 0x50>; -- #sound-dai-cells = <0>; -- sound-name-prefix = "SPDIFOUT_B"; -- clocks = <&clkc_audio AUD_CLKID_SPDIFOUT_B>, -- <&clkc_audio AUD_CLKID_SPDIFOUT_B_CLK>; -- clock-names = "pclk", "mclk"; -- status = "disabled"; -- }; -- -- tohdmitx: audio-controller@744 { -- compatible = "amlogic,g12a-tohdmitx"; -- reg = <0x0 0x744 0x0 0x4>; -- #sound-dai-cells = <1>; -- sound-name-prefix = "TOHDMITX"; -- status = "disabled"; -- }; -- }; -- -- usb3_pcie_phy: phy@46000 { -- compatible = "amlogic,g12a-usb3-pcie-phy"; -- reg = <0x0 0x46000 0x0 0x2000>; -- clocks = <&clkc CLKID_PCIE_PLL>; -- clock-names = "ref_clk"; -- resets = <&reset RESET_PCIE_PHY>; -- reset-names = "phy"; -- assigned-clocks = <&clkc CLKID_PCIE_PLL>; -- assigned-clock-rates = <100000000>; -- #phy-cells = <1>; -- }; -- -- eth_phy: mdio-multiplexer@4c000 { -- compatible = "amlogic,g12a-mdio-mux"; -- reg = <0x0 0x4c000 0x0 0xa4>; -- clocks = <&clkc CLKID_ETH_PHY>, -- <&xtal>, -- <&clkc CLKID_MPLL_50M>; -- clock-names = "pclk", "clkin0", "clkin1"; -- mdio-parent-bus = <&mdio0>; -- #address-cells = <1>; -- #size-cells = <0>; -- -- ext_mdio: mdio@0 { -- reg = <0>; -- #address-cells = <1>; -- #size-cells = <0>; -- }; -- -- int_mdio: mdio@1 { -- reg = <1>; -- #address-cells = <1>; -- #size-cells = <0>; -- -- internal_ephy: ethernet_phy@8 { -- compatible = "ethernet-phy-id0180.3301", -- "ethernet-phy-ieee802.3-c22"; -- interrupts = ; -- reg = <8>; -- max-speed = <100>; -- }; -- }; -- }; -- }; -- -- aobus: bus@ff800000 { -- compatible = "simple-bus"; -- reg = <0x0 0xff800000 0x0 0x100000>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0xff800000 0x0 0x100000>; -- -- rti: sys-ctrl@0 { -- compatible = "amlogic,meson-gx-ao-sysctrl", -- "simple-mfd", "syscon"; -- reg = <0x0 0x0 0x0 0x100>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0x0 0x0 0x100>; -- -- clkc_AO: clock-controller { -- compatible = "amlogic,meson-g12a-aoclkc"; -- #clock-cells = <1>; -- #reset-cells = <1>; -- clocks = <&xtal>, <&clkc CLKID_CLK81>; -- clock-names = "xtal", "mpeg-clk"; -- }; -- -- pwrc_vpu: power-controller-vpu { -- compatible = "amlogic,meson-g12a-pwrc-vpu"; -- #power-domain-cells = <0>; -- amlogic,hhi-sysctrl = <&hhi>; -- resets = <&reset RESET_VIU>, -- <&reset RESET_VENC>, -- <&reset RESET_VCBUS>, -- <&reset RESET_BT656>, -- <&reset RESET_RDMA>, -- <&reset RESET_VENCI>, -- <&reset RESET_VENCP>, -- <&reset RESET_VDAC>, -- <&reset RESET_VDI6>, -- <&reset RESET_VENCL>, -- <&reset RESET_VID_LOCK>; -- clocks = <&clkc CLKID_VPU>, -- <&clkc CLKID_VAPB>; -- clock-names = "vpu", "vapb"; -- /* -- * VPU clocking is provided by two identical clock paths -- * VPU_0 and VPU_1 muxed to a single clock by a glitch -- * free mux to safely change frequency while running. -- * Same for VAPB but with a final gate after the glitch free mux. -- */ -- assigned-clocks = <&clkc CLKID_VPU_0_SEL>, -- <&clkc CLKID_VPU_0>, -- <&clkc CLKID_VPU>, /* Glitch free mux */ -- <&clkc CLKID_VAPB_0_SEL>, -- <&clkc CLKID_VAPB_0>, -- <&clkc CLKID_VAPB_SEL>; /* Glitch free mux */ -- assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>, -- <0>, /* Do Nothing */ -- <&clkc CLKID_VPU_0>, -- <&clkc CLKID_FCLK_DIV4>, -- <0>, /* Do Nothing */ -- <&clkc CLKID_VAPB_0>; -- assigned-clock-rates = <0>, /* Do Nothing */ -- <666666666>, -- <0>, /* Do Nothing */ -- <0>, /* Do Nothing */ -- <250000000>, -- <0>; /* Do Nothing */ -- }; -- -- ao_pinctrl: pinctrl@14 { -- compatible = "amlogic,meson-g12a-aobus-pinctrl"; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges; -- -- gpio_ao: bank@14 { -- reg = <0x0 0x14 0x0 0x8>, -- <0x0 0x1c 0x0 0x8>, -- <0x0 0x24 0x0 0x14>; -- reg-names = "mux", -- "ds", -- "gpio"; -- gpio-controller; -- #gpio-cells = <2>; -- gpio-ranges = <&ao_pinctrl 0 0 15>; -- }; -- -- i2c_ao_sck_pins: i2c_ao_sck_pins { -- mux { -- groups = "i2c_ao_sck"; -- function = "i2c_ao"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c_ao_sda_pins: i2c_ao_sda { -- mux { -- groups = "i2c_ao_sda"; -- function = "i2c_ao"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c_ao_sck_e_pins: i2c_ao_sck_e { -- mux { -- groups = "i2c_ao_sck_e"; -- function = "i2c_ao"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- i2c_ao_sda_e_pins: i2c_ao_sda_e { -- mux { -- groups = "i2c_ao_sda_e"; -- function = "i2c_ao"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- mclk0_ao_pins: mclk0-ao { -- mux { -- groups = "mclk0_ao"; -- function = "mclk0_ao"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_ao_b_din0_pins: tdm-ao-b-din0 { -- mux { -- groups = "tdm_ao_b_din0"; -- function = "tdm_ao_b"; -- bias-disable; -- }; -- }; -- -- spdif_ao_out_pins: spdif-ao-out { -- mux { -- groups = "spdif_ao_out"; -- function = "spdif_ao_out"; -- drive-strength-microamp = <500>; -- bias-disable; -- }; -- }; -- -- tdm_ao_b_din1_pins: tdm-ao-b-din1 { -- mux { -- groups = "tdm_ao_b_din1"; -- function = "tdm_ao_b"; -- bias-disable; -- }; -- }; -- -- tdm_ao_b_din2_pins: tdm-ao-b-din2 { -- mux { -- groups = "tdm_ao_b_din2"; -- function = "tdm_ao_b"; -- bias-disable; -- }; -- }; -- -- tdm_ao_b_dout0_pins: tdm-ao-b-dout0 { -- mux { -- groups = "tdm_ao_b_dout0"; -- function = "tdm_ao_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_ao_b_dout1_pins: tdm-ao-b-dout1 { -- mux { -- groups = "tdm_ao_b_dout1"; -- function = "tdm_ao_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_ao_b_dout2_pins: tdm-ao-b-dout2 { -- mux { -- groups = "tdm_ao_b_dout2"; -- function = "tdm_ao_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_ao_b_fs_pins: tdm-ao-b-fs { -- mux { -- groups = "tdm_ao_b_fs"; -- function = "tdm_ao_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_ao_b_sclk_pins: tdm-ao-b-sclk { -- mux { -- groups = "tdm_ao_b_sclk"; -- function = "tdm_ao_b"; -- bias-disable; -- drive-strength-microamp = <3000>; -- }; -- }; -- -- tdm_ao_b_slv_fs_pins: tdm-ao-b-slv-fs { -- mux { -- groups = "tdm_ao_b_slv_fs"; -- function = "tdm_ao_b"; -- bias-disable; -- }; -- }; -- -- tdm_ao_b_slv_sclk_pins: tdm-ao-b-slv-sclk { -- mux { -- groups = "tdm_ao_b_slv_sclk"; -- function = "tdm_ao_b"; -- bias-disable; -- }; -- }; -- -- uart_ao_a_pins: uart-a-ao { -- mux { -- groups = "uart_ao_a_tx", -- "uart_ao_a_rx"; -- function = "uart_ao_a"; -- bias-disable; -- }; -- }; -- -- uart_ao_a_cts_rts_pins: uart-ao-a-cts-rts { -- mux { -- groups = "uart_ao_a_cts", -- "uart_ao_a_rts"; -- function = "uart_ao_a"; -- bias-disable; -- }; -- }; -- -- pwm_ao_a_pins: pwm-ao-a { -- mux { -- groups = "pwm_ao_a"; -- function = "pwm_ao_a"; -- bias-disable; -- }; -- }; -- -- pwm_ao_b_pins: pwm-ao-b { -- mux { -- groups = "pwm_ao_b"; -- function = "pwm_ao_b"; -- bias-disable; -- }; -- }; -- -- pwm_ao_c_4_pins: pwm-ao-c-4 { -- mux { -- groups = "pwm_ao_c_4"; -- function = "pwm_ao_c"; -- bias-disable; -- }; -- }; -- -- pwm_ao_c_6_pins: pwm-ao-c-6 { -- mux { -- groups = "pwm_ao_c_6"; -- function = "pwm_ao_c"; -- bias-disable; -- }; -- }; -- -- pwm_ao_d_5_pins: pwm-ao-d-5 { -- mux { -- groups = "pwm_ao_d_5"; -- function = "pwm_ao_d"; -- bias-disable; -- }; -- }; -- -- pwm_ao_d_10_pins: pwm-ao-d-10 { -- mux { -- groups = "pwm_ao_d_10"; -- function = "pwm_ao_d"; -- bias-disable; -- }; -- }; -- -- pwm_ao_d_e_pins: pwm-ao-d-e { -- mux { -- groups = "pwm_ao_d_e"; -- function = "pwm_ao_d"; -- }; -- }; -- -- remote_input_ao_pins: remote-input-ao { -- mux { -- groups = "remote_ao_input"; -- function = "remote_ao_input"; -- bias-disable; -- }; -- }; -- }; -- }; -- -- cec_AO: cec@100 { -- compatible = "amlogic,meson-gx-ao-cec"; -- reg = <0x0 0x00100 0x0 0x14>; -- interrupts = ; -- clocks = <&clkc_AO CLKID_AO_CEC>; -- clock-names = "core"; -- status = "disabled"; -- }; -- -- sec_AO: ao-secure@140 { -- compatible = "amlogic,meson-gx-ao-secure", "syscon"; -- reg = <0x0 0x140 0x0 0x140>; -- amlogic,has-chip-id; -- }; -- -- cecb_AO: cec@280 { -- compatible = "amlogic,meson-g12a-ao-cec"; -- reg = <0x0 0x00280 0x0 0x1c>; -- interrupts = ; -- clocks = <&clkc_AO CLKID_AO_CTS_OSCIN>; -- clock-names = "oscin"; -- status = "disabled"; -- }; -- -- pwm_AO_cd: pwm@2000 { -- compatible = "amlogic,meson-g12a-ao-pwm-cd"; -- reg = <0x0 0x2000 0x0 0x20>; -- #pwm-cells = <3>; -- status = "disabled"; -- }; -- -- uart_AO: serial@3000 { -- compatible = "amlogic,meson-gx-uart", -- "amlogic,meson-ao-uart"; -- reg = <0x0 0x3000 0x0 0x18>; -- interrupts = ; -- clocks = <&xtal>, <&clkc_AO CLKID_AO_UART>, <&xtal>; -- clock-names = "xtal", "pclk", "baud"; -- status = "disabled"; -- }; -- -- uart_AO_B: serial@4000 { -- compatible = "amlogic,meson-gx-uart", -- "amlogic,meson-ao-uart"; -- reg = <0x0 0x4000 0x0 0x18>; -- interrupts = ; -- clocks = <&xtal>, <&clkc_AO CLKID_AO_UART2>, <&xtal>; -- clock-names = "xtal", "pclk", "baud"; -- status = "disabled"; -- }; -- -- i2c_AO: i2c@5000 { -- compatible = "amlogic,meson-axg-i2c"; -- status = "disabled"; -- reg = <0x0 0x05000 0x0 0x20>; -- interrupts = ; -- #address-cells = <1>; -- #size-cells = <0>; -- clocks = <&clkc CLKID_I2C>; -- }; -- -- pwm_AO_ab: pwm@7000 { -- compatible = "amlogic,meson-g12a-ao-pwm-ab"; -- reg = <0x0 0x7000 0x0 0x20>; -- #pwm-cells = <3>; -- status = "disabled"; -- }; -- -- ir: ir@8000 { -- compatible = "amlogic,meson-gxbb-ir"; -- reg = <0x0 0x8000 0x0 0x20>; -- interrupts = ; -- status = "disabled"; -- }; -- -- saradc: adc@9000 { -- compatible = "amlogic,meson-g12a-saradc", -- "amlogic,meson-saradc"; -- reg = <0x0 0x9000 0x0 0x48>; -- #io-channel-cells = <1>; -- interrupts = ; -- clocks = <&xtal>, -- <&clkc_AO CLKID_AO_SAR_ADC>, -- <&clkc_AO CLKID_AO_SAR_ADC_CLK>, -- <&clkc_AO CLKID_AO_SAR_ADC_SEL>; -- clock-names = "clkin", "core", "adc_clk", "adc_sel"; -- status = "disabled"; -- }; -- }; -- -- vpu: vpu@ff900000 { -- compatible = "amlogic,meson-g12a-vpu"; -- reg = <0x0 0xff900000 0x0 0x100000>, -- <0x0 0xff63c000 0x0 0x1000>; -- reg-names = "vpu", "hhi"; -- interrupts = ; -- #address-cells = <1>; -- #size-cells = <0>; -- amlogic,canvas = <&canvas>; -- power-domains = <&pwrc_vpu>; -- -- /* CVBS VDAC output port */ -- cvbs_vdac_port: port@0 { -- reg = <0>; -- }; -- -- /* HDMI-TX output port */ -- hdmi_tx_port: port@1 { -- reg = <1>; -- -- hdmi_tx_out: endpoint { -- remote-endpoint = <&hdmi_tx_in>; -- }; -- }; -- }; -- -- gic: interrupt-controller@ffc01000 { -- compatible = "arm,gic-400"; -- reg = <0x0 0xffc01000 0 0x1000>, -- <0x0 0xffc02000 0 0x2000>, -- <0x0 0xffc04000 0 0x2000>, -- <0x0 0xffc06000 0 0x2000>; -- interrupt-controller; -- interrupts = ; -- #interrupt-cells = <3>; -- #address-cells = <0>; -- }; -- -- cbus: bus@ffd00000 { -- compatible = "simple-bus"; -- reg = <0x0 0xffd00000 0x0 0x100000>; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges = <0x0 0x0 0x0 0xffd00000 0x0 0x100000>; -- -- reset: reset-controller@1004 { -- compatible = "amlogic,meson-g12a-reset", -- "amlogic,meson-axg-reset"; -- reg = <0x0 0x1004 0x0 0x9c>; -- #reset-cells = <1>; -- }; -- -- gpio_intc: interrupt-controller@f080 { -- compatible = "amlogic,meson-g12a-gpio-intc", -- "amlogic,meson-gpio-intc"; -- reg = <0x0 0xf080 0x0 0x10>; -- interrupt-controller; -- #interrupt-cells = <2>; -- amlogic,channel-interrupts = <64 65 66 67 68 69 70 71>; -- }; -- -- pwm_ef: pwm@19000 { -- compatible = "amlogic,meson-g12a-ee-pwm"; -- reg = <0x0 0x19000 0x0 0x20>; -- #pwm-cells = <3>; -- status = "disabled"; -- }; -- -- pwm_cd: pwm@1a000 { -- compatible = "amlogic,meson-g12a-ee-pwm"; -- reg = <0x0 0x1a000 0x0 0x20>; -- #pwm-cells = <3>; -- status = "disabled"; -- }; -- -- pwm_ab: pwm@1b000 { -- compatible = "amlogic,meson-g12a-ee-pwm"; -- reg = <0x0 0x1b000 0x0 0x20>; -- #pwm-cells = <3>; -- status = "disabled"; -- }; -- -- i2c3: i2c@1c000 { -- compatible = "amlogic,meson-axg-i2c"; -- status = "disabled"; -- reg = <0x0 0x1c000 0x0 0x20>; -- interrupts = ; -- #address-cells = <1>; -- #size-cells = <0>; -- clocks = <&clkc CLKID_I2C>; -- }; -- -- i2c2: i2c@1d000 { -- compatible = "amlogic,meson-axg-i2c"; -- status = "disabled"; -- reg = <0x0 0x1d000 0x0 0x20>; -- interrupts = ; -- #address-cells = <1>; -- #size-cells = <0>; -- clocks = <&clkc CLKID_I2C>; -- }; -- -- i2c1: i2c@1e000 { -- compatible = "amlogic,meson-axg-i2c"; -- status = "disabled"; -- reg = <0x0 0x1e000 0x0 0x20>; -- interrupts = ; -- #address-cells = <1>; -- #size-cells = <0>; -- clocks = <&clkc CLKID_I2C>; -- }; -- -- i2c0: i2c@1f000 { -- compatible = "amlogic,meson-axg-i2c"; -- status = "disabled"; -- reg = <0x0 0x1f000 0x0 0x20>; -- interrupts = ; -- #address-cells = <1>; -- #size-cells = <0>; -- clocks = <&clkc CLKID_I2C>; -- }; -- -- clk_msr: clock-measure@18000 { -- compatible = "amlogic,meson-g12a-clk-measure"; -- reg = <0x0 0x18000 0x0 0x10>; -- }; -- -- uart_C: serial@22000 { -- compatible = "amlogic,meson-gx-uart"; -- reg = <0x0 0x22000 0x0 0x18>; -- interrupts = ; -- clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>; -- clock-names = "xtal", "pclk", "baud"; -- status = "disabled"; -- }; -- -- uart_B: serial@23000 { -- compatible = "amlogic,meson-gx-uart"; -- reg = <0x0 0x23000 0x0 0x18>; -- interrupts = ; -- clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>; -- clock-names = "xtal", "pclk", "baud"; -- status = "disabled"; -- }; -- -- uart_A: serial@24000 { -- compatible = "amlogic,meson-gx-uart"; -- reg = <0x0 0x24000 0x0 0x18>; -- interrupts = ; -- clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>; -- clock-names = "xtal", "pclk", "baud"; -- status = "disabled"; -- }; -- }; -- -- sd_emmc_a: sd@ffe03000 { -- compatible = "amlogic,meson-axg-mmc"; -- reg = <0x0 0xffe03000 0x0 0x800>; -- interrupts = ; -- status = "disabled"; -- clocks = <&clkc CLKID_SD_EMMC_A>, -- <&clkc CLKID_SD_EMMC_A_CLK0>, -- <&clkc CLKID_FCLK_DIV2>; -- clock-names = "core", "clkin0", "clkin1"; -- resets = <&reset RESET_SD_EMMC_A>; -- amlogic,dram-access-quirk; -- }; -- -- sd_emmc_b: sd@ffe05000 { -- compatible = "amlogic,meson-axg-mmc"; -- reg = <0x0 0xffe05000 0x0 0x800>; -- interrupts = ; -- status = "disabled"; -- clocks = <&clkc CLKID_SD_EMMC_B>, -- <&clkc CLKID_SD_EMMC_B_CLK0>, -- <&clkc CLKID_FCLK_DIV2>; -- clock-names = "core", "clkin0", "clkin1"; -- resets = <&reset RESET_SD_EMMC_B>; -- }; -- -- sd_emmc_c: mmc@ffe07000 { -- compatible = "amlogic,meson-axg-mmc"; -- reg = <0x0 0xffe07000 0x0 0x800>; -- interrupts = ; -- status = "disabled"; -- clocks = <&clkc CLKID_SD_EMMC_C>, -- <&clkc CLKID_SD_EMMC_C_CLK0>, -- <&clkc CLKID_FCLK_DIV2>; -- clock-names = "core", "clkin0", "clkin1"; -- resets = <&reset RESET_SD_EMMC_C>; -- }; -- -- usb: usb@ffe09000 { -- status = "disabled"; -- compatible = "amlogic,meson-g12a-usb-ctrl"; -- reg = <0x0 0xffe09000 0x0 0xa0>; -- interrupts = ; -- #address-cells = <2>; -- #size-cells = <2>; -- ranges; -- -- clocks = <&clkc CLKID_USB>; -- resets = <&reset RESET_USB>; -- -- dr_mode = "otg"; -- -- phys = <&usb2_phy0>, <&usb2_phy1>, -- <&usb3_pcie_phy PHY_TYPE_USB3>; -- phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0"; -- -- dwc2: usb@ff400000 { -- compatible = "amlogic,meson-g12a-usb", "snps,dwc2"; -- reg = <0x0 0xff400000 0x0 0x40000>; -- interrupts = ; -- clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; -- clock-names = "ddr"; -- phys = <&usb2_phy1>; -- phy-names = "usb2-phy"; -- dr_mode = "peripheral"; -- g-rx-fifo-size = <192>; -- g-np-tx-fifo-size = <128>; -- g-tx-fifo-size = <128 128 16 16 16>; -- }; -- -- dwc3: usb@ff500000 { -- compatible = "snps,dwc3"; -- reg = <0x0 0xff500000 0x0 0x100000>; -- interrupts = ; -- dr_mode = "host"; -- snps,dis_u2_susphy_quirk; -- snps,quirk-frame-length-adjustment; -- }; -- }; -- -- mali: gpu@ffe40000 { -- compatible = "amlogic,meson-g12a-mali", "arm,mali-bifrost"; -- reg = <0x0 0xffe40000 0x0 0x40000>; -- interrupt-parent = <&gic>; -- interrupts = , -- , -- ; -- interrupt-names = "gpu", "mmu", "job"; -- clocks = <&clkc CLKID_MALI>; -- resets = <&reset RESET_DVALIN_CAPB3>, <&reset RESET_DVALIN>; -- -- /* -- * Mali clocking is provided by two identical clock paths -- * MALI_0 and MALI_1 muxed to a single clock by a glitch -- * free mux to safely change frequency while running. -- */ -- assigned-clocks = <&clkc CLKID_MALI_0_SEL>, -- <&clkc CLKID_MALI_0>, -- <&clkc CLKID_MALI>; /* Glitch free mux */ -- assigned-clock-parents = <&clkc CLKID_FCLK_DIV2P5>, -- <0>, /* Do Nothing */ -- <&clkc CLKID_MALI_0>; -- assigned-clock-rates = <0>, /* Do Nothing */ -- <800000000>, -- <0>; /* Do Nothing */ -- }; -- }; -- -- timer { -- compatible = "arm,armv8-timer"; -- interrupts = , -- , -- , -- ; -- }; -- -- xtal: xtal-clk { -- compatible = "fixed-clock"; -- clock-frequency = <24000000>; -- clock-output-names = "xtal"; -- #clock-cells = <0>; -- }; -- -+&sd_emmc_a { -+ amlogic,dram-access-quirk; - }; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -index 9e88e513b22d..d5edbc1a1991 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -@@ -4,12 +4,15 @@ - * Author: Neil Armstrong - */ - --#include "meson-g12a.dtsi" -+#include "meson-g12-common.dtsi" - - / { - compatible = "amlogic,g12b"; - - cpus { -+ #address-cells = <0x2>; -+ #size-cells = <0x0>; -+ - cpu-map { - cluster0 { - core0 { -@@ -40,8 +43,21 @@ - }; - }; - -- /delete-node/ cpu@2; -- /delete-node/ cpu@3; -+ cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53"; -+ reg = <0x0 0x0>; -+ enable-method = "psci"; -+ next-level-cache = <&l2>; -+ }; -+ -+ cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53"; -+ reg = <0x0 0x1>; -+ enable-method = "psci"; -+ next-level-cache = <&l2>; -+ }; - - cpu100: cpu@100 { - device_type = "cpu"; -@@ -74,9 +90,17 @@ - enable-method = "psci"; - next-level-cache = <&l2>; - }; -+ -+ l2: l2-cache0 { -+ compatible = "cache"; -+ }; - }; - }; - - &clkc { - compatible = "amlogic,g12b-clkc"; - }; -+ -+&sd_emmc_a { -+ amlogic,dram-access-quirk; -+}; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-ASoC-meson-aiu-fix-clk-bulk-size-allocation.patch b/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-ASoC-meson-aiu-fix-clk-bulk-size-allocation.patch new file mode 100644 index 0000000000..814aa320ff --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-ASoC-meson-aiu-fix-clk-bulk-size-allocation.patch @@ -0,0 +1,31 @@ +From 1760f0adce918aae57e9cc292b10b891e55fb629 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 17 Feb 2020 02:51:14 +0000 +Subject: [PATCH 023/146] FROMGIT: ASoC: meson: aiu: fix clk bulk size + allocation + +Fix the size of allocated memory for the clock bulk data + +Fixes: 6ae9ca9ce986 ("ASoC: meson: aiu: add i2s and spdif support") +Reported-by: kbuild test robot +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/aiu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c +index 5c4845a23a34..de678a9d5cab 100644 +--- a/sound/soc/meson/aiu.c ++++ b/sound/soc/meson/aiu.c +@@ -203,7 +203,7 @@ static int aiu_clk_bulk_get(struct device *dev, + struct clk_bulk_data *clks; + int i, ret; + +- clks = devm_kcalloc(dev, num, sizeof(clks), GFP_KERNEL); ++ clks = devm_kcalloc(dev, num, sizeof(*clks), GFP_KERNEL); + if (!clks) + return -ENOMEM; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-arm64-dts-meson-g12-common-add-pwm_a-on-GPIO.patch b/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-arm64-dts-meson-g12-common-add-pwm_a-on-GPIO.patch deleted file mode 100644 index bd7350927e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-arm64-dts-meson-g12-common-add-pwm_a-on-GPIO.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 6eeca2e5b228ddb6a1bf6bd9476aeb1ebece3494 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:18 +0200 -Subject: [PATCH 023/187] FROMGIT: arm64: dts: meson-g12-common: add pwm_a on - GPIOE_2 pinmux - -Add the ao_pinctrl subnode for the pwm_a function on GPIOE_2. - -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit a902d577cfb6c16f0108ad9d43fcc02cf90cfcda - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index 06e186ca41e3..38d70ce1cfc7 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -1970,6 +1970,14 @@ - }; - }; - -+ pwm_a_e_pins: pwm-a-e { -+ mux { -+ groups = "pwm_a_e"; -+ function = "pwm_a_e"; -+ bias-disable; -+ }; -+ }; -+ - pwm_ao_a_pins: pwm-ao-a { - mux { - groups = "pwm_ao_a"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch b/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch new file mode 100644 index 0000000000..2bc7f3a1e3 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch @@ -0,0 +1,59 @@ +From 94ffe149b3fcf237b440afc7475c5160ee050fe1 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 17 Feb 2020 02:52:13 +0000 +Subject: [PATCH 024/146] FROMGIT: ASoC: meson: aiu: fix irq registration + +The aiu stored the irq in an unsigned integer which may have discarded an +error returned by platform_get_irq_byname(). This is incorrect and should +have been a signed integer. + +Also drop the irq error traces from the probe function as this is already +done by platform_get_irq_byname(). + +Fixes: 6ae9ca9ce986 ("ASoC: meson: aiu: add i2s and spdif support") +Reported-by: kbuild test robot +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/aiu.c | 8 ++------ + sound/soc/meson/aiu.h | 2 +- + 2 files changed, 3 insertions(+), 7 deletions(-) + +diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c +index de678a9d5cab..34b40b8b8299 100644 +--- a/sound/soc/meson/aiu.c ++++ b/sound/soc/meson/aiu.c +@@ -314,16 +314,12 @@ static int aiu_probe(struct platform_device *pdev) + } + + aiu->i2s.irq = platform_get_irq_byname(pdev, "i2s"); +- if (aiu->i2s.irq < 0) { +- dev_err(dev, "Can't get i2s irq\n"); ++ if (aiu->i2s.irq < 0) + return aiu->i2s.irq; +- } + + aiu->spdif.irq = platform_get_irq_byname(pdev, "spdif"); +- if (aiu->spdif.irq < 0) { +- dev_err(dev, "Can't get spdif irq\n"); ++ if (aiu->spdif.irq < 0) + return aiu->spdif.irq; +- } + + ret = aiu_clk_get(dev); + if (ret) +diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h +index a65a576e3400..097c26de7b7c 100644 +--- a/sound/soc/meson/aiu.h ++++ b/sound/soc/meson/aiu.h +@@ -26,7 +26,7 @@ enum aiu_clk_ids { + struct aiu_interface { + struct clk_bulk_data *clks; + unsigned int clk_num; +- unsigned int irq; ++ int irq; + }; + + struct aiu { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-arm64-dts-meson-g12a-add-cpus-OPP-table.patch b/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-arm64-dts-meson-g12a-add-cpus-OPP-table.patch deleted file mode 100644 index 843bf4f25e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-arm64-dts-meson-g12a-add-cpus-OPP-table.patch +++ /dev/null @@ -1,109 +0,0 @@ -From a24212b1377c4c7c224058bcd8eb73164e414ee7 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:19 +0200 -Subject: [PATCH 024/187] FROMGIT: arm64: dts: meson-g12a: add cpus OPP table - -Add the OPP table taken from the vendor u200 and u211 DTS. - -The Amlogic G12A SoC seems to available in 3 types : -- low-speed: up to 1,8GHz -- mid-speed: up to 1,908GHz -- high-speed: up to 2.1GHz - -And the S905X2 opp voltages are slightly higher than the S905D2 -OPP voltages for the low-speed table. - -This adds the conservative OPP table with the S905X2 higher voltages -and the maximum low-speed OPP frequency. - -The values were tested to be stable on an Amlogic U200 Reference Board, -SeiRobotics SEI510 and X96 Max Set-Top-Boxes running the arm64 cpuburn -at [1] and cycling between all the possible cpufreq translations and -checking the final frequency using the clock-measurer, script at [2]. - -[1] https://github.com/ssvb/cpuburn-arm/blob/master/cpuburn-a53.S -[2] https://gist.github.com/superna9999/d4de964dbc0f84b7d527e1df2ddea25f - -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit 67444f6c8058e6103de719eb276a8999a18a6ad6 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 60 +++++++++++++++++++++ - 1 file changed, 60 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi -index ac15967bb7fa..733a9d46fc4b 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi -@@ -48,6 +48,66 @@ - compatible = "cache"; - }; - }; -+ -+ cpu_opp_table: opp-table { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-667000000 { -+ opp-hz = /bits/ 64 <666666666>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <761000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <831000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1800000000 { -+ opp-hz = /bits/ 64 <1800000000>; -+ opp-microvolt = <981000>; -+ }; -+ }; - }; - - &sd_emmc_a { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-ASoC-meson-aiu-fix-acodec-dai-input-name-ini.patch b/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-ASoC-meson-aiu-fix-acodec-dai-input-name-ini.patch new file mode 100644 index 0000000000..1b1e0e9714 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-ASoC-meson-aiu-fix-acodec-dai-input-name-ini.patch @@ -0,0 +1,30 @@ +From 1ba9f7539547f066632ac14ec70edff578392904 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 17 Feb 2020 02:53:13 +0000 +Subject: [PATCH 025/146] FROMGIT: ASoC: meson: aiu: fix acodec dai input name + init + +Remove the double initialization of the dai input name as reported by +sparse. + +Fixes: 65816025d461 ("ASoC: meson: aiu: add internal dac codec control support") +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/aiu-acodec-ctrl.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sound/soc/meson/aiu-acodec-ctrl.c b/sound/soc/meson/aiu-acodec-ctrl.c +index 12d8a4d351a1..b8e88b1a4fc8 100644 +--- a/sound/soc/meson/aiu-acodec-ctrl.c ++++ b/sound/soc/meson/aiu-acodec-ctrl.c +@@ -128,7 +128,6 @@ static const struct snd_soc_dai_ops aiu_acodec_ctrl_output_ops = { + + #define AIU_ACODEC_INPUT(xname) { \ + .name = "ACODEC CTRL " xname, \ +- .name = xname, \ + .playback = AIU_ACODEC_STREAM(xname, "Playback", 8), \ + .ops = &aiu_acodec_ctrl_input_ops, \ + .probe = meson_codec_glue_input_dai_probe, \ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-arm64-dts-meson-g12a-enable-DVFS-on-G12A-boa.patch b/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-arm64-dts-meson-g12a-enable-DVFS-on-G12A-boa.patch deleted file mode 100644 index c5120b53d8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-arm64-dts-meson-g12a-enable-DVFS-on-G12A-boa.patch +++ /dev/null @@ -1,270 +0,0 @@ -From 99f9913f183ca5cd957d1dfe2297e6279c0e4032 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:20 +0200 -Subject: [PATCH 025/187] FROMGIT: arm64: dts: meson-g12a: enable DVFS on G12A - boards - -Enable DVFS for the U200, SEI520 and X96-Max Amlogic G12A based board -by setting the clock, OPP and supply for each CPU cores. - -The CPU cluster power supply can achieve 0.73V to 1.01V using a PWM -output clocked at 800KHz with an inverse duty-cycle. - -DVFS has been tested by running the arm64 cpuburn at [1] and cycling -between all the possible cpufreq translations and checking the final -frequency using the clock-measurer, script at [2]. - -[1] https://github.com/ssvb/cpuburn-arm/blob/master/cpuburn-a53.S -[2] https://gist.github.com/superna9999/d4de964dbc0f84b7d527e1df2ddea25f - -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit 26328b18e2a1cffc92a32cc53c74bbca69ea7f60 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - .../boot/dts/amlogic/meson-g12a-sei510.dts | 55 +++++++++++++++++++ - .../boot/dts/amlogic/meson-g12a-u200.dts | 54 ++++++++++++++++++ - .../boot/dts/amlogic/meson-g12a-x96-max.dts | 52 ++++++++++++++++++ - 3 files changed, 161 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -index 12aa7eaeaf68..c9fa23a56562 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -@@ -129,6 +129,25 @@ - enable-active-high; - }; - -+ vddcpu: regulator-vddcpu { -+ /* -+ * SY8120B1ABC DC/DC Regulator. -+ */ -+ compatible = "pwm-regulator"; -+ -+ regulator-name = "VDDCPU"; -+ regulator-min-microvolt = <721000>; -+ regulator-max-microvolt = <1022000>; -+ -+ vin-supply = <&dc_in>; -+ -+ pwms = <&pwm_AO_cd 1 1250 0>; -+ pwm-dutycycle-range = <100 0>; -+ -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ - vddio_ao1v8: regulator-vddio_ao1v8 { - compatible = "regulator-fixed"; - regulator-name = "VDDIO_AO1V8"; -@@ -297,6 +316,34 @@ - status = "okay"; - }; - -+&cpu0 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -@@ -345,6 +392,14 @@ - pinctrl-names = "default"; - }; - -+&pwm_AO_cd { -+ pinctrl-0 = <&pwm_ao_d_e_pins>; -+ pinctrl-names = "default"; -+ clocks = <&xtal>; -+ clock-names = "clkin1"; -+ status = "okay"; -+}; -+ - &pwm_ef { - status = "okay"; - pinctrl-0 = <&pwm_e_pins>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -index 8551fbd4a488..2a324f0136e3 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -@@ -129,6 +129,24 @@ - regulator-always-on; - }; - -+ vddcpu: regulator-vddcpu { -+ /* -+ * MP8756GD Regulator. -+ */ -+ compatible = "pwm-regulator"; -+ -+ regulator-name = "VDDCPU"; -+ 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; -+ }; - }; - - &cec_AO { -@@ -145,6 +163,34 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&cpu0 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -@@ -197,6 +243,14 @@ - pinctrl-names = "default"; - }; - -+&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"; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -index fe4013cca876..c1e58a69d434 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -@@ -132,6 +132,22 @@ - regulator-always-on; - }; - -+ vddcpu: regulator-vddcpu { -+ compatible = "pwm-regulator"; -+ -+ regulator-name = "VDDCPU"; -+ regulator-min-microvolt = <721000>; -+ regulator-max-microvolt = <1022000>; -+ -+ vin-supply = <&dc_in>; -+ -+ pwms = <&pwm_AO_cd 1 1250 0>; -+ pwm-dutycycle-range = <100 0>; -+ -+ regulator-boot-on; -+ regulator-always-on; -+ }; -+ - sound { - compatible = "amlogic,axg-sound-card"; - model = "G12A-X96-MAX"; -@@ -242,6 +258,34 @@ - status = "okay"; - }; - -+&cpu0 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vddcpu>; -+ operating-points-v2 = <&cpu_opp_table>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -@@ -279,6 +323,14 @@ - pinctrl-names = "default"; - }; - -+&pwm_AO_cd { -+ pinctrl-0 = <&pwm_ao_d_e_pins>; -+ pinctrl-names = "default"; -+ clocks = <&xtal>; -+ clock-names = "clkin1"; -+ status = "okay"; -+}; -+ - &ext_mdio { - external_phy: ethernet-phy@0 { - /* Realtek RTL8211F (0x001cc916) */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-ASoC-meson-codec-glue-fix-pcm-format-cast-wa.patch b/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-ASoC-meson-codec-glue-fix-pcm-format-cast-wa.patch new file mode 100644 index 0000000000..f294b71837 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-ASoC-meson-codec-glue-fix-pcm-format-cast-wa.patch @@ -0,0 +1,32 @@ +From 8c5b9df1893669b287e9203a15b6da099d59573e Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 17 Feb 2020 02:54:18 +0000 +Subject: [PATCH 026/146] FROMGIT: ASoC: meson: codec-glue: fix pcm format cast + warning + +Clarify the cast of snd_pcm_format_t and fix the sparse warning: +restricted snd_pcm_format_t degrades to integer + +Fixes: 9c29fd9bdf92 ("ASoC: meson: g12a: extract codec-to-codec utils") +Reported-by: kbuild test robot +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/meson-codec-glue.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/meson/meson-codec-glue.c b/sound/soc/meson/meson-codec-glue.c +index 97bbc967e176..524a33472337 100644 +--- a/sound/soc/meson/meson-codec-glue.c ++++ b/sound/soc/meson/meson-codec-glue.c +@@ -74,7 +74,7 @@ int meson_codec_glue_input_hw_params(struct snd_pcm_substream *substream, + data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params)); + data->params.rate_min = params_rate(params); + data->params.rate_max = params_rate(params); +- data->params.formats = 1 << params_format(params); ++ data->params.formats = 1ULL << (__force int) params_format(params); + data->params.channels_min = params_channels(params); + data->params.channels_max = params_channels(params); + data->params.sig_bits = dai->driver->playback.sig_bits; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-arm64-dts-meson-g12b-add-cpus-OPP-tables.patch b/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-arm64-dts-meson-g12b-add-cpus-OPP-tables.patch deleted file mode 100644 index 290468ca67..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-arm64-dts-meson-g12b-add-cpus-OPP-tables.patch +++ /dev/null @@ -1,165 +0,0 @@ -From f2051f86046647f5a7ad39e271986553ae4e5ad7 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:21 +0200 -Subject: [PATCH 026/187] FROMGIT: arm64: dts: meson-g12b: add cpus OPP tables - -Add the OPP table taken from the HardKernel Odroid-N2 DTS. - -The Amlogic G12B SoC seems to available in 2 types : -- low-speed: Cortex-A73 Cluster up to 1,704GHz -- high-speed: Cortex-A73 Cluster up to 2.208GHz - -The Cortex-A73 Cluster can be clocked up to 1,896GHz for both types. - -The Vendor Amlogic A311D OPP table are slighly different, with lower -voltages than the HardKernel S922X tables but seems to be high-speed type. - -This adds the conservative OPP table with the S922X higher voltages -and the maximum low-speed OPP frequency. - -The values were tested to be stable on an HardKernel Odroid-N2 board -running the arm64 cpuburn at [1] and cycling between all the possible -cpufreq translations for both clusters and checking the final frequency -using the clock-measurer, script at [2]. - -[1] https://github.com/ssvb/cpuburn-arm/blob/master/cpuburn-a53.S -[2] https://gist.github.com/superna9999/d4de964dbc0f84b7d527e1df2ddea25f - -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit e53df01cf17faea76e29332b88b30ca02998fb3f - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 115 ++++++++++++++++++++ - 1 file changed, 115 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -index d5edbc1a1991..98ae8a7c8b41 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -@@ -95,6 +95,121 @@ - compatible = "cache"; - }; - }; -+ -+ cpu_opp_table_0: opp-table-0 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-666666666 { -+ opp-hz = /bits/ 64 <666666666>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <761000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <831000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1896000000 { -+ opp-hz = /bits/ 64 <1896000000>; -+ opp-microvolt = <981000>; -+ }; -+ }; -+ -+ cpub_opp_table_1: opp-table-1 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-666666666 { -+ opp-hz = /bits/ 64 <666666666>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <771000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <821000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <891000>; -+ }; -+ }; - }; - - &clkc { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch b/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch new file mode 100644 index 0000000000..9cd72bff5b --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch @@ -0,0 +1,113 @@ +From 9a99b4ea1ffa2c15a9c8b4b7ab483baa5d5d2075 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 17 Feb 2020 17:16:47 +0000 +Subject: [PATCH 027/146] FROMGIT: ASoC: meson: aiu: simplify component + addition + +Now that the component name is unique within ASoC, there is no need to +hack the debugfs prefix to add more than one ASoC component to a linux +device. Remove the unnecessary function and use +snd_soc_register_component() directly. + +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/aiu-acodec-ctrl.c | 7 +++---- + sound/soc/meson/aiu-codec-ctrl.c | 7 +++---- + sound/soc/meson/aiu.c | 20 -------------------- + sound/soc/meson/aiu.h | 8 -------- + 4 files changed, 6 insertions(+), 36 deletions(-) + +diff --git a/sound/soc/meson/aiu-acodec-ctrl.c b/sound/soc/meson/aiu-acodec-ctrl.c +index b8e88b1a4fc8..7078197e0cc5 100644 +--- a/sound/soc/meson/aiu-acodec-ctrl.c ++++ b/sound/soc/meson/aiu-acodec-ctrl.c +@@ -197,8 +197,7 @@ static const struct snd_soc_component_driver aiu_acodec_ctrl_component = { + + int aiu_acodec_ctrl_register_component(struct device *dev) + { +- return aiu_add_component(dev, &aiu_acodec_ctrl_component, +- aiu_acodec_ctrl_dai_drv, +- ARRAY_SIZE(aiu_acodec_ctrl_dai_drv), +- "acodec"); ++ return snd_soc_register_component(dev, &aiu_acodec_ctrl_component, ++ aiu_acodec_ctrl_dai_drv, ++ ARRAY_SIZE(aiu_acodec_ctrl_dai_drv)); + } +diff --git a/sound/soc/meson/aiu-codec-ctrl.c b/sound/soc/meson/aiu-codec-ctrl.c +index 8646a953e3b3..4b773d3e8b07 100644 +--- a/sound/soc/meson/aiu-codec-ctrl.c ++++ b/sound/soc/meson/aiu-codec-ctrl.c +@@ -144,9 +144,8 @@ static const struct snd_soc_component_driver aiu_hdmi_ctrl_component = { + + int aiu_hdmi_ctrl_register_component(struct device *dev) + { +- return aiu_add_component(dev, &aiu_hdmi_ctrl_component, +- aiu_hdmi_ctrl_dai_drv, +- ARRAY_SIZE(aiu_hdmi_ctrl_dai_drv), +- "hdmi"); ++ return snd_soc_register_component(dev, &aiu_hdmi_ctrl_component, ++ aiu_hdmi_ctrl_dai_drv, ++ ARRAY_SIZE(aiu_hdmi_ctrl_dai_drv)); + } + +diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c +index 34b40b8b8299..d3e2d40e9562 100644 +--- a/sound/soc/meson/aiu.c ++++ b/sound/soc/meson/aiu.c +@@ -71,26 +71,6 @@ int aiu_of_xlate_dai_name(struct snd_soc_component *component, + return 0; + } + +-int aiu_add_component(struct device *dev, +- const struct snd_soc_component_driver *component_driver, +- struct snd_soc_dai_driver *dai_drv, +- int num_dai, +- const char *debugfs_prefix) +-{ +- struct snd_soc_component *component; +- +- component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); +- if (!component) +- return -ENOMEM; +- +-#ifdef CONFIG_DEBUG_FS +- component->debugfs_prefix = debugfs_prefix; +-#endif +- +- return snd_soc_add_component(dev, component, component_driver, +- dai_drv, num_dai); +-} +- + static int aiu_cpu_of_xlate_dai_name(struct snd_soc_component *component, + struct of_phandle_args *args, + const char **dai_name) +diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h +index 097c26de7b7c..06a968c55728 100644 +--- a/sound/soc/meson/aiu.h ++++ b/sound/soc/meson/aiu.h +@@ -11,9 +11,7 @@ struct clk; + struct clk_bulk_data; + struct device; + struct of_phandle_args; +-struct snd_soc_component_driver; + struct snd_soc_dai; +-struct snd_soc_dai_driver; + struct snd_soc_dai_ops; + + enum aiu_clk_ids { +@@ -45,12 +43,6 @@ int aiu_of_xlate_dai_name(struct snd_soc_component *component, + const char **dai_name, + unsigned int component_id); + +-int aiu_add_component(struct device *dev, +- const struct snd_soc_component_driver *component_driver, +- struct snd_soc_dai_driver *dai_drv, +- int num_dai, +- const char *debugfs_prefix); +- + int aiu_hdmi_ctrl_register_component(struct device *dev); + int aiu_acodec_ctrl_register_component(struct device *dev); + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-arm64-dts-meson-add-ethernet-fifo-sizes.patch b/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-arm64-dts-meson-add-ethernet-fifo-sizes.patch deleted file mode 100644 index dfc324d85d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-arm64-dts-meson-add-ethernet-fifo-sizes.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 790868826ea09c180ce83ffd24a1316a068378fc Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 18 Jul 2019 11:03:01 +0200 -Subject: [PATCH 027/187] FROMGIT: arm64: dts: meson: add ethernet fifo sizes - -If unspecified in DT, the fifo sizes are not automatically detected by -the dwmac1000 dma driver and the reported fifo sizes default to 0. -Because of this, flow control will be turned off on the device. - -Add the fifo sizes provided by the datasheets in the SoC in DT so -flow control may be enabled if necessary. - -Signed-off-by: Jerome Brunet -Reviewed-by: Martin Blumenstingl -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit af29074f707b7f6d07b2484abc62db35c42c38ec - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) -Signed-off-by: Neil Armstrong ---- - arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 2 ++ - arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 ++ - arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 2 ++ - 3 files changed, 6 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi -index 6219337033a0..12bf959c17a7 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi -@@ -182,6 +182,8 @@ - <&clkc CLKID_FCLK_DIV2>, - <&clkc CLKID_MPLL2>; - clock-names = "stmmaceth", "clkin0", "clkin1"; -+ rx-fifo-depth = <4096>; -+ tx-fifo-depth = <2048>; - status = "disabled"; - }; - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index 38d70ce1cfc7..27bb242dc95d 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -106,6 +106,8 @@ - <&clkc CLKID_FCLK_DIV2>, - <&clkc CLKID_MPLL2>; - clock-names = "stmmaceth", "clkin0", "clkin1"; -+ rx-fifo-depth = <4096>; -+ tx-fifo-depth = <2048>; - status = "disabled"; - - mdio0: mdio { -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -index 74d03fc706be..e62aad5bf867 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -493,6 +493,8 @@ - 0x0 0xc8834540 0x0 0x4>; - interrupts = ; - interrupt-names = "macirq"; -+ rx-fifo-depth = <4096>; -+ tx-fifo-depth = <2048>; - status = "disabled"; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-arm64-dts-meson-sm1-sei610-add-missing-inter.patch b/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-arm64-dts-meson-sm1-sei610-add-missing-inter.patch new file mode 100644 index 0000000000..4e0f1c60ad --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-arm64-dts-meson-sm1-sei610-add-missing-inter.patch @@ -0,0 +1,33 @@ +From d7ed18c0cb5c844464928fb00e9dcb5e59fb0bd1 Mon Sep 17 00:00:00 2001 +From: Guillaume La Roque +Date: Fri, 17 Jan 2020 14:34:23 +0100 +Subject: [PATCH 028/146] FROMGIT: arm64: dts: meson-sm1-sei610: add missing + interrupt-names + +add missing "host-wakeup interrupt names + +Fixes: 30388cc07572 ("arm64: dts: meson-sm1-sei610: add gpio bluetooth interrupt") + +Signed-off-by: Guillaume La Roque +Acked-by: Neil Armstrong +Link: https://lore.kernel.org/r/20200117133423.22602-1-glaroque@baylibre.com +Signed-off-by: Kevin Hilman +--- + arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +index a8bb3fa9fec9..cb1b48f5b8b1 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +@@ -593,6 +593,7 @@ + compatible = "brcm,bcm43438-bt"; + interrupt-parent = <&gpio_intc>; + interrupts = <95 IRQ_TYPE_LEVEL_HIGH>; ++ interrupt-names = "host-wakeup"; + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + max-speed = <2000000>; + clocks = <&wifi32k>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-dt-bindings-arm-amlogic-add-bindings-for-G12.patch b/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-dt-bindings-arm-amlogic-add-bindings-for-G12.patch deleted file mode 100644 index f48524f2b8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-dt-bindings-arm-amlogic-add-bindings-for-G12.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b2f7fe5418b3a565c350bf0971f6e66f8ef8828b Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 31 Jul 2019 14:39:56 +0200 -Subject: [PATCH 028/187] FROMGIT: dt-bindings: arm: amlogic: add bindings for - G12B based S922X SoC - -Add a specific compatible for the Amlogic G12B family based S922X SoC -to differentiate with the A311D SoC from the same family. - -Signed-off-by: Neil Armstrong -Reviewed-by: Rob Herring -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit 5d2b173b89a02a6fc52217dc4d585c81b53d1d29 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml -index 325c6fd3566d..3c3bc806cd23 100644 ---- a/Documentation/devicetree/bindings/arm/amlogic.yaml -+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -139,6 +139,7 @@ properties: - items: - - enum: - - hardkernel,odroid-n2 -+ - const: amlogic,s922x - - const: amlogic,g12b - - ... --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-dt-bindings-arm-amlogic-add-bindings-for-the.patch b/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-dt-bindings-arm-amlogic-add-bindings-for-the.patch deleted file mode 100644 index 9ce89a319d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-dt-bindings-arm-amlogic-add-bindings-for-the.patch +++ /dev/null @@ -1,38 +0,0 @@ -From f21c6919d27ee39a727196f7ee725828e96ae7aa Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 31 Jul 2019 14:39:57 +0200 -Subject: [PATCH 029/187] FROMGIT: dt-bindings: arm: amlogic: add bindings for - the Amlogic G12B based A311D SoC - -Add a specific compatible for the Amlogic G12B bases A311D SoC used -in the Khadas VIM3. - -Signed-off-by: Neil Armstrong -Reviewed-by: Rob Herring -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit 96561b0c5e4be51bb57df2cc388a1b688a93a036 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - Documentation/devicetree/bindings/arm/amlogic.yaml | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml -index 3c3bc806cd23..efa032d12402 100644 ---- a/Documentation/devicetree/bindings/arm/amlogic.yaml -+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -135,6 +135,11 @@ properties: - - amlogic,u200 - - const: amlogic,g12a - -+ - description: Boards with the Amlogic Meson G12B A311D SoC -+ items: -+ - const: amlogic,a311d -+ - const: amlogic,g12b -+ - - description: Boards with the Amlogic Meson G12B S922X SoC - items: - - enum: --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-firmware-meson_sm-Add-secure-power-domain-su.patch b/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-firmware-meson_sm-Add-secure-power-domain-su.patch new file mode 100644 index 0000000000..df8effd161 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-firmware-meson_sm-Add-secure-power-domain-su.patch @@ -0,0 +1,46 @@ +From 9c7dd0fbffecbe8ba36083c9e3a8d42a86016205 Mon Sep 17 00:00:00 2001 +From: Jianxin Pan +Date: Wed, 15 Jan 2020 19:30:28 +0800 +Subject: [PATCH 029/146] FROMGIT: firmware: meson_sm: Add secure power domain + support + +The Amlogic Meson A1/C1 Secure Monitor implements calls to control power +domain. + +Signed-off-by: Jianxin Pan +Signed-off-by: Kevin Hilman +Link: https://lore.kernel.org/r/1579087831-94965-2-git-send-email-jianxin.pan@amlogic.com +--- + drivers/firmware/meson/meson_sm.c | 2 ++ + include/linux/firmware/meson/meson_sm.h | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c +index 1d5b4d74f96d..2854b56f6e0b 100644 +--- a/drivers/firmware/meson/meson_sm.c ++++ b/drivers/firmware/meson/meson_sm.c +@@ -44,6 +44,8 @@ static const struct meson_sm_chip gxbb_chip = { + CMD(SM_EFUSE_WRITE, 0x82000031), + CMD(SM_EFUSE_USER_MAX, 0x82000033), + CMD(SM_GET_CHIP_ID, 0x82000044), ++ CMD(SM_A1_PWRC_SET, 0x82000093), ++ CMD(SM_A1_PWRC_GET, 0x82000095), + { /* sentinel */ }, + }, + }; +diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h +index 6669e2a1d5fd..95b0da2326a9 100644 +--- a/include/linux/firmware/meson/meson_sm.h ++++ b/include/linux/firmware/meson/meson_sm.h +@@ -12,6 +12,8 @@ enum { + SM_EFUSE_WRITE, + SM_EFUSE_USER_MAX, + SM_GET_CHIP_ID, ++ SM_A1_PWRC_SET, ++ SM_A1_PWRC_GET, + }; + + struct meson_sm_firmware; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch b/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch deleted file mode 100644 index 9ef2eb9e9c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch +++ /dev/null @@ -1,61 +0,0 @@ -From a93a1727c5957498fe230578794e28489e09c005 Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Wed, 31 Jul 2019 14:39:58 +0200 -Subject: [PATCH 030/187] FROMGIT: dt-bindings: arm: amlogic: add support for - the Khadas VIM3 - -The Khadas VIM3 uses the Amlogic S922X or A311S SoC, both based on the -Amlogic G12B SoC family, on a board with the same form factor as the -VIM/VIM2 models. It ships in two variants; basic and -pro which differ in RAM and eMMC size: - -- 2GB (basic) or 4GB (pro) LPDDR4 RAM -- 16GB (basic) or 32GB (pro) eMMC 5.1 storage -- 16MB SPI flash -- 10/100/1000 Base-T Ethernet -- AP6398S Wireless (802.11 a/b/g/n/ac, BT5.0) -- HDMI 2.1 video -- 1x USB 2.0 + 1x USB 3.0 ports -- 1x USB-C (power) with USB 2.0 OTG -- 3x LED's (1x red, 1x blue, 1x white) -- 3x buttons (power, function, reset) -- IR receiver -- M2 socket with PCIe, USB, ADC & I2C -- 40pin GPIO Header -- 1x micro SD card slot - -Signed-off-by: Christian Hewitt -Signed-off-by: Neil Armstrong -Reviewed-by: Rob Herring -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit edd55c0496b4bea6b2fa4b8f4646d06f47bb02d6 - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - Documentation/devicetree/bindings/arm/amlogic.yaml | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml -index efa032d12402..04a2b0ef34c6 100644 ---- a/Documentation/devicetree/bindings/arm/amlogic.yaml -+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -137,6 +137,8 @@ properties: - - - description: Boards with the Amlogic Meson G12B A311D SoC - items: -+ - enum: -+ - khadas,vim3 - - const: amlogic,a311d - - const: amlogic,g12b - -@@ -144,6 +146,7 @@ properties: - items: - - enum: - - hardkernel,odroid-n2 -+ - khadas,vim3 - - const: amlogic,s922x - - const: amlogic,g12b - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-power-add-Amlogic-secure-power-d.patch b/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-power-add-Amlogic-secure-power-d.patch new file mode 100644 index 0000000000..4d4b08939d --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-power-add-Amlogic-secure-power-d.patch @@ -0,0 +1,110 @@ +From c09c38353f182231d63589ba32f6af56a3187dad Mon Sep 17 00:00:00 2001 +From: Jianxin Pan +Date: Wed, 15 Jan 2020 19:30:29 +0800 +Subject: [PATCH 030/146] FROMGIT: dt-bindings: power: add Amlogic secure power + domains bindings + +Add the bindings for the Amlogic Secure power domains, controlling the +secure power domains. + +The bindings targets the Amlogic A1 and C1 compatible SoCs, in which the +power domain registers are in secure world. + +Signed-off-by: Jianxin Pan +Signed-off-by: Kevin Hilman +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/1579087831-94965-3-git-send-email-jianxin.pan@amlogic.com +--- + .../power/amlogic,meson-sec-pwrc.yaml | 40 +++++++++++++++++++ + include/dt-bindings/power/meson-a1-power.h | 32 +++++++++++++++ + 2 files changed, 72 insertions(+) + create mode 100644 Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml + create mode 100644 include/dt-bindings/power/meson-a1-power.h + +diff --git a/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml b/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml +new file mode 100644 +index 000000000000..af32209218bb +--- /dev/null ++++ b/Documentation/devicetree/bindings/power/amlogic,meson-sec-pwrc.yaml +@@ -0,0 +1,40 @@ ++# SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++# Copyright (c) 2019 Amlogic, Inc ++# Author: Jianxin Pan ++%YAML 1.2 ++--- ++$id: "http://devicetree.org/schemas/power/amlogic,meson-sec-pwrc.yaml#" ++$schema: "http://devicetree.org/meta-schemas/core.yaml#" ++ ++title: Amlogic Meson Secure Power Domains ++ ++maintainers: ++ - Jianxin Pan ++ ++description: |+ ++ Secure Power Domains used in Meson A1/C1 SoCs, and should be the child node ++ of secure-monitor. ++ ++properties: ++ compatible: ++ enum: ++ - amlogic,meson-a1-pwrc ++ ++ "#power-domain-cells": ++ const: 1 ++ ++required: ++ - compatible ++ - "#power-domain-cells" ++ ++examples: ++ - | ++ secure-monitor { ++ compatible = "amlogic,meson-gxbb-sm"; ++ ++ pwrc: power-controller { ++ compatible = "amlogic,meson-a1-pwrc"; ++ #power-domain-cells = <1>; ++ }; ++ } ++ +diff --git a/include/dt-bindings/power/meson-a1-power.h b/include/dt-bindings/power/meson-a1-power.h +new file mode 100644 +index 000000000000..6cf50bfb8ccf +--- /dev/null ++++ b/include/dt-bindings/power/meson-a1-power.h +@@ -0,0 +1,32 @@ ++/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ ++/* ++ * Copyright (c) 2019 Amlogic, Inc. ++ * Author: Jianxin Pan ++ */ ++ ++#ifndef _DT_BINDINGS_MESON_A1_POWER_H ++#define _DT_BINDINGS_MESON_A1_POWER_H ++ ++#define PWRC_DSPA_ID 8 ++#define PWRC_DSPB_ID 9 ++#define PWRC_UART_ID 10 ++#define PWRC_DMC_ID 11 ++#define PWRC_I2C_ID 12 ++#define PWRC_PSRAM_ID 13 ++#define PWRC_ACODEC_ID 14 ++#define PWRC_AUDIO_ID 15 ++#define PWRC_OTP_ID 16 ++#define PWRC_DMA_ID 17 ++#define PWRC_SD_EMMC_ID 18 ++#define PWRC_RAMA_ID 19 ++#define PWRC_RAMB_ID 20 ++#define PWRC_IR_ID 21 ++#define PWRC_SPICC_ID 22 ++#define PWRC_SPIFC_ID 23 ++#define PWRC_USB_ID 24 ++#define PWRC_NIC_ID 25 ++#define PWRC_PDMIN_ID 26 ++#define PWRC_RSA_ID 27 ++#define PWRC_MAX_ID 28 ++ ++#endif +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-arm64-dts-meson-g12b-support-a311d-and-s922x.patch b/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-arm64-dts-meson-g12b-support-a311d-and-s922x.patch deleted file mode 100644 index eb41be361c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-arm64-dts-meson-g12b-support-a311d-and-s922x.patch +++ /dev/null @@ -1,455 +0,0 @@ -From 10204c18eca0f7d78ca76f7a880b13e770f10b48 Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Wed, 31 Jul 2019 14:39:59 +0200 -Subject: [PATCH 031/187] FROMGIT: arm64: dts: meson-g12b: support a311d and - s922x cpu operating points - -Meson g12b ships with a low-speed (S922X) and high-speed (A311D) variant -so remove cpu_opp_table nodes in meson-g12b.dtsi and create two new dtsi -that can be included in device-specific dts files. Opp points were taken -from the vendor BSP kernel. - -Also make meson-g12b-odroid-n2.dts include the new meson-g12b-s922x.dtsi. - -Signed-off-by: Christian Hewitt -Signed-off-by: Neil Armstrong -Reviewed-by: Kevin Hilman -Signed-off-by: Kevin Hilman -(cherry picked from commit 81f58a8b290787e52b4b919050f9093b13c485fa - git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git v5.4/dt64) ---- - .../boot/dts/amlogic/meson-g12b-a311d.dtsi | 149 ++++++++++++++++++ - .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 2 +- - .../boot/dts/amlogic/meson-g12b-s922x.dtsi | 124 +++++++++++++++ - arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 115 -------------- - 4 files changed, 274 insertions(+), 116 deletions(-) - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi -new file mode 100644 -index 000000000000..d61f43052a34 ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi -@@ -0,0 +1,149 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 BayLibre, SAS -+ * Author: Neil Armstrong -+ */ -+ -+#include "meson-g12b.dtsi" -+ -+/ { -+ cpu_opp_table_0: opp-table-0 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-667000000 { -+ opp-hz = /bits/ 64 <667000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <761000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <781000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <811000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <901000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <951000>; -+ }; -+ -+ opp-1800000000 { -+ opp-hz = /bits/ 64 <1800000000>; -+ opp-microvolt = <1001000>; -+ }; -+ }; -+ -+ cpub_opp_table_1: opp-table-1 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-667000000 { -+ opp-hz = /bits/ 64 <667000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <771000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <771000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <781000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1800000000 { -+ opp-hz = /bits/ 64 <1800000000>; -+ opp-microvolt = <831000>; -+ }; -+ -+ opp-1908000000 { -+ opp-hz = /bits/ 64 <1908000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-2016000000 { -+ opp-hz = /bits/ 64 <2016000000>; -+ opp-microvolt = <911000>; -+ }; -+ -+ opp-2108000000 { -+ opp-hz = /bits/ 64 <2108000000>; -+ opp-microvolt = <951000>; -+ }; -+ -+ opp-2208000000 { -+ opp-hz = /bits/ 64 <2208000000>; -+ opp-microvolt = <1011000>; -+ }; -+ }; -+}; -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 4e916e1f71f7..237adae0ffae 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -6,7 +6,7 @@ - - /dts-v1/; - --#include "meson-g12b.dtsi" -+#include "meson-g12b-s922x.dtsi" - #include - #include - #include -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi -new file mode 100644 -index 000000000000..046cc332d07f ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi -@@ -0,0 +1,124 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 BayLibre, SAS -+ * Author: Neil Armstrong -+ */ -+ -+#include "meson-g12b.dtsi" -+ -+/ { -+ cpu_opp_table_0: opp-table-0 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-667000000 { -+ opp-hz = /bits/ 64 <667000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <761000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <831000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1896000000 { -+ opp-hz = /bits/ 64 <1896000000>; -+ opp-microvolt = <981000>; -+ }; -+ }; -+ -+ cpub_opp_table_1: opp-table-1 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-667000000 { -+ opp-hz = /bits/ 64 <667000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <771000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <771000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <821000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <891000>; -+ }; -+ }; -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -index 98ae8a7c8b41..d5edbc1a1991 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -@@ -95,121 +95,6 @@ - compatible = "cache"; - }; - }; -- -- cpu_opp_table_0: opp-table-0 { -- compatible = "operating-points-v2"; -- opp-shared; -- -- opp-100000000 { -- opp-hz = /bits/ 64 <100000000>; -- opp-microvolt = <731000>; -- }; -- -- opp-250000000 { -- opp-hz = /bits/ 64 <250000000>; -- opp-microvolt = <731000>; -- }; -- -- opp-500000000 { -- opp-hz = /bits/ 64 <500000000>; -- opp-microvolt = <731000>; -- }; -- -- opp-666666666 { -- opp-hz = /bits/ 64 <666666666>; -- opp-microvolt = <731000>; -- }; -- -- opp-1000000000 { -- opp-hz = /bits/ 64 <1000000000>; -- opp-microvolt = <731000>; -- }; -- -- opp-1200000000 { -- opp-hz = /bits/ 64 <1200000000>; -- opp-microvolt = <731000>; -- }; -- -- opp-1398000000 { -- opp-hz = /bits/ 64 <1398000000>; -- opp-microvolt = <761000>; -- }; -- -- opp-1512000000 { -- opp-hz = /bits/ 64 <1512000000>; -- opp-microvolt = <791000>; -- }; -- -- opp-1608000000 { -- opp-hz = /bits/ 64 <1608000000>; -- opp-microvolt = <831000>; -- }; -- -- opp-1704000000 { -- opp-hz = /bits/ 64 <1704000000>; -- opp-microvolt = <861000>; -- }; -- -- opp-1896000000 { -- opp-hz = /bits/ 64 <1896000000>; -- opp-microvolt = <981000>; -- }; -- }; -- -- cpub_opp_table_1: opp-table-1 { -- compatible = "operating-points-v2"; -- opp-shared; -- -- opp-100000000 { -- opp-hz = /bits/ 64 <100000000>; -- opp-microvolt = <751000>; -- }; -- -- opp-250000000 { -- opp-hz = /bits/ 64 <250000000>; -- opp-microvolt = <751000>; -- }; -- -- opp-500000000 { -- opp-hz = /bits/ 64 <500000000>; -- opp-microvolt = <751000>; -- }; -- -- opp-666666666 { -- opp-hz = /bits/ 64 <666666666>; -- opp-microvolt = <751000>; -- }; -- -- opp-1000000000 { -- opp-hz = /bits/ 64 <1000000000>; -- opp-microvolt = <751000>; -- }; -- -- opp-1200000000 { -- opp-hz = /bits/ 64 <1200000000>; -- opp-microvolt = <771000>; -- }; -- -- opp-1398000000 { -- opp-hz = /bits/ 64 <1398000000>; -- opp-microvolt = <791000>; -- }; -- -- opp-1512000000 { -- opp-hz = /bits/ 64 <1512000000>; -- opp-microvolt = <821000>; -- }; -- -- opp-1608000000 { -- opp-hz = /bits/ 64 <1608000000>; -- opp-microvolt = <861000>; -- }; -- -- opp-1704000000 { -- opp-hz = /bits/ 64 <1704000000>; -- opp-microvolt = <891000>; -- }; -- }; - }; - - &clkc { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-soc-amlogic-Add-support-for-Secure-power-dom.patch b/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-soc-amlogic-Add-support-for-Secure-power-dom.patch new file mode 100644 index 0000000000..cfe6111199 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-soc-amlogic-Add-support-for-Secure-power-dom.patch @@ -0,0 +1,265 @@ +From 8d1db083028d67823dc8339cb801bb832304aac2 Mon Sep 17 00:00:00 2001 +From: Jianxin Pan +Date: Wed, 15 Jan 2020 19:30:30 +0800 +Subject: [PATCH 031/146] FROMGIT: soc: amlogic: Add support for Secure power + domains controller + +Add support for the Amlogic Secure Power controller. In A1/C1 series, power +control registers are in secure domain, and should be accessed by smc. + +Signed-off-by: Jianxin Pan +Signed-off-by: Kevin Hilman +Link: https://lore.kernel.org/r/1579087831-94965-4-git-send-email-jianxin.pan@amlogic.com +--- + drivers/soc/amlogic/Kconfig | 13 ++ + drivers/soc/amlogic/Makefile | 1 + + drivers/soc/amlogic/meson-secure-pwrc.c | 204 ++++++++++++++++++++++++ + 3 files changed, 218 insertions(+) + create mode 100644 drivers/soc/amlogic/meson-secure-pwrc.c + +diff --git a/drivers/soc/amlogic/Kconfig b/drivers/soc/amlogic/Kconfig +index bc2c912949bd..6cb06e7b5e63 100644 +--- a/drivers/soc/amlogic/Kconfig ++++ b/drivers/soc/amlogic/Kconfig +@@ -48,6 +48,19 @@ config MESON_EE_PM_DOMAINS + Say yes to expose Amlogic Meson Everything-Else Power Domains as + Generic Power Domains. + ++config MESON_SECURE_PM_DOMAINS ++ bool "Amlogic Meson Secure Power Domains driver" ++ depends on ARCH_MESON || COMPILE_TEST ++ depends on PM && OF ++ depends on HAVE_ARM_SMCCC ++ default ARCH_MESON ++ select PM_GENERIC_DOMAINS ++ select PM_GENERIC_DOMAINS_OF ++ help ++ Support for the power controller on Amlogic A1/C1 series. ++ Say yes to expose Amlogic Meson Secure Power Domains as Generic ++ Power Domains. ++ + config MESON_MX_SOCINFO + bool "Amlogic Meson MX SoC Information driver" + depends on ARCH_MESON || COMPILE_TEST +diff --git a/drivers/soc/amlogic/Makefile b/drivers/soc/amlogic/Makefile +index de79d044b545..7b8c5d323f5c 100644 +--- a/drivers/soc/amlogic/Makefile ++++ b/drivers/soc/amlogic/Makefile +@@ -5,3 +5,4 @@ obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o + obj-$(CONFIG_MESON_GX_PM_DOMAINS) += meson-gx-pwrc-vpu.o + obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o + obj-$(CONFIG_MESON_EE_PM_DOMAINS) += meson-ee-pwrc.o ++obj-$(CONFIG_MESON_SECURE_PM_DOMAINS) += meson-secure-pwrc.o +diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c +new file mode 100644 +index 000000000000..5fb29a475879 +--- /dev/null ++++ b/drivers/soc/amlogic/meson-secure-pwrc.c +@@ -0,0 +1,204 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 Amlogic, Inc. ++ * Author: Jianxin Pan ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define PWRC_ON 1 ++#define PWRC_OFF 0 ++ ++struct meson_secure_pwrc_domain { ++ struct generic_pm_domain base; ++ unsigned int index; ++ struct meson_secure_pwrc *pwrc; ++}; ++ ++struct meson_secure_pwrc { ++ struct meson_secure_pwrc_domain *domains; ++ struct genpd_onecell_data xlate; ++ struct meson_sm_firmware *fw; ++}; ++ ++struct meson_secure_pwrc_domain_desc { ++ unsigned int index; ++ unsigned int flags; ++ char *name; ++ bool (*is_off)(struct meson_secure_pwrc_domain *pwrc_domain); ++}; ++ ++struct meson_secure_pwrc_domain_data { ++ unsigned int count; ++ struct meson_secure_pwrc_domain_desc *domains; ++}; ++ ++static bool pwrc_secure_is_off(struct meson_secure_pwrc_domain *pwrc_domain) ++{ ++ int is_off = 1; ++ ++ if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_GET, &is_off, ++ pwrc_domain->index, 0, 0, 0, 0) < 0) ++ pr_err("failed to get power domain status\n"); ++ ++ return is_off; ++} ++ ++static int meson_secure_pwrc_off(struct generic_pm_domain *domain) ++{ ++ int ret = 0; ++ struct meson_secure_pwrc_domain *pwrc_domain = ++ container_of(domain, struct meson_secure_pwrc_domain, base); ++ ++ if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, ++ pwrc_domain->index, PWRC_OFF, 0, 0, 0) < 0) { ++ pr_err("failed to set power domain off\n"); ++ ret = -EINVAL; ++ } ++ ++ return ret; ++} ++ ++static int meson_secure_pwrc_on(struct generic_pm_domain *domain) ++{ ++ int ret = 0; ++ struct meson_secure_pwrc_domain *pwrc_domain = ++ container_of(domain, struct meson_secure_pwrc_domain, base); ++ ++ if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL, ++ pwrc_domain->index, PWRC_ON, 0, 0, 0) < 0) { ++ pr_err("failed to set power domain on\n"); ++ ret = -EINVAL; ++ } ++ ++ return ret; ++} ++ ++#define SEC_PD(__name, __flag) \ ++[PWRC_##__name##_ID] = \ ++{ \ ++ .name = #__name, \ ++ .index = PWRC_##__name##_ID, \ ++ .is_off = pwrc_secure_is_off, \ ++ .flags = __flag, \ ++} ++ ++static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = { ++ SEC_PD(DSPA, 0), ++ SEC_PD(DSPB, 0), ++ /* UART should keep working in ATF after suspend and before resume */ ++ SEC_PD(UART, GENPD_FLAG_ALWAYS_ON), ++ /* DMC is for DDR PHY ana/dig and DMC, and should be always on */ ++ SEC_PD(DMC, GENPD_FLAG_ALWAYS_ON), ++ SEC_PD(I2C, 0), ++ SEC_PD(PSRAM, 0), ++ SEC_PD(ACODEC, 0), ++ SEC_PD(AUDIO, 0), ++ SEC_PD(OTP, 0), ++ SEC_PD(DMA, 0), ++ SEC_PD(SD_EMMC, 0), ++ SEC_PD(RAMA, 0), ++ /* SRAMB is used as ATF runtime memory, and should be always on */ ++ SEC_PD(RAMB, GENPD_FLAG_ALWAYS_ON), ++ SEC_PD(IR, 0), ++ SEC_PD(SPICC, 0), ++ SEC_PD(SPIFC, 0), ++ SEC_PD(USB, 0), ++ /* NIC is for the Arm NIC-400 interconnect, and should be always on */ ++ SEC_PD(NIC, GENPD_FLAG_ALWAYS_ON), ++ SEC_PD(PDMIN, 0), ++ SEC_PD(RSA, 0), ++}; ++ ++static int meson_secure_pwrc_probe(struct platform_device *pdev) ++{ ++ int i; ++ struct device_node *sm_np; ++ struct meson_secure_pwrc *pwrc; ++ const struct meson_secure_pwrc_domain_data *match; ++ ++ match = of_device_get_match_data(&pdev->dev); ++ if (!match) { ++ dev_err(&pdev->dev, "failed to get match data\n"); ++ return -ENODEV; ++ } ++ ++ sm_np = of_find_compatible_node(NULL, NULL, "amlogic,meson-gxbb-sm"); ++ if (!sm_np) { ++ dev_err(&pdev->dev, "no secure-monitor node\n"); ++ return -ENODEV; ++ } ++ ++ pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); ++ if (!pwrc) ++ return -ENOMEM; ++ ++ pwrc->fw = meson_sm_get(sm_np); ++ of_node_put(sm_np); ++ if (!pwrc->fw) ++ return -EPROBE_DEFER; ++ ++ pwrc->xlate.domains = devm_kcalloc(&pdev->dev, match->count, ++ sizeof(*pwrc->xlate.domains), ++ GFP_KERNEL); ++ if (!pwrc->xlate.domains) ++ return -ENOMEM; ++ ++ pwrc->domains = devm_kcalloc(&pdev->dev, match->count, ++ sizeof(*pwrc->domains), GFP_KERNEL); ++ if (!pwrc->domains) ++ return -ENOMEM; ++ ++ pwrc->xlate.num_domains = match->count; ++ platform_set_drvdata(pdev, pwrc); ++ ++ for (i = 0 ; i < match->count ; ++i) { ++ struct meson_secure_pwrc_domain *dom = &pwrc->domains[i]; ++ ++ if (!match->domains[i].index) ++ continue; ++ ++ dom->pwrc = pwrc; ++ dom->index = match->domains[i].index; ++ dom->base.name = match->domains[i].name; ++ dom->base.flags = match->domains[i].flags; ++ dom->base.power_on = meson_secure_pwrc_on; ++ dom->base.power_off = meson_secure_pwrc_off; ++ ++ pm_genpd_init(&dom->base, NULL, match->domains[i].is_off(dom)); ++ ++ pwrc->xlate.domains[i] = &dom->base; ++ } ++ ++ return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); ++} ++ ++static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = { ++ .domains = a1_pwrc_domains, ++ .count = ARRAY_SIZE(a1_pwrc_domains), ++}; ++ ++static const struct of_device_id meson_secure_pwrc_match_table[] = { ++ { ++ .compatible = "amlogic,meson-a1-pwrc", ++ .data = &meson_secure_a1_pwrc_data, ++ }, ++ { /* sentinel */ } ++}; ++ ++static struct platform_driver meson_secure_pwrc_driver = { ++ .probe = meson_secure_pwrc_probe, ++ .driver = { ++ .name = "meson_secure_pwrc", ++ .of_match_table = meson_secure_pwrc_match_table, ++ }, ++}; ++builtin_platform_driver(meson_secure_pwrc_driver); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-arm64-dts-meson-a1-add-secure-power-domain-c.patch b/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-arm64-dts-meson-a1-add-secure-power-domain-c.patch new file mode 100644 index 0000000000..e9c5bf3144 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-arm64-dts-meson-a1-add-secure-power-domain-c.patch @@ -0,0 +1,35 @@ +From 0b4093fcfeaa133997436a41542042ebdc94d31b Mon Sep 17 00:00:00 2001 +From: Jianxin Pan +Date: Wed, 15 Jan 2020 19:30:31 +0800 +Subject: [PATCH 032/146] FROMGIT: arm64: dts: meson: a1: add secure power + domain controller + +Enable power domain controller for Meson A1 SoC. + +Signed-off-by: Jianxin Pan +Link: https://lore.kernel.org/r/1579087831-94965-5-git-send-email-jianxin.pan@amlogic.com +Signed-off-by: Kevin Hilman +--- + arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +index 4dec518c4dde..755b4ad15184 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +@@ -60,6 +60,12 @@ + + sm: secure-monitor { + compatible = "amlogic,meson-gxbb-sm"; ++ ++ pwrc: power-controller { ++ compatible = "amlogic,meson-a1-pwrc"; ++ #power-domain-cells = <1>; ++ status = "okay"; ++ }; + }; + + soc { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-pinctrl-meson-g12a-add-pwm_a-on-GPIOE_2-pinm.patch b/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-pinctrl-meson-g12a-add-pwm_a-on-GPIOE_2-pinm.patch deleted file mode 100644 index 27be880d18..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-pinctrl-meson-g12a-add-pwm_a-on-GPIOE_2-pinm.patch +++ /dev/null @@ -1,63 +0,0 @@ -From c506544def4b07d05664a3054b519de69d3ec8ef Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 14:58:38 +0200 -Subject: [PATCH 032/187] FROMGIT: pinctrl: meson-g12a: add pwm_a on GPIOE_2 - pinmux - -Add the missing pinmux for the pwm_a function on the GPIOE_2 pin. - -Reviewed-by: Kevin Hilman -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong -Link: https://lore.kernel.org/r/20190729125838.6498-1-narmstrong@baylibre.com -Signed-off-by: Linus Walleij -(cherry picked from commit 726e8d813771ed9c714d75c9ce58a97b9ddf343d - git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git for-next) ---- - drivers/pinctrl/meson/pinctrl-meson-g12a.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c -index 3475cd7bd2af..582665fd362a 100644 ---- a/drivers/pinctrl/meson/pinctrl-meson-g12a.c -+++ b/drivers/pinctrl/meson/pinctrl-meson-g12a.c -@@ -801,6 +801,9 @@ static const unsigned int remote_ao_input_pins[] = { GPIOAO_5 }; - /* ir_out */ - static const unsigned int remote_ao_out_pins[] = { GPIOAO_4 }; - -+/* pwm_a_e */ -+static const unsigned int pwm_a_e_pins[] = { GPIOE_2 }; -+ - /* pwm_ao_a */ - static const unsigned int pwm_ao_a_pins[] = { GPIOAO_11 }; - static const unsigned int pwm_ao_a_hiz_pins[] = { GPIOAO_11 }; -@@ -888,6 +891,7 @@ static struct meson_pmx_group meson_g12a_aobus_groups[] = { - GROUP(i2c_ao_slave_sda, 3), - GROUP(remote_ao_input, 1), - GROUP(remote_ao_out, 1), -+ GROUP(pwm_a_e, 3), - GROUP(pwm_ao_a, 3), - GROUP(pwm_ao_a_hiz, 2), - GROUP(pwm_ao_b, 3), -@@ -1192,6 +1196,10 @@ static const char * const remote_ao_out_groups[] = { - "remote_ao_out", - }; - -+static const char * const pwm_a_e_groups[] = { -+ "pwm_a_e", -+}; -+ - static const char * const pwm_ao_a_groups[] = { - "pwm_ao_a", "pwm_ao_a_hiz", - }; -@@ -1290,6 +1298,7 @@ static struct meson_pmx_func meson_g12a_aobus_functions[] = { - FUNCTION(i2c_ao_slave), - FUNCTION(remote_ao_input), - FUNCTION(remote_ao_out), -+ FUNCTION(pwm_a_e), - FUNCTION(pwm_ao_a), - FUNCTION(pwm_ao_b), - FUNCTION(pwm_ao_c), --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0033-FROMGIT-media-dt-bindings-media-meson-ao-cec-add-SM1.patch b/packages/linux/patches/amlogic/amlogic-0033-FROMGIT-media-dt-bindings-media-meson-ao-cec-add-SM1.patch deleted file mode 100644 index d2c5c1fda5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0033-FROMGIT-media-dt-bindings-media-meson-ao-cec-add-SM1.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 67ceba95531744f1217262ff2ad8259e58ace4a6 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 1 Jul 2019 06:47:01 -0400 -Subject: [PATCH 033/187] FROMGIT: media: dt-bindings: media: meson-ao-cec: add - SM1 compatible - -Add AO-CEC compatible string for the Amlogic SM1 SoC family, -a derivate of the G12A AO-CECB controller. - -Signed-off-by: Neil Armstrong -Reviewed-by: Rob Herring -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit 9bef0d1d053de8db30bc07aa132c0ee94a05609c - git://linuxtv.org/media_tree.git master) ---- - Documentation/devicetree/bindings/media/meson-ao-cec.txt | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/Documentation/devicetree/bindings/media/meson-ao-cec.txt b/Documentation/devicetree/bindings/media/meson-ao-cec.txt -index c67fc41d4aa2..ad92ee41c0dd 100644 ---- a/Documentation/devicetree/bindings/media/meson-ao-cec.txt -+++ b/Documentation/devicetree/bindings/media/meson-ao-cec.txt -@@ -5,10 +5,12 @@ to handle communication between HDMI connected devices over the CEC bus. - - Required properties: - - compatible : value should be following depending on the SoC : -- For GXBB, GXL, GXM and G12A (AO_CEC_A module) : -+ For GXBB, GXL, GXM, G12A and SM1 (AO_CEC_A module) : - "amlogic,meson-gx-ao-cec" - For G12A (AO_CEC_B module) : - "amlogic,meson-g12a-ao-cec" -+ For SM1 (AO_CEC_B module) : -+ "amlogic,meson-sm1-ao-cec" - - - reg : Physical base address of the IP registers and length of memory - mapped region. -@@ -16,9 +18,9 @@ Required properties: - - interrupts : AO-CEC interrupt number to the CPU. - - clocks : from common clock binding: handle to AO-CEC clock. - - clock-names : from common clock binding, must contain : -- For GXBB, GXL, GXM and G12A (AO_CEC_A module) : -+ For GXBB, GXL, GXM, G12A and SM1 (AO_CEC_A module) : - - "core" -- For G12A (AO_CEC_B module) : -+ For G12A, SM1 (AO_CEC_B module) : - - "oscin" - corresponding to entry in the clocks property. - - hdmi-phandle: phandle to the HDMI controller --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0067-FROMLIST-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch b/packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch similarity index 75% rename from packages/linux/patches/amlogic/amlogic-0067-FROMLIST-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch rename to packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch index f16cc1a4be..d7c0a6f0c4 100644 --- a/packages/linux/patches/amlogic/amlogic-0067-FROMLIST-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch +++ b/packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch @@ -1,7 +1,7 @@ -From 75d004308fdbad58bf576ca3f20f605d0a3e6668 Mon Sep 17 00:00:00 2001 +From f346db4e5460337ece11280792aae0f7064a072f Mon Sep 17 00:00:00 2001 From: Jerome Brunet -Date: Mon, 13 May 2019 14:45:31 +0200 -Subject: [PATCH 067/187] FROMLIST: clk: meson: g12a: fix gp0 and hifi ranges +Date: Fri, 15 Feb 2019 14:21:27 +0100 +Subject: [PATCH 033/146] WIP: clk: meson: g12a: fix gp0 and hifi ranges While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples @@ -16,16 +16,15 @@ It is still unclear if the range was the only reason for the delay. Fixes: 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller") Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong --- drivers/clk/meson/g12a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c -index c3f0ffc3280d..e6011d18a719 100644 +index d2760a021301..cd1de3e004e4 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c -@@ -1362,7 +1362,7 @@ static struct clk_regmap g12b_cpub_clk_trace = { +@@ -1591,7 +1591,7 @@ static struct clk_regmap g12b_cpub_clk_trace = { }; static const struct pll_mult_range g12a_gp0_pll_mult_range = { diff --git a/packages/linux/patches/amlogic/amlogic-0034-FROMGIT-media-platform-meson-ao-cec-g12a-add-support.patch b/packages/linux/patches/amlogic/amlogic-0034-FROMGIT-media-platform-meson-ao-cec-g12a-add-support.patch deleted file mode 100644 index b65818c3bd..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0034-FROMGIT-media-platform-meson-ao-cec-g12a-add-support.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 26d7eba2afa7827f7d3cdab82f60bfc063e5406b Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 1 Jul 2019 06:47:02 -0400 -Subject: [PATCH 034/187] FROMGIT: media: platform: meson-ao-cec-g12a: add - support for SM1 - -Add support for the Amlogic SM1 SoC Family to the G12A AO-CECB -derivative. - -It only adds a single init register. - -Signed-off-by: Neil Armstrong -[hverkuil-cisco@xs4all.nl: dropped spurious newline] -Signed-off-by: Hans Verkuil -Signed-off-by: Mauro Carvalho Chehab -(cherry picked from commit aef5f47c9907ed6bfe9245124279b9c049077fd7 - git://linuxtv.org/media_tree.git master) ---- - drivers/media/platform/meson/ao-cec-g12a.c | 36 +++++++++++++++++++++- - 1 file changed, 35 insertions(+), 1 deletion(-) - -diff --git a/drivers/media/platform/meson/ao-cec-g12a.c b/drivers/media/platform/meson/ao-cec-g12a.c -index fb52e5dd044a..d302eae569b3 100644 ---- a/drivers/media/platform/meson/ao-cec-g12a.c -+++ b/drivers/media/platform/meson/ao-cec-g12a.c -@@ -121,6 +121,9 @@ - #define CECB_CTRL_TYPE_NEXT 2 - - #define CECB_CTRL2 0x01 -+ -+#define CECB_CTRL2_RISE_DEL_MAX GENMASK(4, 0) -+ - #define CECB_INTR_MASK 0x02 - #define CECB_LADD_LOW 0x05 - #define CECB_LADD_HIGH 0x06 -@@ -165,6 +168,11 @@ - - #define CECB_WAKEUPCTRL 0x31 - -+struct meson_ao_cec_g12a_data { -+ /* Setup the internal CECB_CTRL2 register */ -+ bool ctrl2_setup; -+}; -+ - struct meson_ao_cec_g12a_device { - struct platform_device *pdev; - struct regmap *regmap; -@@ -175,6 +183,7 @@ struct meson_ao_cec_g12a_device { - struct cec_msg rx_msg; - struct clk *oscin; - struct clk *core; -+ const struct meson_ao_cec_g12a_data *data; - }; - - static const struct regmap_config meson_ao_cec_g12a_regmap_conf = { -@@ -605,6 +614,10 @@ static int meson_ao_cec_g12a_adap_enable(struct cec_adapter *adap, bool enable) - regmap_update_bits(ao_cec->regmap, CECB_GEN_CNTL_REG, - CECB_GEN_CNTL_RESET, 0); - -+ if (ao_cec->data->ctrl2_setup) -+ regmap_write(ao_cec->regmap_cec, CECB_CTRL2, -+ FIELD_PREP(CECB_CTRL2_RISE_DEL_MAX, 2)); -+ - meson_ao_cec_g12a_irq_setup(ao_cec, true); - - return 0; -@@ -632,6 +645,12 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev) - if (!ao_cec) - return -ENOMEM; - -+ ao_cec->data = of_device_get_match_data(&pdev->dev); -+ if (!ao_cec->data) { -+ dev_err(&pdev->dev, "failed to get match data\n"); -+ return -ENODEV; -+ } -+ - spin_lock_init(&ao_cec->cec_reg_lock); - ao_cec->pdev = pdev; - -@@ -742,8 +761,23 @@ static int meson_ao_cec_g12a_remove(struct platform_device *pdev) - return 0; - } - -+static const struct meson_ao_cec_g12a_data ao_cec_g12a_data = { -+ .ctrl2_setup = false, -+}; -+ -+static const struct meson_ao_cec_g12a_data ao_cec_sm1_data = { -+ .ctrl2_setup = true, -+}; -+ - static const struct of_device_id meson_ao_cec_g12a_of_match[] = { -- { .compatible = "amlogic,meson-g12a-ao-cec", }, -+ { -+ .compatible = "amlogic,meson-g12a-ao-cec", -+ .data = &ao_cec_g12a_data, -+ }, -+ { -+ .compatible = "amlogic,meson-sm1-ao-cec", -+ .data = &ao_cec_sm1_data, -+ }, - { /* sentinel */ } - }; - MODULE_DEVICE_TABLE(of, meson_ao_cec_g12a_of_match); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0034-FROMLIST-ASoC-meson-add-t9015-internal-codec-binding.patch b/packages/linux/patches/amlogic/amlogic-0034-FROMLIST-ASoC-meson-add-t9015-internal-codec-binding.patch new file mode 100644 index 0000000000..70e17e1a0d --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0034-FROMLIST-ASoC-meson-add-t9015-internal-codec-binding.patch @@ -0,0 +1,79 @@ +From db99ae06c558d1e9b1ab00c078294ee5448e61af Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 28 Jan 2020 13:38:38 +0100 +Subject: [PATCH 034/146] FROMLIST: ASoC: meson: add t9015 internal codec + binding documentation + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,t9015.yaml | 58 +++++++++++++++++++ + 1 file changed, 58 insertions(+) + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,t9015.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,t9015.yaml b/Documentation/devicetree/bindings/sound/amlogic,t9015.yaml +new file mode 100644 +index 000000000000..b7c38c2b5b54 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,t9015.yaml +@@ -0,0 +1,58 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,t9015.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic T9015 Internal Audio DAC ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ items: ++ - const: amlogic,t9015 ++ ++ clocks: ++ items: ++ - description: Peripheral clock ++ ++ clock-names: ++ items: ++ - const: pclk ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - clocks ++ - clock-names ++ - resets ++ ++examples: ++ - | ++ #include ++ #include ++ ++ acodec: audio-controller@32000 { ++ compatible = "amlogic,t9015"; ++ reg = <0x0 0x32000 0x0 0x14>; ++ #sound-dai-cells = <0>; ++ clocks = <&clkc CLKID_AUDIO_CODEC>; ++ clock-names = "pclk"; ++ resets = <&reset RESET_AUDIO_CODEC>; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0035-FROMGIT-ASoC-add-soc-dai.c.patch b/packages/linux/patches/amlogic/amlogic-0035-FROMGIT-ASoC-add-soc-dai.c.patch deleted file mode 100644 index 3de24cccac..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0035-FROMGIT-ASoC-add-soc-dai.c.patch +++ /dev/null @@ -1,574 +0,0 @@ -From e44570b26f3585a403194ca5124d4f815ca4f181 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:32:12 +0900 -Subject: [PATCH 035/187] FROMGIT: ASoC: add soc-dai.c - -Current ALSA SoC has many snd_soc_dai_xxx() function which is -using dai->driver->ops->xxx. -But, some of them are implemented as snd_soc_dai_xxx(), -but others are directly using dai->driver->ops->xxx. -Because of it, the code is not easy to read. - -This patch creats new soc-dai.c and moves snd_soc_dai_xxx() -functions into it. -One exception is snd_soc_dai_is_dummy() which is based on -soc-utils local variable. We need to keep it as-is there. - -Others which is directly using dai->driver->ops->xxx will be -implemented at soc-dai.c by incremental patches. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/871ryij1r6.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 06f6e1d41427f394ad3f67ecf06efcd28a46932c - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/Makefile | 2 +- - sound/soc/soc-core.c | 243 ----------------------------------------- - sound/soc/soc-dai.c | 254 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 255 insertions(+), 244 deletions(-) - create mode 100644 sound/soc/soc-dai.c - -diff --git a/sound/soc/Makefile b/sound/soc/Makefile -index d90ce8a32887..919c3c027c62 100644 ---- a/sound/soc/Makefile -+++ b/sound/soc/Makefile -@@ -1,5 +1,5 @@ - # SPDX-License-Identifier: GPL-2.0 --snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-utils.o -+snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-utils.o soc-dai.o - snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o - snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o - -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index 44f899b970c2..a8d2c4ec0ec9 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -2397,26 +2397,6 @@ int snd_soc_add_dai_controls(struct snd_soc_dai *dai, - } - EXPORT_SYMBOL_GPL(snd_soc_add_dai_controls); - --/** -- * snd_soc_dai_set_sysclk - configure DAI system or master clock. -- * @dai: DAI -- * @clk_id: DAI specific clock ID -- * @freq: new clock frequency in Hz -- * @dir: new clock direction - input/output. -- * -- * Configures the DAI master (MCLK) or system (SYSCLK) clocking. -- */ --int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, -- unsigned int freq, int dir) --{ -- if (dai->driver->ops->set_sysclk) -- return dai->driver->ops->set_sysclk(dai, clk_id, freq, dir); -- -- return snd_soc_component_set_sysclk(dai->component, clk_id, 0, -- freq, dir); --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); -- - /** - * snd_soc_component_set_sysclk - configure COMPONENT system or master clock. - * @component: COMPONENT -@@ -2439,48 +2419,6 @@ int snd_soc_component_set_sysclk(struct snd_soc_component *component, - } - EXPORT_SYMBOL_GPL(snd_soc_component_set_sysclk); - --/** -- * snd_soc_dai_set_clkdiv - configure DAI clock dividers. -- * @dai: DAI -- * @div_id: DAI specific clock divider ID -- * @div: new clock divisor. -- * -- * Configures the clock dividers. This is used to derive the best DAI bit and -- * frame clocks from the system or master clock. It's best to set the DAI bit -- * and frame clocks as low as possible to save system power. -- */ --int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, -- int div_id, int div) --{ -- if (dai->driver->ops->set_clkdiv) -- return dai->driver->ops->set_clkdiv(dai, div_id, div); -- else -- return -EINVAL; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_clkdiv); -- --/** -- * snd_soc_dai_set_pll - configure DAI PLL. -- * @dai: DAI -- * @pll_id: DAI specific PLL ID -- * @source: DAI specific source for the PLL -- * @freq_in: PLL input clock frequency in Hz -- * @freq_out: requested PLL output clock frequency in Hz -- * -- * Configures and enables PLL to generate output clock based on input clock. -- */ --int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source, -- unsigned int freq_in, unsigned int freq_out) --{ -- if (dai->driver->ops->set_pll) -- return dai->driver->ops->set_pll(dai, pll_id, source, -- freq_in, freq_out); -- -- return snd_soc_component_set_pll(dai->component, pll_id, source, -- freq_in, freq_out); --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll); -- - /* - * snd_soc_component_set_pll - configure component PLL. - * @component: COMPONENT -@@ -2503,187 +2441,6 @@ int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id, - } - EXPORT_SYMBOL_GPL(snd_soc_component_set_pll); - --/** -- * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio. -- * @dai: DAI -- * @ratio: Ratio of BCLK to Sample rate. -- * -- * Configures the DAI for a preset BCLK to sample rate ratio. -- */ --int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) --{ -- if (dai->driver->ops->set_bclk_ratio) -- return dai->driver->ops->set_bclk_ratio(dai, ratio); -- else -- return -EINVAL; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio); -- --/** -- * snd_soc_dai_set_fmt - configure DAI hardware audio format. -- * @dai: DAI -- * @fmt: SND_SOC_DAIFMT_* format value. -- * -- * Configures the DAI hardware format and clocking. -- */ --int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) --{ -- if (dai->driver->ops->set_fmt == NULL) -- return -ENOTSUPP; -- return dai->driver->ops->set_fmt(dai, fmt); --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); -- --/** -- * snd_soc_xlate_tdm_slot - generate tx/rx slot mask. -- * @slots: Number of slots in use. -- * @tx_mask: bitmask representing active TX slots. -- * @rx_mask: bitmask representing active RX slots. -- * -- * Generates the TDM tx and rx slot default masks for DAI. -- */ --static int snd_soc_xlate_tdm_slot_mask(unsigned int slots, -- unsigned int *tx_mask, -- unsigned int *rx_mask) --{ -- if (*tx_mask || *rx_mask) -- return 0; -- -- if (!slots) -- return -EINVAL; -- -- *tx_mask = (1 << slots) - 1; -- *rx_mask = (1 << slots) - 1; -- -- return 0; --} -- --/** -- * snd_soc_dai_set_tdm_slot() - Configures a DAI for TDM operation -- * @dai: The DAI to configure -- * @tx_mask: bitmask representing active TX slots. -- * @rx_mask: bitmask representing active RX slots. -- * @slots: Number of slots in use. -- * @slot_width: Width in bits for each slot. -- * -- * This function configures the specified DAI for TDM operation. @slot contains -- * the total number of slots of the TDM stream and @slot_with the width of each -- * slot in bit clock cycles. @tx_mask and @rx_mask are bitmasks specifying the -- * active slots of the TDM stream for the specified DAI, i.e. which slots the -- * DAI should write to or read from. If a bit is set the corresponding slot is -- * active, if a bit is cleared the corresponding slot is inactive. Bit 0 maps to -- * the first slot, bit 1 to the second slot and so on. The first active slot -- * maps to the first channel of the DAI, the second active slot to the second -- * channel and so on. -- * -- * TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask, -- * @rx_mask and @slot_width will be ignored. -- * -- * Returns 0 on success, a negative error code otherwise. -- */ --int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, -- unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) --{ -- if (dai->driver->ops->xlate_tdm_slot_mask) -- dai->driver->ops->xlate_tdm_slot_mask(slots, -- &tx_mask, &rx_mask); -- else -- snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask); -- -- dai->tx_mask = tx_mask; -- dai->rx_mask = rx_mask; -- -- if (dai->driver->ops->set_tdm_slot) -- return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask, -- slots, slot_width); -- else -- return -ENOTSUPP; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot); -- --/** -- * snd_soc_dai_set_channel_map - configure DAI audio channel map -- * @dai: DAI -- * @tx_num: how many TX channels -- * @tx_slot: pointer to an array which imply the TX slot number channel -- * 0~num-1 uses -- * @rx_num: how many RX channels -- * @rx_slot: pointer to an array which imply the RX slot number channel -- * 0~num-1 uses -- * -- * configure the relationship between channel number and TDM slot number. -- */ --int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, -- unsigned int tx_num, unsigned int *tx_slot, -- unsigned int rx_num, unsigned int *rx_slot) --{ -- if (dai->driver->ops->set_channel_map) -- return dai->driver->ops->set_channel_map(dai, tx_num, tx_slot, -- rx_num, rx_slot); -- else -- return -ENOTSUPP; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map); -- --/** -- * snd_soc_dai_get_channel_map - Get DAI audio channel map -- * @dai: DAI -- * @tx_num: how many TX channels -- * @tx_slot: pointer to an array which imply the TX slot number channel -- * 0~num-1 uses -- * @rx_num: how many RX channels -- * @rx_slot: pointer to an array which imply the RX slot number channel -- * 0~num-1 uses -- */ --int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, -- unsigned int *tx_num, unsigned int *tx_slot, -- unsigned int *rx_num, unsigned int *rx_slot) --{ -- if (dai->driver->ops->get_channel_map) -- return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, -- rx_num, rx_slot); -- else -- return -ENOTSUPP; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); -- --/** -- * snd_soc_dai_set_tristate - configure DAI system or master clock. -- * @dai: DAI -- * @tristate: tristate enable -- * -- * Tristates the DAI so that others can use it. -- */ --int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate) --{ -- if (dai->driver->ops->set_tristate) -- return dai->driver->ops->set_tristate(dai, tristate); -- else -- return -EINVAL; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate); -- --/** -- * snd_soc_dai_digital_mute - configure DAI system or master clock. -- * @dai: DAI -- * @mute: mute enable -- * @direction: stream to mute -- * -- * Mutes the DAI DAC. -- */ --int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, -- int direction) --{ -- if (dai->driver->ops->mute_stream) -- return dai->driver->ops->mute_stream(dai, mute, direction); -- else if (direction == SNDRV_PCM_STREAM_PLAYBACK && -- dai->driver->ops->digital_mute) -- return dai->driver->ops->digital_mute(dai, mute); -- else -- return -ENOTSUPP; --} --EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); -- - static int snd_soc_bind_card(struct snd_soc_card *card) - { - struct snd_soc_pcm_runtime *rtd; -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -new file mode 100644 -index 000000000000..a1009ead40de ---- /dev/null -+++ b/sound/soc/soc-dai.c -@@ -0,0 +1,254 @@ -+// SPDX-License-Identifier: GPL-2.0 -+// -+// soc-dai.c -+// -+// Copyright (C) 2019 Renesas Electronics Corp. -+// Kuninori Morimoto -+// -+ -+#include -+#include -+ -+/** -+ * snd_soc_dai_set_sysclk - configure DAI system or master clock. -+ * @dai: DAI -+ * @clk_id: DAI specific clock ID -+ * @freq: new clock frequency in Hz -+ * @dir: new clock direction - input/output. -+ * -+ * Configures the DAI master (MCLK) or system (SYSCLK) clocking. -+ */ -+int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, -+ unsigned int freq, int dir) -+{ -+ if (dai->driver->ops->set_sysclk) -+ return dai->driver->ops->set_sysclk(dai, clk_id, freq, dir); -+ -+ return snd_soc_component_set_sysclk(dai->component, clk_id, 0, -+ freq, dir); -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); -+ -+/** -+ * snd_soc_dai_set_clkdiv - configure DAI clock dividers. -+ * @dai: DAI -+ * @div_id: DAI specific clock divider ID -+ * @div: new clock divisor. -+ * -+ * Configures the clock dividers. This is used to derive the best DAI bit and -+ * frame clocks from the system or master clock. It's best to set the DAI bit -+ * and frame clocks as low as possible to save system power. -+ */ -+int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, -+ int div_id, int div) -+{ -+ if (dai->driver->ops->set_clkdiv) -+ return dai->driver->ops->set_clkdiv(dai, div_id, div); -+ else -+ return -EINVAL; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_clkdiv); -+ -+/** -+ * snd_soc_dai_set_pll - configure DAI PLL. -+ * @dai: DAI -+ * @pll_id: DAI specific PLL ID -+ * @source: DAI specific source for the PLL -+ * @freq_in: PLL input clock frequency in Hz -+ * @freq_out: requested PLL output clock frequency in Hz -+ * -+ * Configures and enables PLL to generate output clock based on input clock. -+ */ -+int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source, -+ unsigned int freq_in, unsigned int freq_out) -+{ -+ if (dai->driver->ops->set_pll) -+ return dai->driver->ops->set_pll(dai, pll_id, source, -+ freq_in, freq_out); -+ -+ return snd_soc_component_set_pll(dai->component, pll_id, source, -+ freq_in, freq_out); -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll); -+ -+/** -+ * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio. -+ * @dai: DAI -+ * @ratio: Ratio of BCLK to Sample rate. -+ * -+ * Configures the DAI for a preset BCLK to sample rate ratio. -+ */ -+int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) -+{ -+ if (dai->driver->ops->set_bclk_ratio) -+ return dai->driver->ops->set_bclk_ratio(dai, ratio); -+ else -+ return -EINVAL; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio); -+ -+/** -+ * snd_soc_dai_set_fmt - configure DAI hardware audio format. -+ * @dai: DAI -+ * @fmt: SND_SOC_DAIFMT_* format value. -+ * -+ * Configures the DAI hardware format and clocking. -+ */ -+int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) -+{ -+ if (dai->driver->ops->set_fmt == NULL) -+ return -ENOTSUPP; -+ return dai->driver->ops->set_fmt(dai, fmt); -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); -+ -+/** -+ * snd_soc_xlate_tdm_slot - generate tx/rx slot mask. -+ * @slots: Number of slots in use. -+ * @tx_mask: bitmask representing active TX slots. -+ * @rx_mask: bitmask representing active RX slots. -+ * -+ * Generates the TDM tx and rx slot default masks for DAI. -+ */ -+static int snd_soc_xlate_tdm_slot_mask(unsigned int slots, -+ unsigned int *tx_mask, -+ unsigned int *rx_mask) -+{ -+ if (*tx_mask || *rx_mask) -+ return 0; -+ -+ if (!slots) -+ return -EINVAL; -+ -+ *tx_mask = (1 << slots) - 1; -+ *rx_mask = (1 << slots) - 1; -+ -+ return 0; -+} -+ -+/** -+ * snd_soc_dai_set_tdm_slot() - Configures a DAI for TDM operation -+ * @dai: The DAI to configure -+ * @tx_mask: bitmask representing active TX slots. -+ * @rx_mask: bitmask representing active RX slots. -+ * @slots: Number of slots in use. -+ * @slot_width: Width in bits for each slot. -+ * -+ * This function configures the specified DAI for TDM operation. @slot contains -+ * the total number of slots of the TDM stream and @slot_with the width of each -+ * slot in bit clock cycles. @tx_mask and @rx_mask are bitmasks specifying the -+ * active slots of the TDM stream for the specified DAI, i.e. which slots the -+ * DAI should write to or read from. If a bit is set the corresponding slot is -+ * active, if a bit is cleared the corresponding slot is inactive. Bit 0 maps to -+ * the first slot, bit 1 to the second slot and so on. The first active slot -+ * maps to the first channel of the DAI, the second active slot to the second -+ * channel and so on. -+ * -+ * TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask, -+ * @rx_mask and @slot_width will be ignored. -+ * -+ * Returns 0 on success, a negative error code otherwise. -+ */ -+int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, -+ unsigned int tx_mask, unsigned int rx_mask, -+ int slots, int slot_width) -+{ -+ if (dai->driver->ops->xlate_tdm_slot_mask) -+ dai->driver->ops->xlate_tdm_slot_mask(slots, -+ &tx_mask, &rx_mask); -+ else -+ snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask); -+ -+ dai->tx_mask = tx_mask; -+ dai->rx_mask = rx_mask; -+ -+ if (dai->driver->ops->set_tdm_slot) -+ return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask, -+ slots, slot_width); -+ else -+ return -ENOTSUPP; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot); -+ -+/** -+ * snd_soc_dai_set_channel_map - configure DAI audio channel map -+ * @dai: DAI -+ * @tx_num: how many TX channels -+ * @tx_slot: pointer to an array which imply the TX slot number channel -+ * 0~num-1 uses -+ * @rx_num: how many RX channels -+ * @rx_slot: pointer to an array which imply the RX slot number channel -+ * 0~num-1 uses -+ * -+ * configure the relationship between channel number and TDM slot number. -+ */ -+int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, -+ unsigned int tx_num, unsigned int *tx_slot, -+ unsigned int rx_num, unsigned int *rx_slot) -+{ -+ if (dai->driver->ops->set_channel_map) -+ return dai->driver->ops->set_channel_map(dai, tx_num, tx_slot, -+ rx_num, rx_slot); -+ else -+ return -ENOTSUPP; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map); -+ -+/** -+ * snd_soc_dai_get_channel_map - Get DAI audio channel map -+ * @dai: DAI -+ * @tx_num: how many TX channels -+ * @tx_slot: pointer to an array which imply the TX slot number channel -+ * 0~num-1 uses -+ * @rx_num: how many RX channels -+ * @rx_slot: pointer to an array which imply the RX slot number channel -+ * 0~num-1 uses -+ */ -+int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, -+ unsigned int *tx_num, unsigned int *tx_slot, -+ unsigned int *rx_num, unsigned int *rx_slot) -+{ -+ if (dai->driver->ops->get_channel_map) -+ return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, -+ rx_num, rx_slot); -+ else -+ return -ENOTSUPP; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); -+ -+/** -+ * snd_soc_dai_set_tristate - configure DAI system or master clock. -+ * @dai: DAI -+ * @tristate: tristate enable -+ * -+ * Tristates the DAI so that others can use it. -+ */ -+int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate) -+{ -+ if (dai->driver->ops->set_tristate) -+ return dai->driver->ops->set_tristate(dai, tristate); -+ else -+ return -EINVAL; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate); -+ -+/** -+ * snd_soc_dai_digital_mute - configure DAI system or master clock. -+ * @dai: DAI -+ * @mute: mute enable -+ * @direction: stream to mute -+ * -+ * Mutes the DAI DAC. -+ */ -+int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, -+ int direction) -+{ -+ if (dai->driver->ops->mute_stream) -+ return dai->driver->ops->mute_stream(dai, mute, direction); -+ else if (direction == SNDRV_PCM_STREAM_PLAYBACK && -+ dai->driver->ops->digital_mute) -+ return dai->driver->ops->digital_mute(dai, mute); -+ else -+ return -ENOTSUPP; -+} -+EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0035-FROMLIST-ASoC-meson-add-t9015-internal-DAC-driver.patch b/packages/linux/patches/amlogic/amlogic-0035-FROMLIST-ASoC-meson-add-t9015-internal-DAC-driver.patch new file mode 100644 index 0000000000..980beeed20 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0035-FROMLIST-ASoC-meson-add-t9015-internal-DAC-driver.patch @@ -0,0 +1,392 @@ +From d0a549baa248b9c97babc29a5f9475f62b32266c Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 14 Aug 2019 17:09:18 +0200 +Subject: [PATCH 035/146] FROMLIST: ASoC: meson: add t9015 internal DAC driver + +Add the codec driver of the internal DAC found on Amlogic gxl, g12a and +sm1 family. + +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/Kconfig | 8 + + sound/soc/meson/Makefile | 2 + + sound/soc/meson/t9015.c | 326 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 336 insertions(+) + create mode 100644 sound/soc/meson/t9015.c + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index 22d2af75b59e..897a706dcda0 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -6,6 +6,7 @@ config SND_MESON_AIU + tristate "Amlogic AIU" + select SND_MESON_CODEC_GLUE + select SND_PCM_IEC958 ++ imply SND_SOC_MESON_T9015 + imply SND_SOC_HDMI_CODEC if DRM_MESON_DW_HDMI + help + Select Y or M to add support for the Audio output subsystem found +@@ -116,4 +117,11 @@ config SND_MESON_G12A_TOHDMITX + help + Select Y or M to add support for HDMI audio on the g12a SoC + family ++ ++config SND_SOC_MESON_T9015 ++ tristate "Amlogic T9015 DAC" ++ select REGMAP_MMIO ++ help ++ Say Y or M if you want to add support for the internal DAC found ++ on GXL, G12 and SM1 SoC family. + endmenu +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index f9c90c391498..3c9d48846816 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -23,6 +23,7 @@ snd-soc-meson-card-utils-objs := meson-card-utils.o + snd-soc-meson-codec-glue-objs := meson-codec-glue.o + snd-soc-meson-gx-sound-card-objs := gx-card.o + snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o ++snd-soc-meson-t9015-objs := t9015.o + + obj-$(CONFIG_SND_MESON_AIU) += snd-soc-meson-aiu.o + obj-$(CONFIG_SND_MESON_AXG_FIFO) += snd-soc-meson-axg-fifo.o +@@ -40,3 +41,4 @@ obj-$(CONFIG_SND_MESON_CARD_UTILS) += snd-soc-meson-card-utils.o + obj-$(CONFIG_SND_MESON_CODEC_GLUE) += snd-soc-meson-codec-glue.o + obj-$(CONFIG_SND_MESON_GX_SOUND_CARD) += snd-soc-meson-gx-sound-card.o + obj-$(CONFIG_SND_MESON_G12A_TOHDMITX) += snd-soc-meson-g12a-tohdmitx.o ++obj-$(CONFIG_SND_SOC_MESON_T9015) += snd-soc-meson-t9015.o +diff --git a/sound/soc/meson/t9015.c b/sound/soc/meson/t9015.c +new file mode 100644 +index 000000000000..4f26708b6adc +--- /dev/null ++++ b/sound/soc/meson/t9015.c +@@ -0,0 +1,326 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BLOCK_EN 0x00 ++#define LORN_EN 0 ++#define LORP_EN 1 ++#define LOLN_EN 2 ++#define LOLP_EN 3 ++#define DACR_EN 4 ++#define DACL_EN 5 ++ ++#define DACR_INV 20 ++#define DACL_INV 21 ++#define DACR_SRC 22 ++#define DACL_SRC 23 ++#define REFP_BUF_EN BIT(12) ++#define BIAS_CURRENT_EN BIT(13) ++#define VMID_GEN_FAST BIT(14) ++#define VMID_GEN_EN BIT(15) ++#define I2S_MODE BIT(30) ++#define VOL_CTRL0 0x04 ++#define GAIN_H 31 ++#define GAIN_L 23 ++#define VOL_CTRL1 0x08 ++#define DAC_MONO 8 ++#define RAMP_RATE 10 ++#define VC_RAMP_MODE 12 ++#define MUTE_MODE 13 ++#define UNMUTE_MODE 14 ++#define DAC_SOFT_MUTE 15 ++#define DACR_VC 16 ++#define DACL_VC 24 ++#define LINEOUT_CFG 0x0c ++#define LORN_POL 0 ++#define LORP_POL 4 ++#define LOLN_POL 8 ++#define LOLP_POL 12 ++#define POWER_CFG 0x10 ++ ++struct t9015 { ++ struct clk *pclk; ++ struct regulator *avdd; ++}; ++ ++static int t9015_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) ++{ ++ struct snd_soc_component *component = dai->component; ++ unsigned int val; ++ ++ switch(fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBM_CFM: ++ val = I2S_MODE; ++ break; ++ ++ case SND_SOC_DAIFMT_CBS_CFS: ++ val = 0; ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ ++ snd_soc_component_update_bits(component, BLOCK_EN, I2S_MODE, val); ++ ++ if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_I2S) && ++ ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_LEFT_J)) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static const struct snd_soc_dai_ops t9015_dai_ops = { ++ .set_fmt = t9015_dai_set_fmt, ++}; ++ ++static struct snd_soc_dai_driver t9015_dai = { ++ .name = "t9015-hifi", ++ .playback = { ++ .stream_name = "Playback", ++ .channels_min = 1, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S8 | ++ SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_LE | ++ SNDRV_PCM_FMTBIT_S24_LE), ++ }, ++ .ops = &t9015_dai_ops, ++}; ++ ++static const DECLARE_TLV_DB_MINMAX_MUTE(dac_vol_tlv, -9525, 0); ++ ++static const char * const ramp_rate_txt[] = { "Fast", "Slow" }; ++static SOC_ENUM_SINGLE_DECL(ramp_rate_enum, VOL_CTRL1, RAMP_RATE, ++ ramp_rate_txt); ++ ++static const char * const dacr_in_txt[] = { "Right", "Left" }; ++static SOC_ENUM_SINGLE_DECL(dacr_in_enum, BLOCK_EN, DACR_SRC, dacr_in_txt); ++ ++static const char * const dacl_in_txt[] = { "Left", "Right" }; ++static SOC_ENUM_SINGLE_DECL(dacl_in_enum, BLOCK_EN, DACL_SRC, dacl_in_txt); ++ ++static const char * const mono_txt[] = { "Stereo", "Mono"}; ++static SOC_ENUM_SINGLE_DECL(mono_enum, VOL_CTRL1, DAC_MONO, mono_txt); ++ ++static const struct snd_kcontrol_new t9015_snd_controls[] = { ++ /* Volume Controls */ ++ SOC_SINGLE("Playback Mute", VOL_CTRL1, DAC_SOFT_MUTE, 1, 0), ++ SOC_DOUBLE_TLV("Playback Volume", VOL_CTRL1, DACL_VC, DACR_VC, ++ 0xff, 0, dac_vol_tlv), ++ ++ /* Ramp Controls */ ++ SOC_ENUM("Ramp Rate", ramp_rate_enum), ++ SOC_SINGLE("Volume Ramp Enable", VOL_CTRL1, VC_RAMP_MODE, 1, 0), ++ SOC_SINGLE("Mute Ramp Enable", VOL_CTRL1, MUTE_MODE, 1, 0), ++ SOC_SINGLE("Unmute Ramp Enable", VOL_CTRL1, UNMUTE_MODE, 1, 0), ++ ++ /* Channel Src */ ++ SOC_ENUM("Right DAC Source", dacr_in_enum), ++ SOC_ENUM("Left DAC Source", dacl_in_enum), ++ SOC_ENUM("Channel Mode", mono_enum), ++}; ++ ++static const struct snd_soc_dapm_widget t9015_dapm_widgets[] = { ++ SND_SOC_DAPM_DAC("Right DAC", NULL, BLOCK_EN, DACR_EN, 0), ++ SND_SOC_DAPM_DAC("Left DAC", NULL, BLOCK_EN, DACL_EN, 0), ++ SND_SOC_DAPM_OUT_DRV("Right- Driver", BLOCK_EN, LORN_EN, 0, ++ NULL, 0), ++ SND_SOC_DAPM_OUT_DRV("Right+ Driver", BLOCK_EN, LORP_EN, 0, ++ NULL, 0), ++ SND_SOC_DAPM_OUT_DRV("Left- Driver", BLOCK_EN, LOLN_EN, 0, ++ NULL, 0), ++ SND_SOC_DAPM_OUT_DRV("Left+ Driver", BLOCK_EN, LOLP_EN, 0, ++ NULL, 0), ++ SND_SOC_DAPM_OUTPUT("LORN"), ++ SND_SOC_DAPM_OUTPUT("LORP"), ++ SND_SOC_DAPM_OUTPUT("LOLN"), ++ SND_SOC_DAPM_OUTPUT("LOLP"), ++}; ++ ++static const struct snd_soc_dapm_route t9015_dapm_routes[] = { ++ { "Right DAC", NULL, "Playback" }, ++ { "Left DAC", NULL, "Playback" }, ++ { "Right- Driver", NULL, "Right DAC" }, ++ { "Right+ Driver", NULL, "Right DAC" }, ++ { "Left- Driver", NULL, "Left DAC" }, ++ { "Left+ Driver", NULL, "Left DAC" }, ++ { "LORN", NULL, "Right- Driver", }, ++ { "LORP", NULL, "Right+ Driver", }, ++ { "LOLN", NULL, "Left- Driver", }, ++ { "LOLP", NULL, "Left+ Driver", }, ++}; ++ ++static int t9015_set_bias_level(struct snd_soc_component *component, ++ enum snd_soc_bias_level level) ++{ ++ struct t9015 *priv = snd_soc_component_get_drvdata(component); ++ enum snd_soc_bias_level now = ++ snd_soc_component_get_bias_level(component); ++ int ret; ++ ++ switch (level) { ++ case SND_SOC_BIAS_ON: ++ snd_soc_component_update_bits(component, BLOCK_EN, ++ BIAS_CURRENT_EN, ++ BIAS_CURRENT_EN); ++ break; ++ case SND_SOC_BIAS_PREPARE: ++ snd_soc_component_update_bits(component, BLOCK_EN, ++ BIAS_CURRENT_EN, ++ 0); ++ break; ++ case SND_SOC_BIAS_STANDBY: ++ ret = regulator_enable(priv->avdd); ++ if (ret) { ++ dev_err(component->dev, "AVDD enable failed\n"); ++ return ret; ++ } ++ ++ if (now == SND_SOC_BIAS_OFF) { ++ snd_soc_component_update_bits(component, BLOCK_EN, ++ VMID_GEN_EN | VMID_GEN_FAST | REFP_BUF_EN, ++ VMID_GEN_EN | VMID_GEN_FAST | REFP_BUF_EN); ++ ++ mdelay(200); ++ snd_soc_component_update_bits(component, BLOCK_EN, ++ VMID_GEN_FAST, ++ 0); ++ } ++ ++ break; ++ case SND_SOC_BIAS_OFF: ++ snd_soc_component_update_bits(component, BLOCK_EN, ++ VMID_GEN_EN | VMID_GEN_FAST | REFP_BUF_EN, ++ 0); ++ ++ regulator_disable(priv->avdd); ++ break; ++ } ++ ++ return 0; ++} ++ ++static int t9015_component_probe(struct snd_soc_component *c) ++{ ++ /* FIXME */ ++ return snd_soc_component_write(c, LINEOUT_CFG, 0x00001111); ++} ++ ++static const struct snd_soc_component_driver t9015_codec_driver = { ++ .probe = t9015_component_probe, ++ .set_bias_level = t9015_set_bias_level, ++ .controls = t9015_snd_controls, ++ .num_controls = ARRAY_SIZE(t9015_snd_controls), ++ .dapm_widgets = t9015_dapm_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(t9015_dapm_widgets), ++ .dapm_routes = t9015_dapm_routes, ++ .num_dapm_routes = ARRAY_SIZE(t9015_dapm_routes), ++ .suspend_bias_off = 1, ++ .idle_bias_on = 1, ++ .endianness = 1, ++ .non_legacy_dai_naming = 1, ++}; ++ ++static const struct regmap_config t9015_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = POWER_CFG, ++}; ++ ++static int t9015_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct t9015 *priv; ++ void __iomem *regs; ++ struct regmap *regmap; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ platform_set_drvdata(pdev, priv); ++ ++ priv->pclk = devm_clk_get(dev, "pclk"); ++ if (IS_ERR(priv->pclk)) { ++ if (PTR_ERR(priv->pclk) != -EPROBE_DEFER) ++ dev_err(dev, "failed to get core clock\n"); ++ return PTR_ERR(priv->pclk); ++ } ++ ++ priv->avdd = devm_regulator_get(dev, "AVDD"); ++ if (IS_ERR(priv->avdd)) { ++ if (PTR_ERR(priv->avdd) != -EPROBE_DEFER) ++ dev_err(dev, "failed to AVDD\n"); ++ return PTR_ERR(priv->avdd); ++ } ++ ++ ret = clk_prepare_enable(priv->pclk); ++ if (ret) { ++ dev_err(dev, "core clock enable failed\n"); ++ return ret; ++ } ++ ++ ret = devm_add_action_or_reset(dev, ++ (void(*)(void *))clk_disable_unprepare, ++ priv->pclk); ++ if (ret) ++ return ret; ++ ++ ret = device_reset(dev); ++ if (ret) { ++ dev_err(dev, "reset failed\n"); ++ return ret; ++ } ++ ++ regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(regs)) { ++ dev_err(dev, "register map failed\n"); ++ return PTR_ERR(regs); ++ } ++ ++ regmap = devm_regmap_init_mmio(dev, regs, &t9015_regmap_config); ++ if (IS_ERR(regmap)) { ++ dev_err(dev, "regmap init failed\n"); ++ return PTR_ERR(regmap); ++ } ++ ++ /* Add polarity parsing here */ ++ ++ return devm_snd_soc_register_component(dev, &t9015_codec_driver, ++ &t9015_dai, 1); ++} ++ ++static const struct of_device_id t9015_ids[] = { ++ { .compatible = "amlogic,t9015", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, t9015_ids); ++ ++static struct platform_driver t9015_driver = { ++ .driver = { ++ .name = "t9015-codec", ++ .of_match_table = of_match_ptr(t9015_ids), ++ }, ++ .probe = t9015_probe, ++}; ++ ++module_platform_driver(t9015_driver); ++ ++MODULE_DESCRIPTION("ASoC Amlogic T9015 codec driver"); ++MODULE_AUTHOR("Jerome Brunet "); ++MODULE_LICENSE("GPL"); ++ ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0036-FROMGIT-ASoC-soc-dai-mv-soc_dai_hw_params-to-soc-dai.patch b/packages/linux/patches/amlogic/amlogic-0036-FROMGIT-ASoC-soc-dai-mv-soc_dai_hw_params-to-soc-dai.patch deleted file mode 100644 index 5fa9e5da2e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0036-FROMGIT-ASoC-soc-dai-mv-soc_dai_hw_params-to-soc-dai.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 31099c95ddae55746b2bae97c4853c215818f2bb Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:04 +0900 -Subject: [PATCH 036/187] FROMGIT: ASoC: soc-dai: mv soc_dai_hw_params() to - soc-dai - -Sometimes ALSA SoC naming is very random. -Current soc_dai_hw_params() should use snd_soc_dai_xxx() style. -And then, 1st parameter should be dai. Otherwise it is confusable. - - soc_dai_hw_params(..., dai); - + snd_soc_dai_hw_params(dai, ...); - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87zhl6hn5b.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit aa6166c2ac28392d64f2d8b3acfb56c8fe657147 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 4 ++++ - include/sound/soc.h | 4 ---- - sound/soc/soc-dai.c | 30 ++++++++++++++++++++++++++++++ - sound/soc/soc-dapm.c | 4 ++-- - sound/soc/soc-pcm.c | 35 +++-------------------------------- - 5 files changed, 39 insertions(+), 38 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index f5d70041108f..3773262a1b77 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -145,6 +145,10 @@ int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, - - int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); - -+int snd_soc_dai_hw_params(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params); -+ - struct snd_soc_dai_ops { - /* - * DAI clocking configuration, all optional. -diff --git a/include/sound/soc.h b/include/sound/soc.h -index 4e8071269639..d770606732cd 100644 ---- a/include/sound/soc.h -+++ b/include/sound/soc.h -@@ -505,10 +505,6 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); - int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, - const struct snd_pcm_hardware *hw); - --int soc_dai_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params, -- struct snd_soc_dai *dai); -- - /* Jack reporting */ - int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type, - struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins, -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index a1009ead40de..f883d27d136f 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -252,3 +252,33 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, - return -ENOTSUPP; - } - EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); -+ -+int snd_soc_dai_hw_params(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ int ret; -+ -+ /* perform any topology hw_params fixups before DAI */ -+ if (rtd->dai_link->be_hw_params_fixup) { -+ ret = rtd->dai_link->be_hw_params_fixup(rtd, params); -+ if (ret < 0) { -+ dev_err(rtd->dev, -+ "ASoC: hw_params topology fixup failed %d\n", -+ ret); -+ return ret; -+ } -+ } -+ -+ if (dai->driver->ops->hw_params) { -+ ret = dai->driver->ops->hw_params(substream, params, dai); -+ if (ret < 0) { -+ dev_err(dai->dev, "ASoC: can't set %s hw params: %d\n", -+ dai->name, ret); -+ return ret; -+ } -+ } -+ -+ return 0; -+} -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 2790c00735f3..e86a2d8d4f35 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3841,7 +3841,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - } - } - source->active++; -- ret = soc_dai_hw_params(&substream, params, source); -+ ret = snd_soc_dai_hw_params(source, &substream, params); - if (ret < 0) - goto out; - -@@ -3863,7 +3863,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - } - } - sink->active++; -- ret = soc_dai_hw_params(&substream, params, sink); -+ ret = snd_soc_dai_hw_params(sink, &substream, params); - if (ret < 0) - goto out; - -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 4878d22ebd8c..420cc94e0a46 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -877,36 +877,6 @@ static void soc_pcm_codec_params_fixup(struct snd_pcm_hw_params *params, - interval->max = channels; - } - --int soc_dai_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params, -- struct snd_soc_dai *dai) --{ -- struct snd_soc_pcm_runtime *rtd = substream->private_data; -- int ret; -- -- /* perform any topology hw_params fixups before DAI */ -- if (rtd->dai_link->be_hw_params_fixup) { -- ret = rtd->dai_link->be_hw_params_fixup(rtd, params); -- if (ret < 0) { -- dev_err(rtd->dev, -- "ASoC: hw_params topology fixup failed %d\n", -- ret); -- return ret; -- } -- } -- -- if (dai->driver->ops->hw_params) { -- ret = dai->driver->ops->hw_params(substream, params, dai); -- if (ret < 0) { -- dev_err(dai->dev, "ASoC: can't set %s hw params: %d\n", -- dai->name, ret); -- return ret; -- } -- } -- -- return 0; --} -- - static int soc_pcm_components_hw_free(struct snd_pcm_substream *substream, - struct snd_soc_component *last) - { -@@ -989,7 +959,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, - soc_pcm_codec_params_fixup(&codec_params, - codec_dai->rx_mask); - -- ret = soc_dai_hw_params(substream, &codec_params, codec_dai); -+ ret = snd_soc_dai_hw_params(codec_dai, substream, -+ &codec_params); - if(ret < 0) - goto codec_err; - -@@ -1001,7 +972,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, - snd_soc_dapm_update_dai(substream, &codec_params, codec_dai); - } - -- ret = soc_dai_hw_params(substream, params, cpu_dai); -+ ret = snd_soc_dai_hw_params(cpu_dai, substream, params); - if (ret < 0) - goto interface_err; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch b/packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch new file mode 100644 index 0000000000..3ed04be6c3 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch @@ -0,0 +1,107 @@ +From 0ea69450c57f01517fb17edcb744fc5100c13868 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 11:08:09 +0100 +Subject: [PATCH 036/146] WIP: ASoC: meson: convert axg tdm interface to schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,axg-tdm-iface.txt | 22 ------- + .../bindings/sound/amlogic,axg-tdm-iface.yaml | 57 +++++++++++++++++++ + 2 files changed, 57 insertions(+), 22 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt +deleted file mode 100644 +index cabfb26a5f22..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt ++++ /dev/null +@@ -1,22 +0,0 @@ +-* Amlogic Audio TDM Interfaces +- +-Required properties: +-- compatible: 'amlogic,axg-tdm-iface' +-- clocks: list of clock phandle, one for each entry clock-names. +-- clock-names: should contain the following: +- * "sclk" : bit clock. +- * "lrclk": sample clock +- * "mclk" : master clock +- -> optional if the interface is in clock slave mode. +-- #sound-dai-cells: must be 0. +- +-Example of TDM_A on the A113 SoC: +- +-tdmif_a: audio-controller@0 { +- compatible = "amlogic,axg-tdm-iface"; +- #sound-dai-cells = <0>; +- clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>, +- <&clkc_audio AUD_CLKID_MST_A_SCLK>, +- <&clkc_audio AUD_CLKID_MST_A_LRCLK>; +- clock-names = "mclk", "sclk", "lrclk"; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml +new file mode 100644 +index 000000000000..5f04f9cf30a0 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml +@@ -0,0 +1,57 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-tdm-iface.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic Audio TDM Interfaces ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller-.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ items: ++ - const: 'amlogic,axg-tdm-iface' ++ ++ clocks: ++ minItems: 2 ++ maxItems: 3 ++ items: ++ - description: Bit clock ++ - description: Sample clock ++ - description: Master clock #optional ++ ++ clock-names: ++ minItems: 2 ++ maxItems: 3 ++ items: ++ - const: sclk ++ - const: lrclk ++ - const: mclk ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - clocks ++ - clock-names ++ ++examples: ++ - | ++ #include ++ ++ tdmif_a: audio-controller-0 { ++ compatible = "amlogic,axg-tdm-iface"; ++ #sound-dai-cells = <0>; ++ clocks = <&clkc_audio AUD_CLKID_MST_A_SCLK>, ++ <&clkc_audio AUD_CLKID_MST_A_LRCLK>, ++ <&clkc_audio AUD_CLKID_MST_A_MCLK>; ++ clock-names = "sclk", "lrclk", "mclk"; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0037-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_hw_free.patch b/packages/linux/patches/amlogic/amlogic-0037-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_hw_free.patch deleted file mode 100644 index 618444bf8c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0037-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_hw_free.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0b897bd6ab6b787482da3fc67dab3e49c3034dff Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:19 +0900 -Subject: [PATCH 037/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_hw_free() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_hw_free() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87y30qhn4w.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 846faaed9df7899e74311db3aec0a41a2f6bc345 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 7 +++++++ - sound/soc/soc-dapm.c | 7 ++----- - sound/soc/soc-pcm.c | 12 ++++-------- - 4 files changed, 15 insertions(+), 13 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 3773262a1b77..5222b6a758f2 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -148,6 +148,8 @@ int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); - int snd_soc_dai_hw_params(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params); -+void snd_soc_dai_hw_free(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index f883d27d136f..39a685e6acd5 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -282,3 +282,10 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai, - - return 0; - } -+ -+void snd_soc_dai_hw_free(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream) -+{ -+ if (dai->driver->ops->hw_free) -+ dai->driver->ops->hw_free(substream, dai); -+} -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index e86a2d8d4f35..a9a717376767 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3900,9 +3900,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - snd_soc_dapm_widget_for_each_source_path(w, path) { - source = path->source->priv; - -- if (source->driver->ops->hw_free) -- source->driver->ops->hw_free(&substream, -- source); -+ snd_soc_dai_hw_free(source, &substream); - - source->active--; - if (source->driver->ops->shutdown) -@@ -3914,8 +3912,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - snd_soc_dapm_widget_for_each_sink_path(w, path) { - sink = path->sink->priv; - -- if (sink->driver->ops->hw_free) -- sink->driver->ops->hw_free(&substream, sink); -+ snd_soc_dai_hw_free(sink, &substream); - - sink->active--; - if (sink->driver->ops->shutdown) -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 420cc94e0a46..58fc4e98ab59 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -1011,8 +1011,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, - component_err: - soc_pcm_components_hw_free(substream, component); - -- if (cpu_dai->driver->ops->hw_free) -- cpu_dai->driver->ops->hw_free(substream, cpu_dai); -+ snd_soc_dai_hw_free(cpu_dai, substream); - cpu_dai->rate = 0; - - interface_err: -@@ -1023,8 +1022,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, - if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) - continue; - -- if (codec_dai->driver->ops->hw_free) -- codec_dai->driver->ops->hw_free(substream, codec_dai); -+ snd_soc_dai_hw_free(codec_dai, substream); - codec_dai->rate = 0; - } - -@@ -1083,12 +1081,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) - if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) - continue; - -- if (codec_dai->driver->ops->hw_free) -- codec_dai->driver->ops->hw_free(substream, codec_dai); -+ snd_soc_dai_hw_free(codec_dai, substream); - } - -- if (cpu_dai->driver->ops->hw_free) -- cpu_dai->driver->ops->hw_free(substream, cpu_dai); -+ snd_soc_dai_hw_free(cpu_dai, substream); - - mutex_unlock(&rtd->pcm_mutex); - return 0; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch b/packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch new file mode 100644 index 0000000000..75bd1a1d46 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch @@ -0,0 +1,166 @@ +From 8ad9165f35eda957aaeee673475909469945906a Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 12:00:01 +0100 +Subject: [PATCH 037/146] WIP: ASoC: meson: convert axg tdm formatters to + schema + +Signed-off-by: Jerome Brunet +--- + .../sound/amlogic,axg-tdm-formatters.txt | 36 ------- + .../sound/amlogic,axg-tdm-formatters.yaml | 101 ++++++++++++++++++ + 2 files changed, 101 insertions(+), 36 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt +deleted file mode 100644 +index 5996c0cd89c2..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt ++++ /dev/null +@@ -1,36 +0,0 @@ +-* Amlogic Audio TDM formatters +- +-Required properties: +-- compatible: 'amlogic,axg-tdmin' or +- 'amlogic,axg-tdmout' or +- 'amlogic,g12a-tdmin' or +- 'amlogic,g12a-tdmout' or +- 'amlogic,sm1-tdmin' or +- 'amlogic,sm1-tdmout +-- reg: physical base address of the controller and length of memory +- mapped region. +-- clocks: list of clock phandle, one for each entry clock-names. +-- clock-names: should contain the following: +- * "pclk" : peripheral clock. +- * "sclk" : bit clock. +- * "sclk_sel" : bit clock input multiplexer. +- * "lrclk" : sample clock +- * "lrclk_sel": sample clock input multiplexer +- +-Optional property: +-- resets: phandle to the dedicated reset line of the tdm formatter. +- +-Example of TDMOUT_A on the S905X2 SoC: +- +-tdmout_a: audio-controller@500 { +- compatible = "amlogic,axg-tdmout"; +- reg = <0x0 0x500 0x0 0x40>; +- resets = <&clkc_audio AUD_RESET_TDMOUT_A>; +- clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>, +- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>, +- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>, +- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>, +- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>; +- clock-names = "pclk", "sclk", "sclk_sel", +- "lrclk", "lrclk_sel"; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml +new file mode 100644 +index 000000000000..77b994df0c84 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml +@@ -0,0 +1,101 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-tdm-formatters.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic Audio AXG TDM formatters ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ oneOf: ++ - items: ++ - enum: ++ - amlogic,g12a-tdmout ++ - amlogic,sm1-tdmout ++ - const: ++ amlogic,axg-tdmout ++ - items: ++ - const: ++ amlogic,axg-tdmout ++ - items: ++ - enum: ++ - amlogic,g12a-tdmin ++ - amlogic,sm1-tdmin ++ - const: ++ amlogic,axg-tdmin ++ - items: ++ - const: ++ amlogic,axg-tdmin ++ ++ clocks: ++ items: ++ - description: Peripheral clock ++ - description: Bit clock ++ - description: Bit clock input multiplexer ++ - description: Sample clock ++ - description: Sample clock input multiplexer ++ ++ clock-names: ++ items: ++ - const: pclk ++ - const: sclk ++ - const: sclk_sel ++ - const: lrclk ++ - const: lrclk_sel ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - clocks ++ - clock-names ++ ++if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - amlogic,g12a-tdmin ++ - amlogic,sm1-tdmin ++ - amlogic,g12a-tdmout ++ - amlogic,sm1-tdmout ++then: ++ required: ++ - resets ++ ++examples: ++ - | ++ #include ++ #include ++ ++ tdmout_a: audio-controller@500 { ++ compatible = "amlogic,g12a-tdmout", ++ "amlogic,axg-tdmout"; ++ #sound-dai-cells = <0>; ++ reg = <0x0 0x500 0x0 0x40>; ++ resets = <&clkc_audio AUD_RESET_TDMOUT_A>; ++ clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>, ++ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>, ++ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>, ++ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>, ++ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>; ++ clock-names = "pclk", "sclk", "sclk_sel", ++ "lrclk", "lrclk_sel"; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0038-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_startup.patch b/packages/linux/patches/amlogic/amlogic-0038-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_startup.patch deleted file mode 100644 index d666b46c37..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0038-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_startup.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 802e00bb5509e6f632e191b43d6fca75d4633890 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:32 +0900 -Subject: [PATCH 038/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_startup() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_startup() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87wogahn4i.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 5a52a04531486e2ab069b7882432c8b266db36e6 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 11 +++++++++++ - sound/soc/soc-dapm.c | 28 ++++++++++------------------ - sound/soc/soc-pcm.c | 27 +++++++++++---------------- - 4 files changed, 34 insertions(+), 34 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 5222b6a758f2..0d16c5bb20bb 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -150,6 +150,8 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai, - struct snd_pcm_hw_params *params); - void snd_soc_dai_hw_free(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); -+int snd_soc_dai_startup(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 39a685e6acd5..6e196636e42f 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -289,3 +289,14 @@ void snd_soc_dai_hw_free(struct snd_soc_dai *dai, - if (dai->driver->ops->hw_free) - dai->driver->ops->hw_free(substream, dai); - } -+ -+int snd_soc_dai_startup(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream) -+{ -+ int ret = 0; -+ -+ if (dai->driver->ops->startup) -+ ret = dai->driver->ops->startup(substream, dai); -+ -+ return ret; -+} -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index a9a717376767..07fe331bce94 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3830,15 +3830,11 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - snd_soc_dapm_widget_for_each_source_path(w, path) { - source = path->source->priv; - -- if (source->driver->ops->startup) { -- ret = source->driver->ops->startup(&substream, -- source); -- if (ret < 0) { -- dev_err(source->dev, -- "ASoC: startup() failed: %d\n", -- ret); -- goto out; -- } -+ ret = snd_soc_dai_startup(source, &substream); -+ if (ret < 0) { -+ dev_err(source->dev, -+ "ASoC: startup() failed: %d\n", ret); -+ goto out; - } - source->active++; - ret = snd_soc_dai_hw_params(source, &substream, params); -@@ -3852,15 +3848,11 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - snd_soc_dapm_widget_for_each_sink_path(w, path) { - sink = path->sink->priv; - -- if (sink->driver->ops->startup) { -- ret = sink->driver->ops->startup(&substream, -- sink); -- if (ret < 0) { -- dev_err(sink->dev, -- "ASoC: startup() failed: %d\n", -- ret); -- goto out; -- } -+ ret = snd_soc_dai_startup(sink, &substream); -+ if (ret < 0) { -+ dev_err(sink->dev, -+ "ASoC: startup() failed: %d\n", ret); -+ goto out; - } - sink->active++; - ret = snd_soc_dai_hw_params(sink, &substream, params); -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 58fc4e98ab59..9c8713a3eef1 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -535,13 +535,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) - mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); - - /* startup the audio subsystem */ -- if (cpu_dai->driver->ops->startup) { -- ret = cpu_dai->driver->ops->startup(substream, cpu_dai); -- if (ret < 0) { -- dev_err(cpu_dai->dev, "ASoC: can't open interface" -- " %s: %d\n", cpu_dai->name, ret); -- goto out; -- } -+ ret = snd_soc_dai_startup(cpu_dai, substream); -+ if (ret < 0) { -+ dev_err(cpu_dai->dev, "ASoC: can't open interface %s: %d\n", -+ cpu_dai->name, ret); -+ goto out; - } - - ret = soc_pcm_components_open(substream, &component); -@@ -549,15 +547,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) - goto component_err; - - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->startup) { -- ret = codec_dai->driver->ops->startup(substream, -- codec_dai); -- if (ret < 0) { -- dev_err(codec_dai->dev, -- "ASoC: can't open codec %s: %d\n", -- codec_dai->name, ret); -- goto codec_dai_err; -- } -+ ret = snd_soc_dai_startup(codec_dai, substream); -+ if (ret < 0) { -+ dev_err(codec_dai->dev, -+ "ASoC: can't open codec %s: %d\n", -+ codec_dai->name, ret); -+ goto codec_dai_err; - } - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch b/packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch new file mode 100644 index 0000000000..66bb18892d --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch @@ -0,0 +1,136 @@ +From 5368de679f0a3a99ec1c41bb4d7a4d4b3b05021f Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 12:13:40 +0100 +Subject: [PATCH 038/146] WIP: ASoC: meson: convert axg pdm to schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,axg-pdm.txt | 29 ------- + .../bindings/sound/amlogic,axg-pdm.yaml | 79 +++++++++++++++++++ + 2 files changed, 79 insertions(+), 29 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt +deleted file mode 100644 +index 716878107a24..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt ++++ /dev/null +@@ -1,29 +0,0 @@ +-* Amlogic Audio PDM input +- +-Required properties: +-- compatible: 'amlogic,axg-pdm' or +- 'amlogic,g12a-pdm' or +- 'amlogic,sm1-pdm' +-- reg: physical base address of the controller and length of memory +- mapped region. +-- clocks: list of clock phandle, one for each entry clock-names. +-- clock-names: should contain the following: +- * "pclk" : peripheral clock. +- * "dclk" : pdm digital clock +- * "sysclk" : dsp system clock +-- #sound-dai-cells: must be 0. +- +-Optional property: +-- resets: phandle to the dedicated reset line of the pdm input. +- +-Example of PDM on the A113 SoC: +- +-pdm: audio-controller@ff632000 { +- compatible = "amlogic,axg-pdm"; +- reg = <0x0 0xff632000 0x0 0x34>; +- #sound-dai-cells = <0>; +- clocks = <&clkc_audio AUD_CLKID_PDM>, +- <&clkc_audio AUD_CLKID_PDM_DCLK>, +- <&clkc_audio AUD_CLKID_PDM_SYSCLK>; +- clock-names = "pclk", "dclk", "sysclk"; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml +new file mode 100644 +index 000000000000..aa90b77e593d +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml +@@ -0,0 +1,79 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-pdm.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic Audio AXG PDM input ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ oneOf: ++ - items: ++ - enum: ++ - amlogic,g12a-pdm ++ - amlogic,sm1-pdm ++ - const: ++ amlogic,axg-pdm ++ - items: ++ - const: ++ amlogic,axg-pdm ++ ++ clocks: ++ items: ++ - description: Peripheral clock ++ - description: PDM digital clock ++ - description: DSP system clock ++ ++ clock-names: ++ items: ++ - const: pclk ++ - const: dclk ++ - const: sysclk ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - clocks ++ - clock-names ++ ++if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - amlogic,g12a-pdm ++ - amlogic,sm1-pdm ++then: ++ required: ++ - resets ++ ++examples: ++ - | ++ #include ++ ++ pdm: audio-controller@ff632000 { ++ compatible = "amlogic,axg-pdm"; ++ reg = <0x0 0xff632000 0x0 0x34>; ++ #sound-dai-cells = <0>; ++ clocks = <&clkc_audio AUD_CLKID_PDM>, ++ <&clkc_audio AUD_CLKID_PDM_DCLK>, ++ <&clkc_audio AUD_CLKID_PDM_SYSCLK>; ++ clock-names = "pclk", "dclk", "sysclk"; ++ }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0039-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_shutdown.patch b/packages/linux/patches/amlogic/amlogic-0039-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_shutdown.patch deleted file mode 100644 index c3c2e1dbc6..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0039-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_shutdown.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 6a25933b0671bb527f87675fcc77e5606b010626 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:39 +0900 -Subject: [PATCH 039/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_shutdown() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_shutdown() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87v9vuhn4b.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 330fcb5135e0588b1ea3b0bbab587d1317c1cf7b - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 7 +++++++ - sound/soc/soc-dapm.c | 7 ++----- - sound/soc/soc-pcm.c | 18 ++++++------------ - 4 files changed, 17 insertions(+), 17 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 0d16c5bb20bb..32545d457b3d 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -152,6 +152,8 @@ void snd_soc_dai_hw_free(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); - int snd_soc_dai_startup(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); -+void snd_soc_dai_shutdown(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 6e196636e42f..67ff6cc1fe02 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -300,3 +300,10 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, - - return ret; - } -+ -+void snd_soc_dai_shutdown(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream) -+{ -+ if (dai->driver->ops->shutdown) -+ dai->driver->ops->shutdown(substream, dai); -+} -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 07fe331bce94..bf0481df870d 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3895,9 +3895,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - snd_soc_dai_hw_free(source, &substream); - - source->active--; -- if (source->driver->ops->shutdown) -- source->driver->ops->shutdown(&substream, -- source); -+ snd_soc_dai_shutdown(source, &substream); - } - - substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -@@ -3907,8 +3905,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - snd_soc_dai_hw_free(sink, &substream); - - sink->active--; -- if (sink->driver->ops->shutdown) -- sink->driver->ops->shutdown(&substream, sink); -+ snd_soc_dai_shutdown(sink, &substream); - } - break; - -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 9c8713a3eef1..ed5ae23c7104 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -641,16 +641,13 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) - i = rtd->num_codecs; - - codec_dai_err: -- for_each_rtd_codec_dai_rollback(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->shutdown) -- codec_dai->driver->ops->shutdown(substream, codec_dai); -- } -+ for_each_rtd_codec_dai_rollback(rtd, i, codec_dai) -+ snd_soc_dai_shutdown(codec_dai, substream); - - component_err: - soc_pcm_components_close(substream, component); - -- if (cpu_dai->driver->ops->shutdown) -- cpu_dai->driver->ops->shutdown(substream, cpu_dai); -+ snd_soc_dai_shutdown(cpu_dai, substream); - out: - mutex_unlock(&rtd->pcm_mutex); - -@@ -728,13 +725,10 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) - - snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream); - -- if (cpu_dai->driver->ops->shutdown) -- cpu_dai->driver->ops->shutdown(substream, cpu_dai); -+ snd_soc_dai_shutdown(cpu_dai, substream); - -- for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->shutdown) -- codec_dai->driver->ops->shutdown(substream, codec_dai); -- } -+ for_each_rtd_codec_dai(rtd, i, codec_dai) -+ snd_soc_dai_shutdown(codec_dai, substream); - - if (rtd->dai_link->ops->shutdown) - rtd->dai_link->ops->shutdown(substream); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch b/packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch new file mode 100644 index 0000000000..e944bf41bc --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch @@ -0,0 +1,173 @@ +From 0de05051f486a48f7c1a98c9d78ef4d9e4d0fc21 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 15:40:25 +0100 +Subject: [PATCH 039/146] WIP: ASoC: meson: convert axg fifo to schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,axg-fifo.txt | 34 ------ + .../bindings/sound/amlogic,axg-fifo.yaml | 111 ++++++++++++++++++ + 2 files changed, 111 insertions(+), 34 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt +deleted file mode 100644 +index fa4545ed81ca..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt ++++ /dev/null +@@ -1,34 +0,0 @@ +-* Amlogic Audio FIFO controllers +- +-Required properties: +-- compatible: 'amlogic,axg-toddr' or +- 'amlogic,axg-toddr' or +- 'amlogic,g12a-frddr' or +- 'amlogic,g12a-toddr' or +- 'amlogic,sm1-frddr' or +- 'amlogic,sm1-toddr' +-- reg: physical base address of the controller and length of memory +- mapped region. +-- interrupts: interrupt specifier for the fifo. +-- clocks: phandle to the fifo peripheral clock provided by the audio +- clock controller. +-- resets: list of reset phandle, one for each entry reset-names. +-- reset-names: should contain the following: +- * "arb" : memory ARB line (required) +- * "rst" : dedicated device reset line (optional) +-- #sound-dai-cells: must be 0. +-- amlogic,fifo-depth: The size of the controller's fifo in bytes. This +- is useful for determining certain configuration such +- as the flush threshold of the fifo +- +-Example of FRDDR A on the A113 SoC: +- +-frddr_a: audio-controller@1c0 { +- compatible = "amlogic,axg-frddr"; +- reg = <0x0 0x1c0 0x0 0x1c>; +- #sound-dai-cells = <0>; +- interrupts = ; +- clocks = <&clkc_audio AUD_CLKID_FRDDR_A>; +- resets = <&arb AXG_ARB_FRDDR_A>; +- fifo-depth = <512>; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml +new file mode 100644 +index 000000000000..d9fe4f624784 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml +@@ -0,0 +1,111 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-fifo.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic AXG Audio FIFO controllers ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ oneOf: ++ - items: ++ - const: ++ amlogic,axg-toddr ++ - items: ++ - const: ++ amlogic,axg-frddr ++ - items: ++ - enum: ++ - amlogic,g12a-toddr ++ - amlogic,sm1-toddr ++ - const: ++ amlogic,axg-toddr ++ - items: ++ - enum: ++ - amlogic,g12a-frddr ++ - amlogic,sm1-frddr ++ - const: ++ amlogic,axg-frddr ++ ++ clocks: ++ items: ++ - description: Peripheral clock ++ ++ interrupts: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ minItems: 1 ++ items: ++ - description: Memory ARB line ++ - description: Dedicated device reset line ++ ++ reset-names: ++ minItems: 1 ++ items: ++ - const: arb ++ - const: rst ++ ++ amlogic,fifo-depth: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: Size of the controller's fifo in bytes ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - interrupts ++ - reg ++ - clocks ++ - resets ++ - amlogic,fifo-depth ++ ++if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - amlogic,g12a-toddr ++ - amlogic,sm1-toddr ++ - amlogic,g12a-frddr ++ - amlogic,sm1-frddr ++then: ++ properties: ++ resets: ++ minItems: 2 ++ reset-names: ++ minItems: 2 ++ required: ++ - reset-names ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ frddr_a: audio-controller@1c0 { ++ compatible = "amlogic,g12a-frddr", "amlogic,axg-frddr"; ++ reg = <0x0 0x1c0 0x0 0x1c>; ++ #sound-dai-cells = <0>; ++ interrupts = ; ++ clocks = <&clkc_audio AUD_CLKID_FRDDR_A>; ++ resets = <&arb AXG_ARB_FRDDR_A>, <&clkc_audio AUD_RESET_FRDDR_A>; ++ reset-names = "arb", "rst"; ++ amlogic,fifo-depth = <512>; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0040-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_prepare.patch b/packages/linux/patches/amlogic/amlogic-0040-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_prepare.patch deleted file mode 100644 index c3cf1ae11d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0040-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_prepare.patch +++ /dev/null @@ -1,99 +0,0 @@ -From b01d6fd0df6236709ab10b327393f6c1724584e1 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:45 +0900 -Subject: [PATCH 040/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_prepare() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_prepare() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87tvbehn46.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 4beb8e109d30d339d44308a767dd6f5614492f3e - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 11 +++++++++++ - sound/soc/soc-pcm.c | 27 +++++++++++---------------- - 3 files changed, 24 insertions(+), 16 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 32545d457b3d..c7dff6a0b5b9 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -154,6 +154,8 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); - void snd_soc_dai_shutdown(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); -+int snd_soc_dai_prepare(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 67ff6cc1fe02..cb810888c563 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -307,3 +307,14 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai, - if (dai->driver->ops->shutdown) - dai->driver->ops->shutdown(substream, dai); - } -+ -+int snd_soc_dai_prepare(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream) -+{ -+ int ret = 0; -+ -+ if (dai->driver->ops->prepare) -+ ret = dai->driver->ops->prepare(substream, dai); -+ -+ return ret; -+} -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index ed5ae23c7104..d7611af90dce 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -814,27 +814,22 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) - } - - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->prepare) { -- ret = codec_dai->driver->ops->prepare(substream, -- codec_dai); -- if (ret < 0) { -- dev_err(codec_dai->dev, -- "ASoC: codec DAI prepare error: %d\n", -- ret); -- goto out; -- } -- } -- } -- -- if (cpu_dai->driver->ops->prepare) { -- ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); -+ ret = snd_soc_dai_prepare(codec_dai, substream); - if (ret < 0) { -- dev_err(cpu_dai->dev, -- "ASoC: cpu DAI prepare error: %d\n", ret); -+ dev_err(codec_dai->dev, -+ "ASoC: codec DAI prepare error: %d\n", -+ ret); - goto out; - } - } - -+ ret = snd_soc_dai_prepare(cpu_dai, substream); -+ if (ret < 0) { -+ dev_err(cpu_dai->dev, -+ "ASoC: cpu DAI prepare error: %d\n", ret); -+ goto out; -+ } -+ - /* cancel any delayed stream shutdown that is pending */ - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && - rtd->pop_wait) { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch b/packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch new file mode 100644 index 0000000000..2c31c5fdeb --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch @@ -0,0 +1,139 @@ +From 9542ee0e99f6c34fc0c455502653602343f45880 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 15:52:03 +0100 +Subject: [PATCH 040/146] WIP: ASoC: meson: convert axg spdif input to schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,axg-spdifin.txt | 27 ------ + .../bindings/sound/amlogic,axg-spdifin.yaml | 84 +++++++++++++++++++ + 2 files changed, 84 insertions(+), 27 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt +deleted file mode 100644 +index df92a4ecf288..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt ++++ /dev/null +@@ -1,27 +0,0 @@ +-* Amlogic Audio SPDIF Input +- +-Required properties: +-- compatible: 'amlogic,axg-spdifin' or +- 'amlogic,g12a-spdifin' or +- 'amlogic,sm1-spdifin' +-- interrupts: interrupt specifier for the spdif input. +-- clocks: list of clock phandle, one for each entry clock-names. +-- clock-names: should contain the following: +- * "pclk" : peripheral clock. +- * "refclk" : spdif input reference clock +-- #sound-dai-cells: must be 0. +- +-Optional property: +-- resets: phandle to the dedicated reset line of the spdif input. +- +-Example on the A113 SoC: +- +-spdifin: audio-controller@400 { +- compatible = "amlogic,axg-spdifin"; +- reg = <0x0 0x400 0x0 0x30>; +- #sound-dai-cells = <0>; +- interrupts = ; +- clocks = <&clkc_audio AUD_CLKID_SPDIFIN>, +- <&clkc_audio AUD_CLKID_SPDIFIN_CLK>; +- clock-names = "pclk", "refclk"; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml +new file mode 100644 +index 000000000000..b9b0863c5723 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml +@@ -0,0 +1,84 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-spdifin.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic Audio AXG SPDIF Input ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ oneOf: ++ - items: ++ - const: ++ amlogic,axg-spdifin ++ - items: ++ - enum: ++ - amlogic,g12a-spdifin ++ - amlogic,sm1-spdifin ++ - const: ++ amlogic,axg-spdifin ++ ++ clocks: ++ items: ++ - description: Peripheral clock ++ - description: SPDIF input reference clock ++ ++ clock-names: ++ items: ++ - const: pclk ++ - const: refclk ++ ++ interrupts: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - interrupts ++ - clocks ++ - clock-names ++ ++if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - amlogic,g12a-spdifin ++ - amlogic,sm1-spdifin ++then: ++ required: ++ - resets ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ ++ spdifin: audio-controller@400 { ++ compatible = "amlogic,axg-spdifin"; ++ reg = <0x0 0x400 0x0 0x30>; ++ #sound-dai-cells = <0>; ++ interrupts = ; ++ clocks = <&clkc_audio AUD_CLKID_SPDIFIN>, ++ <&clkc_audio AUD_CLKID_SPDIFIN_CLK>; ++ clock-names = "pclk", "refclk"; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0041-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_trigger.patch b/packages/linux/patches/amlogic/amlogic-0041-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_trigger.patch deleted file mode 100644 index 907aa883ab..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0041-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_trigger.patch +++ /dev/null @@ -1,92 +0,0 @@ -From b482fd77bd3cdd5fb8d3056f0c5363344c1703ec Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:51 +0900 -Subject: [PATCH 041/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_trigger() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_trigger() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87sgqyhn40.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 95aef35533844f35544851b0cdc1fc154b603307 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 12 ++++++++++++ - sound/soc/soc-pcm.c | 17 ++++++----------- - 3 files changed, 20 insertions(+), 11 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index c7dff6a0b5b9..72b8e76f1cc4 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -156,6 +156,8 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); - int snd_soc_dai_prepare(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); -+int snd_soc_dai_trigger(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream, int cmd); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index cb810888c563..18c447e169f6 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -318,3 +318,15 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai, - - return ret; - } -+ -+int snd_soc_dai_trigger(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream, -+ int cmd) -+{ -+ int ret = 0; -+ -+ if (dai->driver->ops->trigger) -+ ret = dai->driver->ops->trigger(substream, cmd, dai); -+ -+ return ret; -+} -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index d7611af90dce..a628b08f966e 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -1084,12 +1084,9 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) - int i, ret; - - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->trigger) { -- ret = codec_dai->driver->ops->trigger(substream, -- cmd, codec_dai); -- if (ret < 0) -- return ret; -- } -+ ret = snd_soc_dai_trigger(codec_dai, substream, cmd); -+ if (ret < 0) -+ return ret; - } - - for_each_rtdcom(rtd, rtdcom) { -@@ -1104,11 +1101,9 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) - return ret; - } - -- if (cpu_dai->driver->ops->trigger) { -- ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai); -- if (ret < 0) -- return ret; -- } -+ snd_soc_dai_trigger(cpu_dai, substream, cmd); -+ if (ret < 0) -+ return ret; - - if (rtd->dai_link->ops->trigger) { - ret = rtd->dai_link->ops->trigger(substream, cmd); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch b/packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch new file mode 100644 index 0000000000..fea1cd7cd0 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch @@ -0,0 +1,130 @@ +From 5692af2959d8c9571500c1f8da856ed6c75f8ffe Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 15:58:18 +0100 +Subject: [PATCH 041/146] WIP: ASoC: meson: convert axg spdif output to schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,axg-spdifout.txt | 25 ------ + .../bindings/sound/amlogic,axg-spdifout.yaml | 77 +++++++++++++++++++ + 2 files changed, 77 insertions(+), 25 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt +deleted file mode 100644 +index 28381dd1f633..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt ++++ /dev/null +@@ -1,25 +0,0 @@ +-* Amlogic Audio SPDIF Output +- +-Required properties: +-- compatible: 'amlogic,axg-spdifout' or +- 'amlogic,g12a-spdifout' or +- 'amlogic,sm1-spdifout' +-- clocks: list of clock phandle, one for each entry clock-names. +-- clock-names: should contain the following: +- * "pclk" : peripheral clock. +- * "mclk" : master clock +-- #sound-dai-cells: must be 0. +- +-Optional property: +-- resets: phandle to the dedicated reset line of the spdif output. +- +-Example on the A113 SoC: +- +-spdifout: audio-controller@480 { +- compatible = "amlogic,axg-spdifout"; +- reg = <0x0 0x480 0x0 0x50>; +- #sound-dai-cells = <0>; +- clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>, +- <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>; +- clock-names = "pclk", "mclk"; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml +new file mode 100644 +index 000000000000..9ac52916f88b +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml +@@ -0,0 +1,77 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-spdifout.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic Audio AXG SPDIF Output ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ compatible: ++ oneOf: ++ - items: ++ - const: ++ amlogic,axg-spdifout ++ - items: ++ - enum: ++ - amlogic,g12a-spdifout ++ - amlogic,sm1-spdifout ++ - const: ++ amlogic,axg-spdifout ++ ++ clocks: ++ items: ++ - description: Peripheral clock ++ - description: SPDIF output master clock ++ ++ clock-names: ++ items: ++ - const: pclk ++ - const: mclk ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ items: ++ - description: dedicated device reset line ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - clocks ++ - clock-names ++ ++if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - amlogic,g12a-spdifout ++ - amlogic,sm1-spdifout ++then: ++ required: ++ - resets ++ ++examples: ++ - | ++ #include ++ ++ spdifout: audio-controller@480 { ++ compatible = "amlogic,axg-spdifout"; ++ reg = <0x0 0x480 0x0 0x50>; ++ #sound-dai-cells = <0>; ++ clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>, ++ <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>; ++ clock-names = "pclk", "mclk"; ++ }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0042-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_bespoke_trigger.patch b/packages/linux/patches/amlogic/amlogic-0042-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_bespoke_trigger.patch deleted file mode 100644 index 5019aefcd2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0042-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_bespoke_trigger.patch +++ /dev/null @@ -1,88 +0,0 @@ -From c2e057a8973e801a7cf4cb3a5999376927e651fb Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:33:56 +0900 -Subject: [PATCH 042/187] FROMGIT: ASoC: soc-dai: add - snd_soc_dai_bespoke_trigger() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_bespoke_trigger() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87r26ihn3u.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 5c0769af4caf8fbdad2e9c0051ab0081b8e22b0a - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 12 ++++++++++++ - sound/soc/soc-pcm.c | 16 ++++++---------- - 3 files changed, 20 insertions(+), 10 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 72b8e76f1cc4..6a5566d459ad 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -158,6 +158,8 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); - int snd_soc_dai_trigger(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, int cmd); -+int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream, int cmd); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 18c447e169f6..6f466cfcbeef 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -330,3 +330,15 @@ int snd_soc_dai_trigger(struct snd_soc_dai *dai, - - return ret; - } -+ -+int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream, -+ int cmd) -+{ -+ int ret = 0; -+ -+ if (dai->driver->ops->bespoke_trigger) -+ ret = dai->driver->ops->bespoke_trigger(substream, cmd, dai); -+ -+ return ret; -+} -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index a628b08f966e..a10627f1ceff 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -1123,19 +1123,15 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, - int i, ret; - - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->bespoke_trigger) { -- ret = codec_dai->driver->ops->bespoke_trigger(substream, -- cmd, codec_dai); -- if (ret < 0) -- return ret; -- } -- } -- -- if (cpu_dai->driver->ops->bespoke_trigger) { -- ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai); -+ ret = snd_soc_dai_bespoke_trigger(codec_dai, substream, cmd); - if (ret < 0) - return ret; - } -+ -+ snd_soc_dai_bespoke_trigger(cpu_dai, substream, cmd); -+ if (ret < 0) -+ return ret; -+ - return 0; - } - /* --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch b/packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch new file mode 100644 index 0000000000..f01b79c63c --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch @@ -0,0 +1,140 @@ +From bd5ce2ad81a130c1e57c191efaa4c1b0d14c8351 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 16:02:43 +0100 +Subject: [PATCH 042/146] WIP: ASoC: meson: convert g12a tohdmitx control to + schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,g12a-tohdmitx.txt | 58 ------------------- + .../bindings/sound/amlogic,g12a-tohdmitx.yaml | 53 +++++++++++++++++ + 2 files changed, 53 insertions(+), 58 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.txt b/Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.txt +deleted file mode 100644 +index 4e8cd7eb7cec..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.txt ++++ /dev/null +@@ -1,58 +0,0 @@ +-* Amlogic HDMI Tx control glue +- +-Required properties: +-- compatible: "amlogic,g12a-tohdmitx" or +- "amlogic,sm1-tohdmitx" +-- reg: physical base address of the controller and length of memory +- mapped region. +-- #sound-dai-cells: should be 1. +-- resets: phandle to the dedicated reset line of the hdmitx glue. +- +-Example on the S905X2 SoC: +- +-tohdmitx: audio-controller@744 { +- compatible = "amlogic,g12a-tohdmitx"; +- reg = <0x0 0x744 0x0 0x4>; +- #sound-dai-cells = <1>; +- resets = <&clkc_audio AUD_RESET_TOHDMITX>; +-}; +- +-Example of an 'amlogic,axg-sound-card': +- +-sound { +- compatible = "amlogic,axg-sound-card"; +- +-[...] +- +- dai-link-x { +- sound-dai = <&tdmif_a>; +- dai-format = "i2s"; +- dai-tdm-slot-tx-mask-0 = <1 1>; +- +- codec-0 { +- sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>; +- }; +- +- codec-1 { +- sound-dai = <&external_dac>; +- }; +- }; +- +- dai-link-y { +- sound-dai = <&tdmif_c>; +- dai-format = "i2s"; +- dai-tdm-slot-tx-mask-0 = <1 1>; +- +- codec { +- sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>; +- }; +- }; +- +- dai-link-z { +- sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; +- +- codec { +- sound-dai = <&hdmi_tx>; +- }; +- }; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.yaml b/Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.yaml +new file mode 100644 +index 000000000000..fdd64d103f33 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,g12a-tohdmitx.yaml +@@ -0,0 +1,53 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,g12a-tohdmitx.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic G12a HDMI Tx Control Glue ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 1 ++ ++ compatible: ++ oneOf: ++ - items: ++ - const: ++ amlogic,g12a-tohdmitx ++ - items: ++ - enum: ++ - amlogic,sm1-tohdmitx ++ - const: ++ amlogic,g12a-tohdmitx ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - resets ++ ++examples: ++ - | ++ #include ++ ++ tohdmitx: audio-controller@744 { ++ compatible = "amlogic,g12a-tohdmitx"; ++ reg = <0x0 0x744 0x0 0x4>; ++ #sound-dai-cells = <1>; ++ resets = <&clkc_audio AUD_RESET_TOHDMITX>; ++ }; ++ ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0043-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_delay.patch b/packages/linux/patches/amlogic/amlogic-0043-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_delay.patch deleted file mode 100644 index 1aed05e8df..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0043-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_delay.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 32507410f948dfd2e37689912ce57a4ffc396fa0 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:34:09 +0900 -Subject: [PATCH 043/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_delay() - -Current ALSA SoC is directly using dai->driver->ops->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_delay() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87o91mhn3i.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 1dea80d4b2bd3b53c58f008ca2bcd73182583711 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-dai.c | 11 +++++++++++ - sound/soc/soc-pcm.c | 9 +++------ - 3 files changed, 16 insertions(+), 6 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 6a5566d459ad..7cfed3034511 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -160,6 +160,8 @@ int snd_soc_dai_trigger(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, int cmd); - int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, int cmd); -+snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 6f466cfcbeef..5b5b979cd1f3 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -342,3 +342,14 @@ int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, - - return ret; - } -+ -+snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, -+ struct snd_pcm_substream *substream) -+{ -+ int delay = 0; -+ -+ if (dai->driver->ops->delay) -+ delay = dai->driver->ops->delay(substream, dai); -+ -+ return delay; -+} -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index a10627f1ceff..f3137723301c 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -1169,14 +1169,11 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) - /* base delay if assigned in pointer callback */ - delay = runtime->delay; - -- if (cpu_dai->driver->ops->delay) -- delay += cpu_dai->driver->ops->delay(substream, cpu_dai); -+ delay += snd_soc_dai_delay(cpu_dai, substream); - - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->ops->delay) -- codec_delay = max(codec_delay, -- codec_dai->driver->ops->delay(substream, -- codec_dai)); -+ codec_delay = max(codec_delay, -+ snd_soc_dai_delay(codec_dai, substream)); - } - delay += codec_delay; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch b/packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch new file mode 100644 index 0000000000..fa0a4cf4e6 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch @@ -0,0 +1,334 @@ +From 5c25f36c7a292ca0ec9f5415ae938b111c878ae5 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Fri, 24 Jan 2020 18:23:36 +0100 +Subject: [PATCH 043/146] WIP: ASoC: meson: convert axg sound card control to + schema + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,axg-sound-card.txt | 124 ------------ + .../sound/amlogic,axg-sound-card.yaml | 181 ++++++++++++++++++ + 2 files changed, 181 insertions(+), 124 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt +deleted file mode 100644 +index 80b411296480..000000000000 +--- a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt ++++ /dev/null +@@ -1,124 +0,0 @@ +-Amlogic AXG sound card: +- +-Required properties: +- +-- compatible: "amlogic,axg-sound-card" +-- model : User specified audio sound card name, one string +- +-Optional properties: +- +-- audio-aux-devs : List of phandles pointing to auxiliary devices +-- audio-widgets : Please refer to widgets.txt. +-- audio-routing : A list of the connections between audio components. +- +-Subnodes: +- +-- dai-link: Container for dai-link level properties and the CODEC +- sub-nodes. There should be at least one (and probably more) +- subnode of this type. +- +-Required dai-link properties: +- +-- sound-dai: phandle and port of the CPU DAI. +- +-Required TDM Backend dai-link properties: +-- dai-format : CPU/CODEC common audio format +- +-Optional TDM Backend dai-link properties: +-- dai-tdm-slot-rx-mask-{0,1,2,3}: Receive direction slot masks +-- dai-tdm-slot-tx-mask-{0,1,2,3}: Transmit direction slot masks +- When omitted, mask is assumed to have to no +- slots. A valid must have at one slot, so at +- least one these mask should be provided with +- an enabled slot. +-- dai-tdm-slot-num : Please refer to tdm-slot.txt. +- If omitted, slot number is set to accommodate the largest +- mask provided. +-- dai-tdm-slot-width : Please refer to tdm-slot.txt. default to 32 if omitted. +-- mclk-fs : Multiplication factor between stream rate and mclk +- +-Backend dai-link subnodes: +- +-- codec: dai-link representing backend links should have at least one subnode. +- One subnode for each codec of the dai-link. +- dai-link representing frontend links have no codec, therefore have no +- subnodes +- +-Required codec subnodes properties: +- +-- sound-dai: phandle and port of the CODEC DAI. +- +-Optional codec subnodes properties: +- +-- dai-tdm-slot-tx-mask : Please refer to tdm-slot.txt. +-- dai-tdm-slot-rx-mask : Please refer to tdm-slot.txt. +- +-Example: +- +-sound { +- compatible = "amlogic,axg-sound-card"; +- model = "AXG-S420"; +- audio-aux-devs = <&tdmin_a>, <&tdmout_c>; +- audio-widgets = "Line", "Lineout", +- "Line", "Linein", +- "Speaker", "Speaker1 Left", +- "Speaker", "Speaker1 Right"; +- "Speaker", "Speaker2 Left", +- "Speaker", "Speaker2 Right"; +- audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2", +- "SPDIFOUT IN 0", "FRDDR_A OUT 3", +- "TDM_C Playback", "TDMOUT_C OUT", +- "TDMIN_A IN 2", "TDM_C Capture", +- "TDMIN_A IN 5", "TDM_C Loopback", +- "TODDR_A IN 0", "TDMIN_A OUT", +- "Lineout", "Lineout AOUTL", +- "Lineout", "Lineout AOUTR", +- "Speaker1 Left", "SPK1 OUT_A", +- "Speaker2 Left", "SPK2 OUT_A", +- "Speaker1 Right", "SPK1 OUT_B", +- "Speaker2 Right", "SPK2 OUT_B", +- "Linein AINL", "Linein", +- "Linein AINR", "Linein"; +- +- dai-link@0 { +- sound-dai = <&frddr_a>; +- }; +- +- dai-link@1 { +- sound-dai = <&toddr_a>; +- }; +- +- dai-link@2 { +- sound-dai = <&tdmif_c>; +- dai-format = "i2s"; +- dai-tdm-slot-tx-mask-2 = <1 1>; +- dai-tdm-slot-tx-mask-3 = <1 1>; +- dai-tdm-slot-rx-mask-1 = <1 1>; +- mclk-fs = <256>; +- +- codec@0 { +- sound-dai = <&lineout>; +- }; +- +- codec@1 { +- sound-dai = <&speaker_amp1>; +- }; +- +- codec@2 { +- sound-dai = <&speaker_amp2>; +- }; +- +- codec@3 { +- sound-dai = <&linein>; +- }; +- +- }; +- +- dai-link@3 { +- sound-dai = <&spdifout>; +- +- codec { +- sound-dai = <&spdif_dit>; +- }; +- }; +-}; +diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml +new file mode 100644 +index 000000000000..168d84b2dcb7 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml +@@ -0,0 +1,181 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,axg-sound-card.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic AXG sound card ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ compatible: ++ items: ++ - const: amlogic,axg-sound-card ++ ++ audio-aux-devs: ++ $ref: /schemas/types.yaml#/definitions/phandle-array ++ description: list of auxiliary devices ++ ++ audio-routing: ++ $ref: /schemas/types.yaml#/definitions/non-unique-string-array ++ minItems: 2 ++ description: |- ++ A list of the connections between audio components. Each entry is a ++ pair of strings, the first being the connection's sink, the second ++ being the connection's source. ++ ++ audio-widgets: ++ $ref: /schemas/types.yaml#/definitions/non-unique-string-array ++ minItems: 2 ++ description: |- ++ A list off component DAPM widget. Each entry is a pair of strings, ++ the first being the widget type, the second being the widget name ++ ++ model: ++ $ref: /schemas/types.yaml#/definitions/string ++ description: User specified audio sound card name ++ ++patternProperties: ++ "^dai-link-[0-9]+$": ++ type: object ++ description: |- ++ dai-link child nodes: ++ Container for dai-link level properties and the CODEC sub-nodes. ++ There should be at least one (and probably more) subnode of this type ++ ++ properties: ++ dai-format: ++ $ref: /schemas/types.yaml#/definitions/string ++ enum: [ i2s, left-j, dsp_a ] ++ ++ dai-tdm-slot-num: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: | ++ Number of slots in use. If omitted, slot number is set to ++ accommodate the largest mask provided. ++ maximum: 32 ++ ++ dai-tdm-slot-width: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: Width in bits for each slot ++ enum: [ 8, 16, 20, 24, 32 ] ++ default: 32 ++ ++ mclk-fs: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: |- ++ Multiplication factor between the frame rate and master clock ++ rate ++ ++ sound-dai: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: phandle of the CPU DAI ++ ++ patternProperties: ++ "^dai-tdm-slot-(t|r)x-mask-[0-3]$": ++ $ref: /schemas/types.yaml#/definitions/uint32-array ++ description: |- ++ Transmit and receive cpu slot masks of each TDM lane ++ When omitted, mask is assumed to have to no slots. A valid must have ++ at one slot, so at least one these mask should be provided with ++ an enabled slot. ++ ++ "^codec-[0-9]+$": ++ type: object ++ description: |- ++ Codecs: ++ dai-link representing backend links should have at least one subnode. ++ One subnode for each codec of the dai-link. dai-link representing ++ frontend links have no codec, therefore have no subnodes ++ ++ properties: ++ sound-dai: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: phandle of the codec DAI ++ ++ patternProperties: ++ "^dai-tdm-slot-(t|r)x-mask$": ++ $ref: /schemas/types.yaml#/definitions/uint32-array ++ description: Transmit and receive codec slot masks ++ ++ required: ++ - sound-dai ++ ++ required: ++ - sound-dai ++ ++required: ++ - model ++ - dai-link-0 ++ ++examples: ++ - | ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "AXG-S420"; ++ audio-aux-devs = <&tdmin_a>, <&tdmout_c>; ++ audio-widgets = "Line", "Lineout", ++ "Line", "Linein", ++ "Speaker", "Speaker1 Left", ++ "Speaker", "Speaker1 Right", ++ "Speaker", "Speaker2 Left", ++ "Speaker", "Speaker2 Right"; ++ audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2", ++ "SPDIFOUT IN 0", "FRDDR_A OUT 3", ++ "TDM_C Playback", "TDMOUT_C OUT", ++ "TDMIN_A IN 2", "TDM_C Capture", ++ "TDMIN_A IN 5", "TDM_C Loopback", ++ "TODDR_A IN 0", "TDMIN_A OUT", ++ "Lineout", "Lineout AOUTL", ++ "Lineout", "Lineout AOUTR", ++ "Speaker1 Left", "SPK1 OUT_A", ++ "Speaker2 Left", "SPK2 OUT_A", ++ "Speaker1 Right", "SPK1 OUT_B", ++ "Speaker2 Right", "SPK2 OUT_B", ++ "Linein AINL", "Linein", ++ "Linein AINR", "Linein"; ++ ++ dai-link-0 { ++ sound-dai = <&frddr_a>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&toddr_a>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&tdmif_c>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-2 = <1 1>; ++ dai-tdm-slot-tx-mask-3 = <1 1>; ++ dai-tdm-slot-rx-mask-1 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&lineout>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&speaker_amp1>; ++ }; ++ ++ codec-2 { ++ sound-dai = <&speaker_amp2>; ++ }; ++ ++ codec-3 { ++ sound-dai = <&linein>; ++ }; ++ }; ++ ++ dai-link@3 { ++ sound-dai = <&spdifout>; ++ ++ codec { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ }; ++ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0044-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_suspend.patch b/packages/linux/patches/amlogic/amlogic-0044-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_suspend.patch deleted file mode 100644 index 20b68fce2a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0044-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_suspend.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 76ea370311ff1be466a9a1d2f530d30cfe65fcac Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:34:29 +0900 -Subject: [PATCH 044/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_suspend() - -Current ALSA SoC is directly using dai->driver->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_suspend() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87muh6hn2x.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit e0f2262292d0c8160cfd9a8c40425107fb65ab29 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 1 + - sound/soc/soc-core.c | 8 ++++---- - sound/soc/soc-dai.c | 6 ++++++ - 3 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 7cfed3034511..6c5604a7dbc2 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -162,6 +162,7 @@ int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, int cmd); - snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); -+void snd_soc_dai_suspend(struct snd_soc_dai *dai); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index a8d2c4ec0ec9..1060836b63fb 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -511,8 +511,8 @@ int snd_soc_suspend(struct device *dev) - if (rtd->dai_link->ignore_suspend) - continue; - -- if (cpu_dai->driver->suspend && !cpu_dai->driver->bus_control) -- cpu_dai->driver->suspend(cpu_dai); -+ if (!cpu_dai->driver->bus_control) -+ snd_soc_dai_suspend(cpu_dai); - } - - /* close any waiting streams */ -@@ -584,8 +584,8 @@ int snd_soc_suspend(struct device *dev) - if (rtd->dai_link->ignore_suspend) - continue; - -- if (cpu_dai->driver->suspend && cpu_dai->driver->bus_control) -- cpu_dai->driver->suspend(cpu_dai); -+ if (cpu_dai->driver->bus_control) -+ snd_soc_dai_suspend(cpu_dai); - - /* deactivate pins to sleep state */ - pinctrl_pm_select_sleep_state(cpu_dai->dev); -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 5b5b979cd1f3..3373598e0682 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -353,3 +353,9 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, - - return delay; - } -+ -+void snd_soc_dai_suspend(struct snd_soc_dai *dai) -+{ -+ if (dai->driver->suspend) -+ dai->driver->suspend(dai); -+} --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch b/packages/linux/patches/amlogic/amlogic-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch new file mode 100644 index 0000000000..72ed3626fa --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch @@ -0,0 +1,37 @@ +From 204e9f3a44134cb8c2d35fe680438217917c0b45 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 13 Jan 2020 13:50:44 +0100 +Subject: [PATCH 044/146] FROMLIST: ASoC: meson: g12a: add tohdmitx reset + +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/g12a-tohdmitx.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sound/soc/meson/g12a-tohdmitx.c b/sound/soc/meson/g12a-tohdmitx.c +index f8853f2fba08..9b2b59536ced 100644 +--- a/sound/soc/meson/g12a-tohdmitx.c ++++ b/sound/soc/meson/g12a-tohdmitx.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -245,6 +246,11 @@ static int g12a_tohdmitx_probe(struct platform_device *pdev) + struct device *dev = &pdev->dev; + void __iomem *regs; + struct regmap *map; ++ int ret; ++ ++ ret = device_reset(dev); ++ if (ret) ++ return ret; + + regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0045-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_resume.patch b/packages/linux/patches/amlogic/amlogic-0045-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_resume.patch deleted file mode 100644 index dd6d974d00..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0045-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_resume.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0561a8c27e395a24a69eee8bbbf55f1d5fee3e8e Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:34:43 +0900 -Subject: [PATCH 045/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_resume() - -Current ALSA SoC is directly using dai->driver->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_resume() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87lfwqhn2j.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 24b09d051164680f0a1d1910efe21ce36ad5c1ca - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 1 + - sound/soc/soc-core.c | 8 ++++---- - sound/soc/soc-dai.c | 6 ++++++ - 3 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 6c5604a7dbc2..ed78e34a814e 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -163,6 +163,7 @@ int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, - snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); - void snd_soc_dai_suspend(struct snd_soc_dai *dai); -+void snd_soc_dai_resume(struct snd_soc_dai *dai); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index 1060836b63fb..c08d4fff01a6 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -631,8 +631,8 @@ static void soc_resume_deferred(struct work_struct *work) - if (rtd->dai_link->ignore_suspend) - continue; - -- if (cpu_dai->driver->resume && cpu_dai->driver->bus_control) -- cpu_dai->driver->resume(cpu_dai); -+ if (cpu_dai->driver->bus_control) -+ snd_soc_dai_resume(cpu_dai); - } - - for_each_card_components(card, component) { -@@ -678,8 +678,8 @@ static void soc_resume_deferred(struct work_struct *work) - if (rtd->dai_link->ignore_suspend) - continue; - -- if (cpu_dai->driver->resume && !cpu_dai->driver->bus_control) -- cpu_dai->driver->resume(cpu_dai); -+ if (!cpu_dai->driver->bus_control) -+ snd_soc_dai_resume(cpu_dai); - } - - if (card->resume_post) -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 3373598e0682..ddb6f217c0ed 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -359,3 +359,9 @@ void snd_soc_dai_suspend(struct snd_soc_dai *dai) - if (dai->driver->suspend) - dai->driver->suspend(dai); - } -+ -+void snd_soc_dai_resume(struct snd_soc_dai *dai) -+{ -+ if (dai->driver->resume) -+ dai->driver->resume(dai); -+} --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0045-FROMLIST-ASoC-meson-add-g12a-toacodec-dt-binding-doc.patch b/packages/linux/patches/amlogic/amlogic-0045-FROMLIST-ASoC-meson-add-g12a-toacodec-dt-binding-doc.patch new file mode 100644 index 0000000000..a24427ee5b --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0045-FROMLIST-ASoC-meson-add-g12a-toacodec-dt-binding-doc.patch @@ -0,0 +1,92 @@ +From dbda919875b73a65217756584bbb6bc0b055b51d Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 28 Jan 2020 13:37:39 +0100 +Subject: [PATCH 045/146] FROMLIST: ASoC: meson: add g12a-toacodec dt-binding + documentation + +Signed-off-by: Jerome Brunet +--- + .../bindings/sound/amlogic,g12a-toacodec.yaml | 53 +++++++++++++++++++ + .../dt-bindings/sound/meson-g12a-toacodec.h | 10 ++++ + 2 files changed, 63 insertions(+) + create mode 100644 Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml + create mode 100644 include/dt-bindings/sound/meson-g12a-toacodec.h + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml b/Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml +new file mode 100644 +index 000000000000..cbd33ba99e58 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml +@@ -0,0 +1,53 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/sound/amlogic,g12a-toacodec.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic G12a Internal DAC Control Glue ++ ++maintainers: ++ - Jerome Brunet ++ ++properties: ++ $nodename: ++ pattern: "^audio-controller@.*" ++ ++ "#sound-dai-cells": ++ const: 1 ++ ++ compatible: ++ oneOf: ++ - items: ++ - const: ++ amlogic,g12a-toacodec ++ - items: ++ - enum: ++ - amlogic,sm1-toacodec ++ - const: ++ amlogic,g12a-toacodec ++ ++ reg: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 1 ++ ++required: ++ - "#sound-dai-cells" ++ - compatible ++ - reg ++ - resets ++ ++examples: ++ - | ++ #include ++ ++ toacodec: audio-controller@740 { ++ compatible = "amlogic,g12a-toacodec"; ++ reg = <0x0 0x740 0x0 0x4>; ++ #sound-dai-cells = <1>; ++ resets = <&clkc_audio AUD_RESET_TOACODEC>; ++ }; ++ ++ +diff --git a/include/dt-bindings/sound/meson-g12a-toacodec.h b/include/dt-bindings/sound/meson-g12a-toacodec.h +new file mode 100644 +index 000000000000..69d7a75592a2 +--- /dev/null ++++ b/include/dt-bindings/sound/meson-g12a-toacodec.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __DT_MESON_G12A_TOACODEC_H ++#define __DT_MESON_G12A_TOACODEC_H ++ ++#define TOACODEC_IN_A 0 ++#define TOACODEC_IN_B 1 ++#define TOACODEC_IN_C 2 ++#define TOACODEC_OUT 3 ++ ++#endif /* __DT_MESON_G12A_TOACODEC_H */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0046-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_probe.patch b/packages/linux/patches/amlogic/amlogic-0046-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_probe.patch deleted file mode 100644 index 6a7978085a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0046-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_probe.patch +++ /dev/null @@ -1,81 +0,0 @@ -From e71d0a2a808e1c2f86d1a977091b526c2e3e534d Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:34:56 +0900 -Subject: [PATCH 046/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_probe() - -Current ALSA SoC is directly using dai->driver->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_probe() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87k1cahn26.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit cfd9b5fbfe1e8763018aea2600aa0d6ff015ebfc - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 1 + - sound/soc/soc-core.c | 15 +++++++-------- - sound/soc/soc-dai.c | 7 +++++++ - 3 files changed, 15 insertions(+), 8 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index ed78e34a814e..da8d8b889089 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -164,6 +164,7 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream); - void snd_soc_dai_suspend(struct snd_soc_dai *dai); - void snd_soc_dai_resume(struct snd_soc_dai *dai); -+int snd_soc_dai_probe(struct snd_soc_dai *dai); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index c08d4fff01a6..d78f132174b1 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -1434,18 +1434,17 @@ static int soc_probe_link_components(struct snd_soc_card *card, - - static int soc_probe_dai(struct snd_soc_dai *dai, int order) - { -+ int ret; -+ - if (dai->probed || - dai->driver->probe_order != order) - return 0; - -- if (dai->driver->probe) { -- int ret = dai->driver->probe(dai); -- -- if (ret < 0) { -- dev_err(dai->dev, "ASoC: failed to probe DAI %s: %d\n", -- dai->name, ret); -- return ret; -- } -+ ret = snd_soc_dai_probe(dai); -+ if (ret < 0) { -+ dev_err(dai->dev, "ASoC: failed to probe DAI %s: %d\n", -+ dai->name, ret); -+ return ret; - } - - dai->probed = 1; -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index ddb6f217c0ed..55c1fac99613 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -365,3 +365,10 @@ void snd_soc_dai_resume(struct snd_soc_dai *dai) - if (dai->driver->resume) - dai->driver->resume(dai); - } -+ -+int snd_soc_dai_probe(struct snd_soc_dai *dai) -+{ -+ if (dai->driver->probe) -+ return dai->driver->probe(dai); -+ return 0; -+} --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0046-FROMLIST-ASoC-meson-add-g12-internal-DAC-glue.patch b/packages/linux/patches/amlogic/amlogic-0046-FROMLIST-ASoC-meson-add-g12-internal-DAC-glue.patch new file mode 100644 index 0000000000..26788d6c2c --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0046-FROMLIST-ASoC-meson-add-g12-internal-DAC-glue.patch @@ -0,0 +1,301 @@ +From 9133abee2754290bf76557f71b7fa1d4c502f404 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 12 Aug 2019 11:45:16 +0200 +Subject: [PATCH 046/146] FROMLIST: ASoC: meson: add g12 internal DAC glue + +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/Kconfig | 9 ++ + sound/soc/meson/Makefile | 2 + + sound/soc/meson/g12a-toacodec.c | 240 ++++++++++++++++++++++++++++++++ + 3 files changed, 251 insertions(+) + create mode 100644 sound/soc/meson/g12a-toacodec.c + +diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig +index 897a706dcda0..85ab77ff0399 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -109,6 +109,15 @@ config SND_MESON_GX_SOUND_CARD + help + Select Y or M to add support for the GXBB/GXL SoC sound card + ++config SND_MESON_G12A_TOACODEC ++ tristate "Amlogic G12A To Internal DAC Control Support" ++ select SND_MESON_CODEC_GLUE ++ select REGMAP_MMIO ++ imply SND_SOC_MESON_T9015 ++ help ++ Select Y or M to add support for the internal audio DAC on the ++ g12a SoC family ++ + config SND_MESON_G12A_TOHDMITX + tristate "Amlogic G12A To HDMI TX Control Support" + select REGMAP_MMIO +diff --git a/sound/soc/meson/Makefile b/sound/soc/meson/Makefile +index 3c9d48846816..e446bc980481 100644 +--- a/sound/soc/meson/Makefile ++++ b/sound/soc/meson/Makefile +@@ -22,6 +22,7 @@ snd-soc-meson-axg-pdm-objs := axg-pdm.o + snd-soc-meson-card-utils-objs := meson-card-utils.o + snd-soc-meson-codec-glue-objs := meson-codec-glue.o + snd-soc-meson-gx-sound-card-objs := gx-card.o ++snd-soc-meson-g12a-toacodec-objs := g12a-toacodec.o + snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o + snd-soc-meson-t9015-objs := t9015.o + +@@ -40,5 +41,6 @@ obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o + obj-$(CONFIG_SND_MESON_CARD_UTILS) += snd-soc-meson-card-utils.o + obj-$(CONFIG_SND_MESON_CODEC_GLUE) += snd-soc-meson-codec-glue.o + obj-$(CONFIG_SND_MESON_GX_SOUND_CARD) += snd-soc-meson-gx-sound-card.o ++obj-$(CONFIG_SND_MESON_G12A_TOACODEC) += snd-soc-meson-g12a-toacodec.o + obj-$(CONFIG_SND_MESON_G12A_TOHDMITX) += snd-soc-meson-g12a-tohdmitx.o + obj-$(CONFIG_SND_SOC_MESON_T9015) += snd-soc-meson-t9015.o +diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c +new file mode 100644 +index 000000000000..0ee074f6fc87 +--- /dev/null ++++ b/sound/soc/meson/g12a-toacodec.c +@@ -0,0 +1,240 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// Copyright (c) 2020 BayLibre, SAS. ++// Author: Jerome Brunet ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "axg-tdm.h" ++#include "meson-codec-glue.h" ++ ++#define G12A_TOACODEC_DRV_NAME "g12a-toacodec" ++ ++#define TOACODEC_CTRL0 0x0 ++#define CTRL0_ENABLE_SHIFT 31 ++#define CTRL0_DAT_SEL GENMASK(15, 14) ++#define CTRL0_LANE_SEL 12 ++#define CTRL0_LRCLK_SEL GENMASK(9, 8) ++#define CTRL0_BLK_CAP_INV BIT(7) ++#define CTRL0_BCLK_O_INV BIT(6) ++#define CTRL0_BCLK_SEL GENMASK(5, 4) ++#define CTRL0_MCLK_SEL GENMASK(2, 0) ++ ++#define TOACODEC_OUT_CHMAX 2 ++ ++static const char * const g12a_toacodec_mux_texts[] = { ++ "I2S A", "I2S B", "I2S C", ++}; ++ ++static int g12a_toacodec_get_mux(struct snd_soc_component *component) ++{ ++ unsigned int val; ++ ++ snd_soc_component_read(component, TOACODEC_CTRL0, &val); ++ return FIELD_GET(CTRL0_DAT_SEL, val); ++} ++ ++static int g12a_toacodec_put_mux(struct snd_soc_component *component, ++ unsigned int mux) ++{ ++ snd_soc_component_update_bits(component, TOACODEC_CTRL0, ++ CTRL0_DAT_SEL | ++ CTRL0_LRCLK_SEL | ++ CTRL0_BCLK_SEL, ++ FIELD_PREP(CTRL0_DAT_SEL, mux) | ++ FIELD_PREP(CTRL0_LRCLK_SEL, mux) | ++ FIELD_PREP(CTRL0_BCLK_SEL, mux)); ++ ++ /* ++ * FIXME: ++ * On this soc, the glue gets the MCLK directly from the clock ++ * controller instead of going the through the TDM interface. ++ * ++ * Here we assume interface A uses clock A, etc ... While it is ++ * true for now, it could be different. Instead the glue should ++ * find out the clock used by the interface and select the same ++ * source. For that, we will need regmap backed clock mux which ++ * is a work in progress ++ */ ++ snd_soc_component_update_bits(component, TOACODEC_CTRL0, ++ CTRL0_MCLK_SEL, ++ FIELD_PREP(CTRL0_MCLK_SEL, mux)); ++ ++ return 0; ++} ++ ++static MESON_CODEC_GLUE_ENUM_DECL(g12a_toacodec_mux_glue, ++ g12a_toacodec_mux_texts, ++ g12a_toacodec_get_mux, ++ g12a_toacodec_put_mux); ++ ++static const struct snd_kcontrol_new g12a_toacodec_mux = ++ SOC_DAPM_ENUM_EXT("Source", g12a_toacodec_mux_enum, ++ snd_soc_dapm_get_enum_double, ++ g12a_toacodec_mux_put_enum); ++ ++static const struct snd_kcontrol_new g12a_toacodec_out_enable = ++ SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0, ++ CTRL0_ENABLE_SHIFT, 1, 0); ++ ++static const struct snd_soc_dapm_widget g12a_toacodec_widgets[] = { ++ SND_SOC_DAPM_MUX("SRC", SND_SOC_NOPM, 0, 0, ++ &g12a_toacodec_mux), ++ SND_SOC_DAPM_SWITCH("OUT EN", SND_SOC_NOPM, 0, 0, ++ &g12a_toacodec_out_enable), ++}; ++ ++static int g12a_toacodec_input_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct meson_codec_glue_input *data; ++ int ret; ++ ++ ret = meson_codec_glue_input_hw_params(substream, params, dai); ++ if (ret) ++ return ret; ++ ++ /* The glue will provide 1 lane out of the 4 to the output */ ++ data = meson_codec_glue_input_get_data(dai); ++ data->params.channels_min = min_t(unsigned int, TOACODEC_OUT_CHMAX, ++ data->params.channels_min); ++ data->params.channels_max = min_t(unsigned int, TOACODEC_OUT_CHMAX, ++ data->params.channels_max); ++ ++ return 0; ++} ++ ++static const struct snd_soc_dai_ops g12a_toacodec_input_ops = { ++ .hw_params = g12a_toacodec_input_hw_params, ++ .set_fmt = meson_codec_glue_input_set_fmt, ++}; ++ ++static const struct snd_soc_dai_ops g12a_toacodec_output_ops = { ++ .startup = meson_codec_glue_output_startup, ++}; ++ ++#define TOACODEC_STREAM(xname, xsuffix, xchmax) \ ++{ \ ++ .stream_name = xname " " xsuffix, \ ++ .channels_min = 1, \ ++ .channels_max = (xchmax), \ ++ .rate_min = 5512, \ ++ .rate_max = 192000, \ ++ .formats = AXG_TDM_FORMATS, \ ++} ++ ++#define TOACODEC_INPUT(xname, xid) { \ ++ .name = xname, \ ++ .id = (xid), \ ++ .playback = TOACODEC_STREAM(xname, "Playback", 8), \ ++ .ops = &g12a_toacodec_input_ops, \ ++ .probe = meson_codec_glue_input_dai_probe, \ ++ .remove = meson_codec_glue_input_dai_remove, \ ++} ++ ++#define TOACODEC_OUTPUT(xname, xid) { \ ++ .name = xname, \ ++ .id = (xid), \ ++ .capture = TOACODEC_STREAM(xname, "Capture", TOACODEC_OUT_CHMAX), \ ++ .ops = &g12a_toacodec_output_ops, \ ++} ++ ++static struct snd_soc_dai_driver g12a_toacodec_dai_drv[] = { ++ TOACODEC_INPUT("I2S IN A", TOACODEC_IN_A), ++ TOACODEC_INPUT("I2S IN B", TOACODEC_IN_B), ++ TOACODEC_INPUT("I2S IN C", TOACODEC_IN_C), ++ TOACODEC_OUTPUT("I2S OUT", TOACODEC_OUT), ++}; ++ ++static int g12a_toacodec_component_probe(struct snd_soc_component *c) ++{ ++ /* Initialize the static clock parameters */ ++ return snd_soc_component_write(c, TOACODEC_CTRL0, ++ CTRL0_BLK_CAP_INV); ++} ++ ++static const struct snd_soc_dapm_route g12a_toacodec_routes[] = { ++ { "I2S SRC", "I2S A", "I2S IN A Playback" }, ++ { "I2S SRC", "I2S B", "I2S IN B Playback" }, ++ { "I2S SRC", "I2S C", "I2S IN C Playback" }, ++ { "I2S OUT EN", "Switch", "I2S SRC" }, ++ { "I2S OUT Capture", NULL, "I2S OUT EN" }, ++}; ++ ++static const struct snd_kcontrol_new g12a_toacodec_controls[] = { ++ SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL, 3, 0), ++}; ++ ++static const struct snd_soc_component_driver g12a_toacodec_component_drv = { ++ .probe = g12a_toacodec_component_probe, ++ .controls = g12a_toacodec_controls, ++ .num_controls = ARRAY_SIZE(g12a_toacodec_controls), ++ .dapm_widgets = g12a_toacodec_widgets, ++ .num_dapm_widgets = ARRAY_SIZE(g12a_toacodec_widgets), ++ .dapm_routes = g12a_toacodec_routes, ++ .num_dapm_routes = ARRAY_SIZE(g12a_toacodec_routes), ++ .endianness = 1, ++ .non_legacy_dai_naming = 1, ++}; ++ ++static const struct regmap_config g12a_toacodec_regmap_cfg = { ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++}; ++ ++static const struct of_device_id g12a_toacodec_of_match[] = { ++ { .compatible = "amlogic,g12a-toacodec", }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, g12a_toacodec_of_match); ++ ++static int g12a_toacodec_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ void __iomem *regs; ++ struct regmap *map; ++ int ret; ++ ++ ret = device_reset(dev); ++ if (ret) ++ return ret; ++ ++ regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(regs)) ++ return PTR_ERR(regs); ++ ++ map = devm_regmap_init_mmio(dev, regs, &g12a_toacodec_regmap_cfg); ++ if (IS_ERR(map)) { ++ dev_err(dev, "failed to init regmap: %ld\n", ++ PTR_ERR(map)); ++ return PTR_ERR(map); ++ } ++ ++ return devm_snd_soc_register_component(dev, ++ &g12a_toacodec_component_drv, g12a_toacodec_dai_drv, ++ ARRAY_SIZE(g12a_toacodec_dai_drv)); ++} ++ ++static struct platform_driver g12a_toacodec_pdrv = { ++ .driver = { ++ .name = G12A_TOACODEC_DRV_NAME, ++ .of_match_table = g12a_toacodec_of_match, ++ }, ++ .probe = g12a_toacodec_probe, ++}; ++module_platform_driver(g12a_toacodec_pdrv); ++ ++MODULE_AUTHOR("Jerome Brunet "); ++MODULE_DESCRIPTION("Amlogic G12a To Internal DAC Codec Driver"); ++MODULE_LICENSE("GPL v2"); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0047-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_remove.patch b/packages/linux/patches/amlogic/amlogic-0047-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_remove.patch deleted file mode 100644 index 9b50ba973b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0047-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_remove.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 1b47c4e5223f7516c758b158c2f4dccd665c1887 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:35:05 +0900 -Subject: [PATCH 047/187] FROMGIT: ASoC: soc-dai: add snd_soc_dai_remove() - -Current ALSA SoC is directly using dai->driver->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_remvoe() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87imruhn1x.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit dcdab5820edd6123911dbd767ee1e389008b6a83 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 1 + - sound/soc/soc-core.c | 13 ++++++------- - sound/soc/soc-dai.c | 7 +++++++ - 3 files changed, 14 insertions(+), 7 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index da8d8b889089..2a11f177ce01 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -165,6 +165,7 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, - void snd_soc_dai_suspend(struct snd_soc_dai *dai); - void snd_soc_dai_resume(struct snd_soc_dai *dai); - int snd_soc_dai_probe(struct snd_soc_dai *dai); -+int snd_soc_dai_remove(struct snd_soc_dai *dai); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index d78f132174b1..8a55735c4311 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -992,13 +992,12 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order) - dai->driver->remove_order != order) - return; - -- if (dai->driver->remove) { -- err = dai->driver->remove(dai); -- if (err < 0) -- dev_err(dai->dev, -- "ASoC: failed to remove %s: %d\n", -- dai->name, err); -- } -+ err = snd_soc_dai_remove(dai); -+ if (err < 0) -+ dev_err(dai->dev, -+ "ASoC: failed to remove %s: %d\n", -+ dai->name, err); -+ - dai->probed = 0; - } - -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 55c1fac99613..384765c747da 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -372,3 +372,10 @@ int snd_soc_dai_probe(struct snd_soc_dai *dai) - return dai->driver->probe(dai); - return 0; - } -+ -+int snd_soc_dai_remove(struct snd_soc_dai *dai) -+{ -+ if (dai->driver->remove) -+ return dai->driver->remove(dai); -+ return 0; -+} --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0047-FROMLIST-ASoC-meson-axg-card-add-toacodec-support.patch b/packages/linux/patches/amlogic/amlogic-0047-FROMLIST-ASoC-meson-axg-card-add-toacodec-support.patch new file mode 100644 index 0000000000..8c3d8c611b --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0047-FROMLIST-ASoC-meson-axg-card-add-toacodec-support.patch @@ -0,0 +1,27 @@ +From a1388a0e90bc6744e986c73e659b59458782850f Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 14 Aug 2019 17:27:12 +0200 +Subject: [PATCH 047/146] FROMLIST: ASoC: meson: axg-card: add toacodec support + +Signed-off-by: Jerome Brunet +--- + sound/soc/meson/axg-card.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c +index 372dc696cc8e..48651631bdcf 100644 +--- a/sound/soc/meson/axg-card.c ++++ b/sound/soc/meson/axg-card.c +@@ -303,7 +303,8 @@ static int axg_card_cpu_is_tdm_iface(struct device_node *np) + + static int axg_card_cpu_is_codec(struct device_node *np) + { +- return of_device_is_compatible(np, DT_PREFIX "g12a-tohdmitx"); ++ return of_device_is_compatible(np, DT_PREFIX "g12a-tohdmitx") || ++ of_device_is_compatible(np, DT_PREFIX "g12a-toacodec"); + } + + static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0048-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_compress_new.patch b/packages/linux/patches/amlogic/amlogic-0048-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_compress_new.patch deleted file mode 100644 index 5fe97c1295..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0048-FROMGIT-ASoC-soc-dai-add-snd_soc_dai_compress_new.patch +++ /dev/null @@ -1,82 +0,0 @@ -From a2af4898f09c058a7978393cc297bfbd7fb8636a Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:35:29 +0900 -Subject: [PATCH 048/187] FROMGIT: ASoC: soc-dai: add - snd_soc_dai_compress_new() - -Current ALSA SoC is directly using dai->driver->xxx, -thus, it has deep nested bracket, and it makes code unreadable. -This patch adds new snd_soc_dai_compress_new() and use it. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87h87ehn1a.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit b423c4202135f7794e0a9c55a884f5933d8e7156 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 2 ++ - sound/soc/soc-core.c | 15 ++++++++------- - sound/soc/soc-dai.c | 8 ++++++++ - 3 files changed, 18 insertions(+), 7 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 2a11f177ce01..0f8b09520020 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -166,6 +166,8 @@ void snd_soc_dai_suspend(struct snd_soc_dai *dai); - void snd_soc_dai_resume(struct snd_soc_dai *dai); - int snd_soc_dai_probe(struct snd_soc_dai *dai); - int snd_soc_dai_remove(struct snd_soc_dai *dai); -+int snd_soc_dai_compress_new(struct snd_soc_dai *dai, -+ struct snd_soc_pcm_runtime *rtd, int num); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index 8a55735c4311..33df0dfe29f0 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -1548,15 +1548,16 @@ static int soc_probe_link_dais(struct snd_soc_card *card, - num = rtd->dai_link->id; - } - -- if (cpu_dai->driver->compress_new) { -- /* create compress_device" */ -- ret = cpu_dai->driver->compress_new(rtd, num); -- if (ret < 0) { -+ /* create compress_device if possible */ -+ ret = snd_soc_dai_compress_new(cpu_dai, rtd, num); -+ if (ret != -ENOTSUPP) { -+ if (ret < 0) - dev_err(card->dev, "ASoC: can't create compress %s\n", - dai_link->stream_name); -- return ret; -- } -- } else if (!dai_link->params) { -+ return ret; -+ } -+ -+ if (!dai_link->params) { - /* create the pcm */ - ret = soc_new_pcm(rtd, num); - if (ret < 0) { -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index 384765c747da..e6f161b9f975 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -379,3 +379,11 @@ int snd_soc_dai_remove(struct snd_soc_dai *dai) - return dai->driver->remove(dai); - return 0; - } -+ -+int snd_soc_dai_compress_new(struct snd_soc_dai *dai, -+ struct snd_soc_pcm_runtime *rtd, int num) -+{ -+ if (dai->driver->compress_new) -+ return dai->driver->compress_new(rtd, num); -+ return -ENOTSUPP; -+} --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0048-FROMLIST-arm64-dts-meson-add-pdm-reset-line.patch b/packages/linux/patches/amlogic/amlogic-0048-FROMLIST-arm64-dts-meson-add-pdm-reset-line.patch new file mode 100644 index 0000000000..8862636bfb --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0048-FROMLIST-arm64-dts-meson-add-pdm-reset-line.patch @@ -0,0 +1,40 @@ +From 824ee4efd64a481515dcd117344d3523a0210f0d Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 25 Feb 2020 06:40:40 +0000 +Subject: [PATCH 048/146] FROMLIST: arm64: dts: meson: add pdm reset line + +Add the reset line of the PDM device to g12 and sm1 SoCs. + +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 1 + + arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +index 03054c478896..55d39020ec72 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +@@ -56,6 +56,7 @@ + <&clkc_audio AUD_CLKID_PDM_DCLK>, + <&clkc_audio AUD_CLKID_PDM_SYSCLK>; + clock-names = "pclk", "dclk", "sysclk"; ++ resets = <&clkc_audio AUD_RESET_PDM>; + status = "disabled"; + }; + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +index d847a3fcbc85..d4ec735fb1a5 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +@@ -448,6 +448,7 @@ + <&clkc_audio AUD_CLKID_PDM_DCLK>, + <&clkc_audio AUD_CLKID_PDM_SYSCLK>; + clock-names = "pclk", "dclk", "sysclk"; ++ resets = <&clkc_audio AUD_RESET_PDM>; + status = "disabled"; + }; + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0049-FROMGIT-ASoC-soc-dai-move-snd_soc_dai_stream_valid-t.patch b/packages/linux/patches/amlogic/amlogic-0049-FROMGIT-ASoC-soc-dai-move-snd_soc_dai_stream_valid-t.patch deleted file mode 100644 index f293ef5212..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0049-FROMGIT-ASoC-soc-dai-move-snd_soc_dai_stream_valid-t.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 301a1904892eb2c49214506691fcee6de897a2c6 Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Mon, 22 Jul 2019 10:36:16 +0900 -Subject: [PATCH 049/187] FROMGIT: ASoC: soc-dai: move - snd_soc_dai_stream_valid() to soc-dai.c - -snd_soc_dai_stream_valid() is function to check stream validity. -But, some code is using it, some code are checking stream->channels_min -directly. Doing samethings by different method is confusable. -This patch uses same funcntion for same purpose. - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87ftmyhmzz.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown -(cherry picked from commit 467fece8fbc6774a3a3bd0981e1a342fb5022706 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - include/sound/soc-dai.h | 1 + - sound/soc/soc-compress.c | 9 ++++----- - sound/soc/soc-dai.c | 18 ++++++++++++++++++ - sound/soc/soc-pcm.c | 39 ++++++++++----------------------------- - 4 files changed, 33 insertions(+), 34 deletions(-) - -diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h -index 0f8b09520020..dc48fe081a20 100644 ---- a/include/sound/soc-dai.h -+++ b/include/sound/soc-dai.h -@@ -168,6 +168,7 @@ int snd_soc_dai_probe(struct snd_soc_dai *dai); - int snd_soc_dai_remove(struct snd_soc_dai *dai); - int snd_soc_dai_compress_new(struct snd_soc_dai *dai, - struct snd_soc_pcm_runtime *rtd, int num); -+bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); - - struct snd_soc_dai_ops { - /* -diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c -index ddef4ff677ce..289211069a1e 100644 ---- a/sound/soc/soc-compress.c -+++ b/sound/soc/soc-compress.c -@@ -872,14 +872,13 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) - } - - /* check client and interface hw capabilities */ -- if (codec_dai->driver->playback.channels_min) -+ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && -+ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) - playback = 1; -- if (codec_dai->driver->capture.channels_min) -+ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) && -+ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) - capture = 1; - -- capture = capture && cpu_dai->driver->capture.channels_min; -- playback = playback && cpu_dai->driver->playback.channels_min; -- - /* - * Compress devices are unidirectional so only one of the directions - * should be set, check for that (xor) -diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c -index e6f161b9f975..1c7f63871c1d 100644 ---- a/sound/soc/soc-dai.c -+++ b/sound/soc/soc-dai.c -@@ -387,3 +387,21 @@ int snd_soc_dai_compress_new(struct snd_soc_dai *dai, - return dai->driver->compress_new(rtd, num); - return -ENOTSUPP; - } -+ -+/* -+ * snd_soc_dai_stream_valid() - check if a DAI supports the given stream -+ * -+ * Returns true if the DAI supports the indicated stream type. -+ */ -+bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir) -+{ -+ struct snd_soc_pcm_stream *stream; -+ -+ if (dir == SNDRV_PCM_STREAM_PLAYBACK) -+ stream = &dai->driver->playback; -+ else -+ stream = &dai->driver->capture; -+ -+ /* If the codec specifies any channels at all, it supports the stream */ -+ return stream->channels_min; -+} -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index f3137723301c..fabeac164a6c 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -29,24 +29,6 @@ - - #define DPCM_MAX_BE_USERS 8 - --/* -- * snd_soc_dai_stream_valid() - check if a DAI supports the given stream -- * -- * Returns true if the DAI supports the indicated stream type. -- */ --static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream) --{ -- struct snd_soc_pcm_stream *codec_stream; -- -- if (stream == SNDRV_PCM_STREAM_PLAYBACK) -- codec_stream = &dai->driver->playback; -- else -- codec_stream = &dai->driver->capture; -- -- /* If the codec specifies any channels at all, it supports the stream */ -- return codec_stream->channels_min; --} -- - /** - * snd_soc_runtime_activate() - Increment active count for PCM runtime components - * @rtd: ASoC PCM runtime that is activated -@@ -2688,8 +2670,8 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) - new ? "new" : "old", fe->dai_link->name); - - /* skip if FE doesn't have playback capability */ -- if (!fe->cpu_dai->driver->playback.channels_min || -- !fe->codec_dai->driver->playback.channels_min) -+ if (!snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_PLAYBACK) || -+ !snd_soc_dai_stream_valid(fe->codec_dai, SNDRV_PCM_STREAM_PLAYBACK)) - goto capture; - - /* skip if FE isn't currently playing */ -@@ -2719,8 +2701,8 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) - - capture: - /* skip if FE doesn't have capture capability */ -- if (!fe->cpu_dai->driver->capture.channels_min || -- !fe->codec_dai->driver->capture.channels_min) -+ if (!snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_CAPTURE) || -+ !snd_soc_dai_stream_valid(fe->codec_dai, SNDRV_PCM_STREAM_CAPTURE)) - return 0; - - /* skip if FE isn't currently capturing */ -@@ -3030,14 +3012,13 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) - capture = rtd->dai_link->dpcm_capture; - } else { - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- if (codec_dai->driver->playback.channels_min) -+ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && -+ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) - playback = 1; -- if (codec_dai->driver->capture.channels_min) -+ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) && -+ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) - capture = 1; - } -- -- capture = capture && cpu_dai->driver->capture.channels_min; -- playback = playback && cpu_dai->driver->playback.channels_min; - } - - if (rtd->dai_link->playback_only) { -@@ -3375,11 +3356,11 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf, - if (!buf) - return -ENOMEM; - -- if (fe->cpu_dai->driver->playback.channels_min) -+ if (snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) - offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_PLAYBACK, - buf + offset, out_count - offset); - -- if (fe->cpu_dai->driver->capture.channels_min) -+ if (snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) - offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_CAPTURE, - buf + offset, out_count - offset); - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0049-FROMLIST-arm64-dts-meson-s400-fix-sound-card-codec-n.patch b/packages/linux/patches/amlogic/amlogic-0049-FROMLIST-arm64-dts-meson-s400-fix-sound-card-codec-n.patch new file mode 100644 index 0000000000..39dbfed359 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0049-FROMLIST-arm64-dts-meson-s400-fix-sound-card-codec-n.patch @@ -0,0 +1,45 @@ +From a8441caa5488d1469e570900f74961cf9dd38741 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 25 Feb 2020 06:41:31 +0000 +Subject: [PATCH 049/146] FROMLIST: arm64: dts: meson: s400: fix sound card + codec nodes + +Some codec nodes of the s400 sound card are numbered with the pattern +codec@XX. This pattern should be used only if there is a reg property in +the node which is not case here. Change this to something acceptable. + +This change is only to better comply with the DT spec. No functional +changes expected. + +Fixes: 6f59dc1afbb2 ("arm64: dts: meson-axg: s400: add sound card") +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-axg-s400.dts | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts b/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts +index 4cd2d5951822..cb1360ae1211 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-axg-s400.dts +@@ -313,15 +313,15 @@ + dai-tdm-slot-rx-mask-1 = <1 1>; + mclk-fs = <256>; + +- codec@0 { ++ codec-0 { + sound-dai = <&lineout>; + }; + +- codec@1 { ++ codec-1 { + sound-dai = <&speaker_amp1>; + }; + +- codec@2 { ++ codec-2 { + sound-dai = <&linein>; + }; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0050-FROMGIT-ASoC-codec2codec-run-callbacks-in-order.patch b/packages/linux/patches/amlogic/amlogic-0050-FROMGIT-ASoC-codec2codec-run-callbacks-in-order.patch deleted file mode 100644 index 880d458ea2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0050-FROMGIT-ASoC-codec2codec-run-callbacks-in-order.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 5322b041568f9f45f9eabe2efd236b47ae9a9809 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 25 Jul 2019 18:59:44 +0200 -Subject: [PATCH 050/187] FROMGIT: ASoC: codec2codec: run callbacks in order - -When handling dai_link events on codec to codec links, run all .startup() -callbacks on sinks and sources before running any .hw_params(). Same goes -for hw_free() and shutdown(). This is closer to the behavior of regular -dai links - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190725165949.29699-2-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit 68c907f10cd816cad2287167a1a1d77914a6d466 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-dapm.c | 36 +++++++++++++++++++++++++++--------- - 1 file changed, 27 insertions(+), 9 deletions(-) - -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index bf0481df870d..6d84aac8b54c 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3837,11 +3837,6 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - goto out; - } - source->active++; -- ret = snd_soc_dai_hw_params(source, &substream, params); -- if (ret < 0) -- goto out; -- -- dapm_update_dai_unlocked(&substream, params, source); - } - - substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -@@ -3855,6 +3850,23 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - goto out; - } - sink->active++; -+ } -+ -+ substream.stream = SNDRV_PCM_STREAM_CAPTURE; -+ snd_soc_dapm_widget_for_each_source_path(w, path) { -+ source = path->source->priv; -+ -+ ret = snd_soc_dai_hw_params(source, &substream, params); -+ if (ret < 0) -+ goto out; -+ -+ dapm_update_dai_unlocked(&substream, params, source); -+ } -+ -+ substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -+ snd_soc_dapm_widget_for_each_sink_path(w, path) { -+ sink = path->sink->priv; -+ - ret = snd_soc_dai_hw_params(sink, &substream, params); - if (ret < 0) - goto out; -@@ -3891,9 +3903,18 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - substream.stream = SNDRV_PCM_STREAM_CAPTURE; - snd_soc_dapm_widget_for_each_source_path(w, path) { - source = path->source->priv; -- - snd_soc_dai_hw_free(source, &substream); -+ } -+ -+ substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -+ snd_soc_dapm_widget_for_each_sink_path(w, path) { -+ sink = path->sink->priv; -+ snd_soc_dai_hw_free(sink, &substream); -+ } - -+ substream.stream = SNDRV_PCM_STREAM_CAPTURE; -+ snd_soc_dapm_widget_for_each_source_path(w, path) { -+ source = path->source->priv; - source->active--; - snd_soc_dai_shutdown(source, &substream); - } -@@ -3901,9 +3922,6 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - substream.stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_soc_dapm_widget_for_each_sink_path(w, path) { - sink = path->sink->priv; -- -- snd_soc_dai_hw_free(sink, &substream); -- - sink->active--; - snd_soc_dai_shutdown(sink, &substream); - } --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0050-FROMLIST-arm64-dts-meson-sei510-fix-sound-card-codec.patch b/packages/linux/patches/amlogic/amlogic-0050-FROMLIST-arm64-dts-meson-sei510-fix-sound-card-codec.patch new file mode 100644 index 0000000000..19bed54bd5 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0050-FROMLIST-arm64-dts-meson-sei510-fix-sound-card-codec.patch @@ -0,0 +1,35 @@ +From 70ceabe05241b93db594e77de60cd9dc7a48269d Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 25 Feb 2020 06:42:20 +0000 +Subject: [PATCH 050/146] FROMLIST: arm64: dts: meson: sei510: fix sound card + codec node + +A codec node of the sei510 sound card is numbered with the pattern +codec@XX. This pattern should be used only if there is a reg property in +the node which is not case here. Change this to something acceptable. + +This change is only to better comply with the DT spec. No functional +changes expected. + +Fixes: 64c10554bf9c ("arm64: dts: meson: sei510: add sound card") +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +index 2ac9e3a43b96..168f460e11fa 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +@@ -269,7 +269,7 @@ + dai-tdm-slot-tx-mask-3 = <1 1>; + mclk-fs = <256>; + +- codec@0 { ++ codec { + sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; + }; + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0051-FROMGIT-ASoC-codec2codec-name-link-using-stream-dire.patch b/packages/linux/patches/amlogic/amlogic-0051-FROMGIT-ASoC-codec2codec-name-link-using-stream-dire.patch deleted file mode 100644 index 08f58da971..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0051-FROMGIT-ASoC-codec2codec-name-link-using-stream-dire.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 70f827bdc10fb04e4d25d8b2a4b08be5f4b1d5d6 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 25 Jul 2019 18:59:45 +0200 -Subject: [PATCH 051/187] FROMGIT: ASoC: codec2codec: name link using stream - direction - -At the moment, codec to codec dai link widgets are named after the -cpu dai and the 1st codec valid on the link. This might be confusing -if there is multiple valid codecs on the link for one stream -direction. - -Instead, use the dai link name and the stream direction to name the -the dai link widget - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190725165949.29699-3-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit 054d65004c6a008dfefbdae4fc1b46a3ad4e94c1 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-dapm.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 6d84aac8b54c..17286bfec258 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -4058,8 +4058,7 @@ snd_soc_dapm_alloc_kcontrol(struct snd_soc_card *card, - - static struct snd_soc_dapm_widget * - snd_soc_dapm_new_dai(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd, -- struct snd_soc_dapm_widget *source, -- struct snd_soc_dapm_widget *sink) -+ char *id) - { - struct snd_soc_dapm_widget template; - struct snd_soc_dapm_widget *w; -@@ -4069,7 +4068,7 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd, - int ret; - - link_name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-%s", -- source->name, sink->name); -+ rtd->dai_link->name, id); - if (!link_name) - return ERR_PTR(-ENOMEM); - -@@ -4249,15 +4248,13 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, - } - - for_each_rtd_codec_dai(rtd, i, codec_dai) { -- - /* connect BE DAI playback if widgets are valid */ - codec = codec_dai->playback_widget; - - if (playback_cpu && codec) { - if (!playback) { - playback = snd_soc_dapm_new_dai(card, rtd, -- playback_cpu, -- codec); -+ "playback"); - if (IS_ERR(playback)) { - dev_err(rtd->dev, - "ASoC: Failed to create DAI %s: %ld\n", -@@ -4286,8 +4283,7 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, - if (codec && capture_cpu) { - if (!capture) { - capture = snd_soc_dapm_new_dai(card, rtd, -- codec, -- capture_cpu); -+ "capture"); - if (IS_ERR(capture)) { - dev_err(rtd->dev, - "ASoC: Failed to create DAI %s: %ld\n", --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0051-WIP-arm64-defconfig-enable-meson-gx-audio-as-module.patch b/packages/linux/patches/amlogic/amlogic-0051-WIP-arm64-defconfig-enable-meson-gx-audio-as-module.patch new file mode 100644 index 0000000000..82651c9a8d --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0051-WIP-arm64-defconfig-enable-meson-gx-audio-as-module.patch @@ -0,0 +1,26 @@ +From 8f207ceb43f354e6da4074b38e7e37c7ea496bea Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 4 Dec 2019 17:09:06 +0100 +Subject: [PATCH 051/146] WIP: arm64: defconfig: enable meson gx audio as + module + +Signed-off-by: Jerome Brunet +--- + arch/arm64/configs/defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig +index 905109f6814f..ccc7f6313ef8 100644 +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -581,6 +581,7 @@ CONFIG_SND_HDA_CODEC_HDMI=m + CONFIG_SND_SOC=y + CONFIG_SND_BCM2835_SOC_I2S=m + CONFIG_SND_MESON_AXG_SOUND_CARD=m ++CONFIG_SND_MESON_GX_SOUND_CARD=m + CONFIG_SND_SOC_ROCKCHIP=m + CONFIG_SND_SOC_ROCKCHIP_SPDIF=m + CONFIG_SND_SOC_ROCKCHIP_RT5645=m +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0052-FROMGIT-ASoC-codec2codec-deal-with-params-when-neces.patch b/packages/linux/patches/amlogic/amlogic-0052-FROMGIT-ASoC-codec2codec-deal-with-params-when-neces.patch deleted file mode 100644 index 74aadd9033..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0052-FROMGIT-ASoC-codec2codec-deal-with-params-when-neces.patch +++ /dev/null @@ -1,239 +0,0 @@ -From 13435f5cf5d5d2a673de02b5ecb2afa16d8513da Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 25 Jul 2019 18:59:46 +0200 -Subject: [PATCH 052/187] FROMGIT: ASoC: codec2codec: deal with params when - necessary - -When there is an event on codec to codec dai_link, we only need to deal -with params if the event is SND_SOC_DAPM_PRE_PMU, when .hw_params() is -called. For the other events, it is useless. - -Also, dealing with the codec to codec params just before calling -.hw_params() callbacks give change to either party on the link to alter -params content in .startup(), which might be useful in some cases - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190725165949.29699-4-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit 3dcfb397dad2ad55bf50de3c5d5a57090d35a18a - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-dapm.c | 159 +++++++++++++++++++++++++------------------ - 1 file changed, 92 insertions(+), 67 deletions(-) - -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 17286bfec258..be9bb05b0165 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3766,25 +3766,59 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, - } - EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); - --static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, -- struct snd_kcontrol *kcontrol, int event) -+static int -+snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, -+ struct snd_pcm_substream *substream) - { - struct snd_soc_dapm_path *path; - struct snd_soc_dai *source, *sink; -- struct snd_soc_pcm_runtime *rtd = w->priv; -- const struct snd_soc_pcm_stream *config; -- struct snd_pcm_substream substream; -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_pcm_hw_params *params = NULL; -- struct snd_pcm_runtime *runtime = NULL; -+ const struct snd_soc_pcm_stream *config = NULL; - unsigned int fmt; -- int ret = 0; -+ int ret; - -- config = rtd->dai_link->params + rtd->params_select; -+ params = kzalloc(sizeof(*params), GFP_KERNEL); -+ if (!params) -+ return -ENOMEM; - -- if (WARN_ON(!config) || -- WARN_ON(list_empty(&w->edges[SND_SOC_DAPM_DIR_OUT]) || -- list_empty(&w->edges[SND_SOC_DAPM_DIR_IN]))) -- return -EINVAL; -+ substream->stream = SNDRV_PCM_STREAM_CAPTURE; -+ snd_soc_dapm_widget_for_each_source_path(w, path) { -+ source = path->source->priv; -+ -+ ret = snd_soc_dai_startup(source, substream); -+ if (ret < 0) { -+ dev_err(source->dev, -+ "ASoC: startup() failed: %d\n", ret); -+ goto out; -+ } -+ source->active++; -+ } -+ -+ substream->stream = SNDRV_PCM_STREAM_PLAYBACK; -+ snd_soc_dapm_widget_for_each_sink_path(w, path) { -+ sink = path->sink->priv; -+ -+ ret = snd_soc_dai_startup(sink, substream); -+ if (ret < 0) { -+ dev_err(sink->dev, -+ "ASoC: startup() failed: %d\n", ret); -+ goto out; -+ } -+ sink->active++; -+ } -+ -+ /* -+ * Note: getting the config after .startup() gives a chance to -+ * either party on the link to alter the configuration if -+ * necessary -+ */ -+ config = rtd->dai_link->params + rtd->params_select; -+ if (WARN_ON(!config)) { -+ dev_err(w->dapm->dev, "ASoC: link config missing\n"); -+ ret = -EINVAL; -+ goto out; -+ } - - /* Be a little careful as we don't want to overflow the mask array */ - if (config->formats) { -@@ -3792,27 +3826,62 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - } else { - dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", - config->formats); -- fmt = 0; -- } - -- /* Currently very limited parameter selection */ -- params = kzalloc(sizeof(*params), GFP_KERNEL); -- if (!params) { -- ret = -ENOMEM; -+ ret = -EINVAL; - goto out; - } -- snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt); - -+ snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt); - hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min = - config->rate_min; - hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max = - config->rate_max; -- - hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->min - = config->channels_min; - hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max - = config->channels_max; - -+ substream->stream = SNDRV_PCM_STREAM_CAPTURE; -+ snd_soc_dapm_widget_for_each_source_path(w, path) { -+ source = path->source->priv; -+ -+ ret = snd_soc_dai_hw_params(source, substream, params); -+ if (ret < 0) -+ goto out; -+ -+ dapm_update_dai_unlocked(substream, params, source); -+ } -+ -+ substream->stream = SNDRV_PCM_STREAM_PLAYBACK; -+ snd_soc_dapm_widget_for_each_sink_path(w, path) { -+ sink = path->sink->priv; -+ -+ ret = snd_soc_dai_hw_params(sink, substream, params); -+ if (ret < 0) -+ goto out; -+ -+ dapm_update_dai_unlocked(substream, params, sink); -+ } -+ -+out: -+ kfree(params); -+ return 0; -+} -+ -+static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, -+ struct snd_kcontrol *kcontrol, int event) -+{ -+ struct snd_soc_dapm_path *path; -+ struct snd_soc_dai *source, *sink; -+ struct snd_soc_pcm_runtime *rtd = w->priv; -+ struct snd_pcm_substream substream; -+ struct snd_pcm_runtime *runtime = NULL; -+ int ret = 0; -+ -+ if (WARN_ON(list_empty(&w->edges[SND_SOC_DAPM_DIR_OUT]) || -+ list_empty(&w->edges[SND_SOC_DAPM_DIR_IN]))) -+ return -EINVAL; -+ - memset(&substream, 0, sizeof(substream)); - - /* Allocate a dummy snd_pcm_runtime for startup() and other ops() */ -@@ -3826,53 +3895,10 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - - switch (event) { - case SND_SOC_DAPM_PRE_PMU: -- substream.stream = SNDRV_PCM_STREAM_CAPTURE; -- snd_soc_dapm_widget_for_each_source_path(w, path) { -- source = path->source->priv; -- -- ret = snd_soc_dai_startup(source, &substream); -- if (ret < 0) { -- dev_err(source->dev, -- "ASoC: startup() failed: %d\n", ret); -- goto out; -- } -- source->active++; -- } -- -- substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -- snd_soc_dapm_widget_for_each_sink_path(w, path) { -- sink = path->sink->priv; -- -- ret = snd_soc_dai_startup(sink, &substream); -- if (ret < 0) { -- dev_err(sink->dev, -- "ASoC: startup() failed: %d\n", ret); -- goto out; -- } -- sink->active++; -- } -- -- substream.stream = SNDRV_PCM_STREAM_CAPTURE; -- snd_soc_dapm_widget_for_each_source_path(w, path) { -- source = path->source->priv; -- -- ret = snd_soc_dai_hw_params(source, &substream, params); -- if (ret < 0) -- goto out; -- -- dapm_update_dai_unlocked(&substream, params, source); -- } -- -- substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -- snd_soc_dapm_widget_for_each_sink_path(w, path) { -- sink = path->sink->priv; -- -- ret = snd_soc_dai_hw_params(sink, &substream, params); -- if (ret < 0) -- goto out; -+ ret = snd_soc_dai_link_event_pre_pmu(w, &substream); -+ if (ret < 0) -+ goto out; - -- dapm_update_dai_unlocked(&substream, params, sink); -- } - break; - - case SND_SOC_DAPM_POST_PMU: -@@ -3934,7 +3960,6 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - - out: - kfree(runtime); -- kfree(params); - return ret; - } - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch b/packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch new file mode 100644 index 0000000000..6c09bd6338 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch @@ -0,0 +1,35 @@ +From b4d80dcfea159d373f068a0aa74d93183b2aecc0 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 14 Aug 2019 17:28:21 +0200 +Subject: [PATCH 052/146] WIP: arm64: dts: meson: g12a: add internal DAC + +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +index abe04f4ad7d8..4625bdd08c07 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +@@ -250,6 +250,17 @@ + }; + }; + ++ acodec: audio-controller@32000 { ++ compatible = "amlogic,t9015"; ++ reg = <0x0 0x32000 0x0 0x14>; ++ #sound-dai-cells = <0>; ++ sound-name-prefix = "ACODEC"; ++ clocks = <&clkc CLKID_AUDIO_CODEC>; ++ clock-names = "pclk"; ++ resets = <&reset RESET_AUDIO_CODEC>; ++ status = "disabled"; ++ }; ++ + periphs: bus@34400 { + compatible = "simple-bus"; + reg = <0x0 0x34400 0x0 0x400>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0053-FROMGIT-ASoC-meson-g12a-tohdmitx-override-codec2code.patch b/packages/linux/patches/amlogic/amlogic-0053-FROMGIT-ASoC-meson-g12a-tohdmitx-override-codec2code.patch deleted file mode 100644 index 2312d1cd2e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0053-FROMGIT-ASoC-meson-g12a-tohdmitx-override-codec2code.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 63d30e9befbace84cbb24888a8f606b0b9ba48cf Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 29 Jul 2019 10:01:39 +0200 -Subject: [PATCH 053/187] FROMGIT: ASoC: meson: g12a-tohdmitx: override - codec2codec params - -So far, forwarding the hw_params of the input to output relied on the -.hw_params() callback of the cpu side of the codec2codec link to be called -first. This is a bit weak. - -Instead, override the stream params of the codec2codec to link to set it up -correctly. - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190729080139.32068-1-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit 2c4956bc1e9062e5e3c5ea7612294f24e6d4fbdd - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/meson/g12a-tohdmitx.c | 34 ++++++++++++++++----------------- - 1 file changed, 16 insertions(+), 18 deletions(-) - -diff --git a/sound/soc/meson/g12a-tohdmitx.c b/sound/soc/meson/g12a-tohdmitx.c -index 707ccb192e4c..9943c807ec5d 100644 ---- a/sound/soc/meson/g12a-tohdmitx.c -+++ b/sound/soc/meson/g12a-tohdmitx.c -@@ -28,7 +28,7 @@ - #define CTRL0_SPDIF_CLK_SEL BIT(0) - - struct g12a_tohdmitx_input { -- struct snd_pcm_hw_params params; -+ struct snd_soc_pcm_stream params; - unsigned int fmt; - }; - -@@ -225,26 +225,17 @@ static int g12a_tohdmitx_input_hw_params(struct snd_pcm_substream *substream, - { - struct g12a_tohdmitx_input *data = dai->playback_dma_data; - -- /* Save the stream params for the downstream link */ -- memcpy(&data->params, params, sizeof(*params)); -+ data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params)); -+ data->params.rate_min = params_rate(params); -+ data->params.rate_max = params_rate(params); -+ data->params.formats = 1 << params_format(params); -+ data->params.channels_min = params_channels(params); -+ data->params.channels_max = params_channels(params); -+ data->params.sig_bits = dai->driver->playback.sig_bits; - - return 0; - } - --static int g12a_tohdmitx_output_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params, -- struct snd_soc_dai *dai) --{ -- struct g12a_tohdmitx_input *in_data = -- g12a_tohdmitx_get_input_data(dai->capture_widget); -- -- if (!in_data) -- return -ENODEV; -- -- memcpy(params, &in_data->params, sizeof(*params)); -- -- return 0; --} - - static int g12a_tohdmitx_input_set_fmt(struct snd_soc_dai *dai, - unsigned int fmt) -@@ -266,6 +257,14 @@ static int g12a_tohdmitx_output_startup(struct snd_pcm_substream *substream, - if (!in_data) - return -ENODEV; - -+ if (WARN_ON(!rtd->dai_link->params)) { -+ dev_warn(dai->dev, "codec2codec link expected\n"); -+ return -EINVAL; -+ } -+ -+ /* Replace link params with the input params */ -+ rtd->dai_link->params = &in_data->params; -+ - if (!in_data->fmt) - return 0; - -@@ -278,7 +277,6 @@ static const struct snd_soc_dai_ops g12a_tohdmitx_input_ops = { - }; - - static const struct snd_soc_dai_ops g12a_tohdmitx_output_ops = { -- .hw_params = g12a_tohdmitx_output_hw_params, - .startup = g12a_tohdmitx_output_startup, - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0053-WIP-arm64-dts-meson-g12a-add-internal-DAC-glue.patch b/packages/linux/patches/amlogic/amlogic-0053-WIP-arm64-dts-meson-g12a-add-internal-DAC-glue.patch new file mode 100644 index 0000000000..eb7bbf54a8 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0053-WIP-arm64-dts-meson-g12a-add-internal-DAC-glue.patch @@ -0,0 +1,110 @@ +From 779a94302dd774eafa43a9743bebee684308c02b Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 14 Aug 2019 17:28:36 +0200 +Subject: [PATCH 053/146] WIP: arm64: dts: meson: g12a: add internal DAC glue + +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 9 +++++ + sound/soc/meson/g12a-toacodec.c | 42 ++++++++++++++-------- + 2 files changed, 36 insertions(+), 15 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +index 55d39020ec72..0d14409f509c 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +@@ -343,6 +343,15 @@ + status = "disabled"; + }; + ++ toacodec: audio-controller@740 { ++ compatible = "amlogic,g12a-toacodec"; ++ reg = <0x0 0x740 0x0 0x4>; ++ #sound-dai-cells = <1>; ++ sound-name-prefix = "TOACODEC"; ++ resets = <&clkc_audio AUD_RESET_TOACODEC>; ++ status = "disabled"; ++ }; ++ + tohdmitx: audio-controller@744 { + compatible = "amlogic,g12a-tohdmitx"; + reg = <0x0 0x744 0x0 0x4>; +diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c +index 0ee074f6fc87..4e29528a8cb4 100644 +--- a/sound/soc/meson/g12a-toacodec.c ++++ b/sound/soc/meson/g12a-toacodec.c +@@ -21,7 +21,8 @@ + + #define TOACODEC_CTRL0 0x0 + #define CTRL0_ENABLE_SHIFT 31 +-#define CTRL0_DAT_SEL GENMASK(15, 14) ++#define CTRL0_DAT_SEL_SHIFT 14 ++#define CTRL0_DAT_SEL (0x3 << CTRL0_DAT_SEL_SHIFT) + #define CTRL0_LANE_SEL 12 + #define CTRL0_LRCLK_SEL GENMASK(9, 8) + #define CTRL0_BLK_CAP_INV BIT(7) +@@ -35,18 +36,28 @@ static const char * const g12a_toacodec_mux_texts[] = { + "I2S A", "I2S B", "I2S C", + }; + +-static int g12a_toacodec_get_mux(struct snd_soc_component *component) ++static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- unsigned int val; ++ struct snd_soc_component *component = ++ snd_soc_dapm_kcontrol_component(kcontrol); ++ struct snd_soc_dapm_context *dapm = ++ snd_soc_dapm_kcontrol_dapm(kcontrol); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int mux, changed; + +- snd_soc_component_read(component, TOACODEC_CTRL0, &val); +- return FIELD_GET(CTRL0_DAT_SEL, val); +-} ++ mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); ++ changed = snd_soc_component_test_bits(component, e->reg, ++ CTRL0_DAT_SEL, ++ FIELD_PREP(CTRL0_DAT_SEL, mux)); + +-static int g12a_toacodec_put_mux(struct snd_soc_component *component, +- unsigned int mux) +-{ +- snd_soc_component_update_bits(component, TOACODEC_CTRL0, ++ if (!changed) ++ return 0; ++ ++ /* Force disconnect of the mux while updating */ ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); ++ ++ snd_soc_component_update_bits(component, e->reg, + CTRL0_DAT_SEL | + CTRL0_LRCLK_SEL | + CTRL0_BCLK_SEL, +@@ -65,17 +76,18 @@ static int g12a_toacodec_put_mux(struct snd_soc_component *component, + * source. For that, we will need regmap backed clock mux which + * is a work in progress + */ +- snd_soc_component_update_bits(component, TOACODEC_CTRL0, ++ snd_soc_component_update_bits(component, e->reg, + CTRL0_MCLK_SEL, + FIELD_PREP(CTRL0_MCLK_SEL, mux)); + ++ snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ + return 0; + } + +-static MESON_CODEC_GLUE_ENUM_DECL(g12a_toacodec_mux_glue, +- g12a_toacodec_mux_texts, +- g12a_toacodec_get_mux, +- g12a_toacodec_put_mux); ++static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0, ++ CTRL0_DAT_SEL_SHIFT, ++ g12a_toacodec_mux_texts); + + static const struct snd_kcontrol_new g12a_toacodec_mux = + SOC_DAPM_ENUM_EXT("Source", g12a_toacodec_mux_enum, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0054-FROMGIT-ASoC-create-pcm-for-codec2codec-links-as-wel.patch b/packages/linux/patches/amlogic/amlogic-0054-FROMGIT-ASoC-create-pcm-for-codec2codec-links-as-wel.patch deleted file mode 100644 index 47c4af0a2e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0054-FROMGIT-ASoC-create-pcm-for-codec2codec-links-as-wel.patch +++ /dev/null @@ -1,175 +0,0 @@ -From bba4770b8d275534289d48ede37e541d8dd786a2 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 25 Jul 2019 18:59:47 +0200 -Subject: [PATCH 054/187] FROMGIT: ASoC: create pcm for codec2codec links as - well - -At the moment, codec to codec links uses an ephemeral variable for -the struct snd_pcm_substream. Also the struct snd_soc_pcm_runtime -does not have real struct snd_pcm. - -This might a problem if the functions used by a codec on codec to -codec link expect these structures to exist, and keep on existing -during the life of the codec. - -For example, it is the case of the hdmi-codec, which uses -snd_pcm_add_chmap_ctls(). For the controls to works, the pcm and -substream must to exist. - -This change is first step, it create pcm (and substreams) for codec -to codec links, in the same way as dpcm backend links. - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190725165949.29699-5-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit a342031cdd0818cb0fbcb44798211c7a02c7ca27 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-core.c | 42 ++++++++++++------------------------------ - sound/soc/soc-pcm.c | 35 ++++++++++++++++++++++++++++++++--- - 2 files changed, 44 insertions(+), 33 deletions(-) - -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index 33df0dfe29f0..b6ca00b472d6 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -447,16 +447,6 @@ static void snd_soc_flush_all_delayed_work(struct snd_soc_card *card) - flush_delayed_work(&rtd->delayed_work); - } - --static void codec2codec_close_delayed_work(struct work_struct *work) --{ -- /* -- * Currently nothing to do for c2c links -- * Since c2c links are internal nodes in the DAPM graph and -- * don't interface with the outside world or application layer -- * we don't have to do any special handling on close. -- */ --} -- - #ifdef CONFIG_PM_SLEEP - /* powers down audio subsystem for suspend */ - int snd_soc_suspend(struct device *dev) -@@ -1557,27 +1547,19 @@ static int soc_probe_link_dais(struct snd_soc_card *card, - return ret; - } - -- if (!dai_link->params) { -- /* create the pcm */ -- ret = soc_new_pcm(rtd, num); -- if (ret < 0) { -- dev_err(card->dev, "ASoC: can't create pcm %s :%d\n", -- dai_link->stream_name, ret); -- return ret; -- } -- ret = soc_link_dai_pcm_new(&cpu_dai, 1, rtd); -- if (ret < 0) -- return ret; -- ret = soc_link_dai_pcm_new(rtd->codec_dais, -- rtd->num_codecs, rtd); -- if (ret < 0) -- return ret; -- } else { -- INIT_DELAYED_WORK(&rtd->delayed_work, -- codec2codec_close_delayed_work); -+ /* create the pcm */ -+ ret = soc_new_pcm(rtd, num); -+ if (ret < 0) { -+ dev_err(card->dev, "ASoC: can't create pcm %s :%d\n", -+ dai_link->stream_name, ret); -+ return ret; - } -- -- return 0; -+ ret = soc_link_dai_pcm_new(&cpu_dai, 1, rtd); -+ if (ret < 0) -+ return ret; -+ ret = soc_link_dai_pcm_new(rtd->codec_dais, -+ rtd->num_codecs, rtd); -+ return ret; - } - - static int soc_bind_aux_dev(struct snd_soc_card *card, int num) -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index fabeac164a6c..30264bc592f6 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -678,6 +678,16 @@ static void close_delayed_work(struct work_struct *work) - mutex_unlock(&rtd->pcm_mutex); - } - -+static void codec2codec_close_delayed_work(struct work_struct *work) -+{ -+ /* -+ * Currently nothing to do for c2c links -+ * Since c2c links are internal nodes in the DAPM graph and -+ * don't interface with the outside world or application layer -+ * we don't have to do any special handling on close. -+ */ -+} -+ - /* - * Called by ALSA when a PCM substream is closed. Private data can be - * freed here. The cpu DAI, codec DAI, machine and components are also -@@ -3011,6 +3021,12 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) - playback = rtd->dai_link->dpcm_playback; - capture = rtd->dai_link->dpcm_capture; - } else { -+ /* Adapt stream for codec2codec links */ -+ struct snd_soc_pcm_stream *cpu_capture = rtd->dai_link->params ? -+ &cpu_dai->driver->playback : &cpu_dai->driver->capture; -+ struct snd_soc_pcm_stream *cpu_playback = rtd->dai_link->params ? -+ &cpu_dai->driver->capture : &cpu_dai->driver->playback; -+ - for_each_rtd_codec_dai(rtd, i, codec_dai) { - if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && - snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) -@@ -3019,6 +3035,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) - snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) - capture = 1; - } -+ -+ capture = capture && cpu_capture->channels_min; -+ playback = playback && cpu_playback->channels_min; - } - - if (rtd->dai_link->playback_only) { -@@ -3032,7 +3051,13 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) - } - - /* create the PCM */ -- if (rtd->dai_link->no_pcm) { -+ if (rtd->dai_link->params) { -+ snprintf(new_name, sizeof(new_name), "codec2codec(%s)", -+ rtd->dai_link->stream_name); -+ -+ ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, -+ playback, capture, &pcm); -+ } else if (rtd->dai_link->no_pcm) { - snprintf(new_name, sizeof(new_name), "(%s)", - rtd->dai_link->stream_name); - -@@ -3059,13 +3084,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) - dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n",num, new_name); - - /* DAPM dai link stream work */ -- INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); -+ if (rtd->dai_link->params) -+ INIT_DELAYED_WORK(&rtd->delayed_work, -+ codec2codec_close_delayed_work); -+ else -+ INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); - - pcm->nonatomic = rtd->dai_link->nonatomic; - rtd->pcm = pcm; - pcm->private_data = rtd; - -- if (rtd->dai_link->no_pcm) { -+ if (rtd->dai_link->no_pcm || rtd->dai_link->params) { - if (playback) - pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; - if (capture) --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0054-WIP-arm64-dts-meson-u200-add-audio-support.patch b/packages/linux/patches/amlogic/amlogic-0054-WIP-arm64-dts-meson-u200-add-audio-support.patch new file mode 100644 index 0000000000..663afc9e78 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0054-WIP-arm64-dts-meson-u200-add-audio-support.patch @@ -0,0 +1,351 @@ +From 85599505da66a3e8fc0b16653d3bec82c21f2c79 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 18 Mar 2019 13:46:06 +0100 +Subject: [PATCH 054/146] WIP: arm64: dts: meson: u200: add audio support + +Signed-off-by: Jerome Brunet +--- + .../boot/dts/amlogic/meson-g12a-u200.dts | 292 ++++++++++++++++++ + 1 file changed, 292 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts +index 2a324f0136e3..0dc2476185c0 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts +@@ -8,6 +8,8 @@ + #include "meson-g12a.dtsi" + #include + #include ++#include ++#include + + / { + compatible = "amlogic,u200", "amlogic,g12a"; +@@ -18,6 +20,20 @@ + ethernet0 = ðmac; + }; + ++ dioo2133: audio-amplifier-0 { ++ compatible = "simple-audio-amplifier"; ++ enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; ++ VCC-supply = <&vcc_5v>; ++ sound-name-prefix = "10U2"; ++ }; ++ ++ spdif_dit: audio-codec-1 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +@@ -147,6 +163,182 @@ + regulator-boot-on; + regulator-always-on; + }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "G12A-U200"; ++ audio-aux-devs = <&tdmout_a>, <&tdmout_b>, <&tdmout_c>, ++ <&tdmin_a>, <&tdmin_b>, <&tdmin_c>, ++ <&tdmin_lb>, <&dioo2133>; ++ audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0", ++ "TDMOUT_A IN 1", "FRDDR_B OUT 0", ++ "TDMOUT_A IN 2", "FRDDR_C OUT 0", ++ "TDM_A Playback", "TDMOUT_A OUT", ++ "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", ++ "TDMIN_A IN 0", "TDM_A Capture", ++ "TDMIN_A IN 1", "TDM_B Capture", ++ "TDMIN_A IN 3", "TDM_A Loopback", ++ "TDMIN_A IN 4", "TDM_B Loopback", ++ "TDMIN_B IN 0", "TDM_A Capture", ++ "TDMIN_B IN 1", "TDM_B Capture", ++ "TDMIN_B IN 3", "TDM_A Loopback", ++ "TDMIN_B IN 4", "TDM_B Loopback", ++ "TDMIN_C IN 0", "TDM_A Capture", ++ "TDMIN_C IN 1", "TDM_B Capture", ++ "TDMIN_C IN 3", "TDM_A Loopback", ++ "TDMIN_C IN 4", "TDM_B Loopback", ++ "TDMIN_LB IN 3", "TDM_A Capture", ++ "TDMIN_LB IN 4", "TDM_B Capture", ++ "TDMIN_LB IN 0", "TDM_A Loopback", ++ "TDMIN_LB IN 1", "TDM_B 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", ++ "10U2 INL", "ACODEC LOLP", ++ "10U2 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>; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&toddr_a>; ++ }; ++ ++ dai-link-4 { ++ sound-dai = <&toddr_b>; ++ }; ++ ++ dai-link-5 { ++ sound-dai = <&toddr_c>; ++ }; ++ ++ dai-link-6 { ++ sound-dai = <&tdmif_b>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec@0 { ++ sound-dai = <&toacodec TOACODEC_IN_B>; ++ }; ++ ++ codec@1 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; ++ }; ++ }; ++ ++ dai-link-7 { ++ sound-dai = <&tdmif_a>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec@0 { ++ sound-dai = <&toacodec TOACODEC_IN_A>; ++ }; ++ ++ codec@1 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>; ++ }; ++ }; ++ ++ dai-link-8 { ++ sound-dai = <&tdmif_c>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec@0 { ++ sound-dai = <&toacodec TOACODEC_IN_C>; ++ }; ++ ++ codec@1 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>; ++ }; ++ }; ++ ++ dai-link-9 { ++ sound-dai = <&spdifout>; ++ ++ codec@0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ ++ codec@1 { ++ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>; ++ }; ++ }; ++ ++ dai-link-10 { ++ sound-dai = <&spdifout_b>; ++ ++ codec { ++ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>; ++ }; ++ }; ++ ++ dai-link-11 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; ++ ++ codec { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-12 { ++ sound-dai = <&toacodec TOACODEC_OUT>; ++ ++ codec { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ status = "okay"; ++}; ++ ++&arb { ++ status = "okay"; + }; + + &cec_AO { +@@ -191,6 +383,10 @@ + clock-latency = <50000>; + }; + ++&clkc_audio { ++ status = "okay"; ++}; ++ + &cvbs_vdac_port { + cvbs_vdac_out: endpoint { + remote-endpoint = <&cvbs_connector_in>; +@@ -203,6 +399,18 @@ + phy-mode = "rmii"; + }; + ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ + &hdmi_tx { + status = "okay"; + pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; +@@ -288,6 +496,90 @@ + vqmmc-supply = <&flash_1v8>; + }; + ++&spdifout { ++ pinctrl-0 = <&spdif_ao_out_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&spdifout_b { ++ status = "okay"; ++}; ++ ++&tdmif_a { ++ pinctrl-0 = <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>, <&tdm_a_dout0_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"; ++}; ++ ++&tdmin_a { ++ inctrl-0 = <&tdm_a_dout0_pins>, <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>; ++ status = "okay"; ++}; ++ ++&tdmin_b { ++ status = "okay"; ++}; ++ ++&tdmin_c { ++ status = "okay"; ++}; ++ ++&tdmin_lb { ++ status = "okay"; ++}; ++ ++&tdmout_a { ++ status = "okay"; ++}; ++ ++&tdmout_b { ++ status = "okay"; ++}; ++ ++&tdmout_c { ++ status = "okay"; ++}; ++ ++&toacodec { ++ status = "okay"; ++}; ++ ++&toddr_a { ++ status = "okay"; ++}; ++ ++&toddr_b { ++ status = "okay"; ++}; ++ ++&toddr_c { ++ status = "okay"; ++}; ++ ++&tohdmitx { ++ status = "okay"; ++}; ++ + &uart_AO { + status = "okay"; + pinctrl-0 = <&uart_ao_a_pins>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0055-FROMGIT-ASoC-codec2codec-fix-missing-return-of-error.patch b/packages/linux/patches/amlogic/amlogic-0055-FROMGIT-ASoC-codec2codec-fix-missing-return-of-error.patch deleted file mode 100644 index 5c82c56a34..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0055-FROMGIT-ASoC-codec2codec-fix-missing-return-of-error.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 3d83acfe68fb983cf3ef5d7b4990e1fe99a688d8 Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Fri, 26 Jul 2019 13:33:27 +0100 -Subject: [PATCH 055/187] FROMGIT: ASoC: codec2codec: fix missing return of - error return code - -Currently in function snd_soc_dai_link_event_pre_pmu the error return -code in variable err is being set but this is not actually being returned, -the function just returns zero even when there are failures. Fix this by -returning the error return code. - -Addresses-Coverity: ("Unused value") -Fixes: 3dcfb397dad2 ("ASoC: codec2codec: deal with params when necessary") -Signed-off-by: Colin Ian King -Link: https://lore.kernel.org/r/20190726123327.10467-1-colin.king@canonical.com -Signed-off-by: Mark Brown -(cherry picked from commit c8415833ec242b9ddf73bf9e1057e12f9b0fcd16 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-dapm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index be9bb05b0165..2d183e2d23de 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3776,7 +3776,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - struct snd_pcm_hw_params *params = NULL; - const struct snd_soc_pcm_stream *config = NULL; - unsigned int fmt; -- int ret; -+ int ret = 0; - - params = kzalloc(sizeof(*params), GFP_KERNEL); - if (!params) -@@ -3865,7 +3865,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - - out: - kfree(params); -- return 0; -+ return ret; - } - - static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0055-WIP-arm64-dts-meson-gx-add-playback-audio-devices.patch b/packages/linux/patches/amlogic/amlogic-0055-WIP-arm64-dts-meson-gx-add-playback-audio-devices.patch new file mode 100644 index 0000000000..4410640308 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0055-WIP-arm64-dts-meson-gx-add-playback-audio-devices.patch @@ -0,0 +1,99 @@ +From defec385aa0888d28eabba06d625fb3104c0917a Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 22 Oct 2019 18:15:43 +0200 +Subject: [PATCH 055/146] WIP: arm64: dts: meson-gx: add playback audio devices + +FIXME: Missing gxbb ATM + +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 13 +++++++++ + arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 34 ++++++++++++++++++++++ + 2 files changed, 47 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +index 40db06e28b66..962a56e0e8b4 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +@@ -226,6 +226,17 @@ + #reset-cells = <1>; + }; + ++ aiu: audio-controller@5400 { ++ compatible = "amlogic,aiu"; ++ #sound-dai-cells = <2>; ++ sound-name-prefix = "AIU"; ++ reg = <0x0 0x5400 0x0 0x2ac>; ++ interrupts = , ++ ; ++ interrupt-names = "i2s", "spdif"; ++ status = "disabled"; ++ }; ++ + uart_A: serial@84c0 { + compatible = "amlogic,meson-gx-uart"; + reg = <0x0 0x84c0 0x0 0x18>; +@@ -574,6 +585,8 @@ + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ sound-name-prefix = "HDMITX"; + status = "disabled"; + + /* VPU VENC Input */ +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +index 259d86399390..ec50e93470f9 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +@@ -14,6 +14,17 @@ + compatible = "amlogic,meson-gxl"; + + soc { ++ acodec: audio-controller@c8832000 { ++ compatible = "amlogic,t9015"; ++ reg = <0x0 0xc8832000 0x0 0x14>; ++ #sound-dai-cells = <0>; ++ sound-name-prefix = "ACODEC"; ++ clocks = <&clkc CLKID_ACODEC>; ++ clock-names = "pclk"; ++ resets = <&reset RESET_ACODEC>; ++ status = "disabled"; ++ }; ++ + usb0: usb@c9000000 { + status = "disabled"; + compatible = "amlogic,meson-gxl-dwc3"; +@@ -49,6 +60,29 @@ + }; + }; + ++&aiu { ++ compatible = "amlogic,aiu-gxl", "amlogic,aiu"; ++ clocks = <&clkc CLKID_AIU_GLUE>, ++ <&clkc CLKID_I2S_OUT>, ++ <&clkc CLKID_AOCLK_GATE>, ++ <&clkc CLKID_CTS_AMCLK>, ++ <&clkc CLKID_MIXER_IFACE>, ++ <&clkc CLKID_IEC958>, ++ <&clkc CLKID_IEC958_GATE>, ++ <&clkc CLKID_CTS_MCLK_I958>, ++ <&clkc CLKID_CTS_I958>; ++ clock-names = "pclk", ++ "i2s_pclk", ++ "i2s_aoclk", ++ "i2s_mclk", ++ "i2s_mixer", ++ "spdif_pclk", ++ "spdif_aoclk", ++ "spdif_mclk", ++ "spdif_mclk_sel"; ++ resets = <&reset RESET_AIU>; ++}; ++ + &apb { + usb2_phy0: phy@78000 { + compatible = "amlogic,meson-gxl-usb2-phy"; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0056-FROMGIT-ASoC-codec2codec-remove-ephemeral-variables.patch b/packages/linux/patches/amlogic/amlogic-0056-FROMGIT-ASoC-codec2codec-remove-ephemeral-variables.patch deleted file mode 100644 index f07923f007..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0056-FROMGIT-ASoC-codec2codec-remove-ephemeral-variables.patch +++ /dev/null @@ -1,217 +0,0 @@ -From 59b70c5b4c396d4cadac48cbca59c01bc225ab06 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 25 Jul 2019 18:59:48 +0200 -Subject: [PATCH 056/187] FROMGIT: ASoC: codec2codec: remove ephemeral - variables - -Now that codec to codec links struct snd_soc_pcm_runtime have lasting pcm -and substreams, let's use them. Alsa allocate and keep the -struct snd_pcm_runtime as long as the link is powered. - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190725165949.29699-6-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit a72706ed8208ac3f72d1c3ebbc6509e368b0dcb0 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-dapm.c | 72 ++++++++++++++++++++++++++------------------ - 1 file changed, 42 insertions(+), 30 deletions(-) - -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 2d183e2d23de..1c953a1b46ce 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3775,6 +3775,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_pcm_hw_params *params = NULL; - const struct snd_soc_pcm_stream *config = NULL; -+ struct snd_pcm_runtime *runtime = NULL; - unsigned int fmt; - int ret = 0; - -@@ -3782,6 +3783,14 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - if (!params) - return -ENOMEM; - -+ runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); -+ if (!runtime) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ substream->runtime = runtime; -+ - substream->stream = SNDRV_PCM_STREAM_CAPTURE; - snd_soc_dapm_widget_for_each_source_path(w, path) { - source = path->source->priv; -@@ -3808,6 +3817,8 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - sink->active++; - } - -+ substream->hw_opened = 1; -+ - /* - * Note: getting the config after .startup() gives a chance to - * either party on the link to alter the configuration if -@@ -3864,6 +3875,9 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - } - - out: -+ if (ret < 0) -+ kfree(runtime); -+ - kfree(params); - return ret; - } -@@ -3873,29 +3887,16 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - { - struct snd_soc_dapm_path *path; - struct snd_soc_dai *source, *sink; -- struct snd_soc_pcm_runtime *rtd = w->priv; -- struct snd_pcm_substream substream; -- struct snd_pcm_runtime *runtime = NULL; -- int ret = 0; -+ struct snd_pcm_substream *substream = w->priv; -+ int ret = 0, saved_stream = substream->stream; - - if (WARN_ON(list_empty(&w->edges[SND_SOC_DAPM_DIR_OUT]) || - list_empty(&w->edges[SND_SOC_DAPM_DIR_IN]))) - return -EINVAL; - -- memset(&substream, 0, sizeof(substream)); -- -- /* Allocate a dummy snd_pcm_runtime for startup() and other ops() */ -- runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); -- if (!runtime) { -- ret = -ENOMEM; -- goto out; -- } -- substream.runtime = runtime; -- substream.private_data = rtd; -- - switch (event) { - case SND_SOC_DAPM_PRE_PMU: -- ret = snd_soc_dai_link_event_pre_pmu(w, &substream); -+ ret = snd_soc_dai_link_event_pre_pmu(w, substream); - if (ret < 0) - goto out; - -@@ -3926,40 +3927,45 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - ret = 0; - } - -- substream.stream = SNDRV_PCM_STREAM_CAPTURE; -+ substream->stream = SNDRV_PCM_STREAM_CAPTURE; - snd_soc_dapm_widget_for_each_source_path(w, path) { - source = path->source->priv; -- snd_soc_dai_hw_free(source, &substream); -+ snd_soc_dai_hw_free(source, substream); - } - -- substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -+ substream->stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_soc_dapm_widget_for_each_sink_path(w, path) { - sink = path->sink->priv; -- snd_soc_dai_hw_free(sink, &substream); -+ snd_soc_dai_hw_free(sink, substream); - } - -- substream.stream = SNDRV_PCM_STREAM_CAPTURE; -+ substream->stream = SNDRV_PCM_STREAM_CAPTURE; - snd_soc_dapm_widget_for_each_source_path(w, path) { - source = path->source->priv; - source->active--; -- snd_soc_dai_shutdown(source, &substream); -+ snd_soc_dai_shutdown(source, substream); - } - -- substream.stream = SNDRV_PCM_STREAM_PLAYBACK; -+ substream->stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_soc_dapm_widget_for_each_sink_path(w, path) { - sink = path->sink->priv; - sink->active--; -- snd_soc_dai_shutdown(sink, &substream); -+ snd_soc_dai_shutdown(sink, substream); - } - break; - -+ case SND_SOC_DAPM_POST_PMD: -+ kfree(substream->runtime); -+ break; -+ - default: - WARN(1, "Unknown event %d\n", event); - ret = -EINVAL; - } - - out: -- kfree(runtime); -+ /* Restore the substream direction */ -+ substream->stream = saved_stream; - return ret; - } - -@@ -4082,9 +4088,11 @@ snd_soc_dapm_alloc_kcontrol(struct snd_soc_card *card, - } - - static struct snd_soc_dapm_widget * --snd_soc_dapm_new_dai(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd, -+snd_soc_dapm_new_dai(struct snd_soc_card *card, -+ struct snd_pcm_substream *substream, - char *id) - { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dapm_widget template; - struct snd_soc_dapm_widget *w; - const char **w_param_text; -@@ -4103,7 +4111,7 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd, - template.name = link_name; - template.event = snd_soc_dai_link_event; - template.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | -- SND_SOC_DAPM_PRE_PMD; -+ SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD; - template.kcontrol_news = NULL; - - /* allocate memory for control, only in case of multiple configs */ -@@ -4138,7 +4146,7 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd, - goto outfree_kcontrol_news; - } - -- w->priv = rtd; -+ w->priv = substream; - - return w; - -@@ -4260,6 +4268,8 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, - struct snd_soc_dai *codec_dai; - struct snd_soc_dapm_widget *playback = NULL, *capture = NULL; - struct snd_soc_dapm_widget *codec, *playback_cpu, *capture_cpu; -+ struct snd_pcm_substream *substream; -+ struct snd_pcm_str *streams = rtd->pcm->streams; - int i; - - if (rtd->dai_link->params) { -@@ -4278,7 +4288,8 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, - - if (playback_cpu && codec) { - if (!playback) { -- playback = snd_soc_dapm_new_dai(card, rtd, -+ substream = streams[SNDRV_PCM_STREAM_PLAYBACK].substream; -+ playback = snd_soc_dapm_new_dai(card, substream, - "playback"); - if (IS_ERR(playback)) { - dev_err(rtd->dev, -@@ -4307,7 +4318,8 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, - - if (codec && capture_cpu) { - if (!capture) { -- capture = snd_soc_dapm_new_dai(card, rtd, -+ substream = streams[SNDRV_PCM_STREAM_CAPTURE].substream; -+ capture = snd_soc_dapm_new_dai(card, substream, - "capture"); - if (IS_ERR(capture)) { - dev_err(rtd->dev, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0056-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch b/packages/linux/patches/amlogic/amlogic-0056-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch new file mode 100644 index 0000000000..b6417a9061 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0056-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch @@ -0,0 +1,133 @@ +From 64aac584dd1297321a2068586e026a2ef268ed11 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 22 Oct 2019 18:18:32 +0200 +Subject: [PATCH 056/146] WIP: arm64: dts: meson: enable audio playback on + p230/q200 + +Signed-off-by: Jerome Brunet +--- + .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 95 +++++++++++++++++++ + 1 file changed, 95 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +index 12d5e333e5f2..f294430d6b19 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +@@ -8,12 +8,28 @@ + * the pin-compatible S912 (GXM) or S905D (GXL) SoCs. + */ + ++#include ++ + / { + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; + }; + ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&hdmi_5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +@@ -102,6 +118,85 @@ + }; + }; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GX-P230-Q200"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Line", "Lineout"; ++ audio-routing = "AU2 INL", "ACODEC LOLP", ++ "AU2 INR", "ACODEC LORP", ++ "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "Lineout", "AU2 OUTL", ++ "Lineout", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ ++ dai-link-4 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-5 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_h_pins>; ++ pinctrl-names = "default"; ++ + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0057-FROMGIT-ASoC-codec2codec-fill-some-of-the-runtime-st.patch b/packages/linux/patches/amlogic/amlogic-0057-FROMGIT-ASoC-codec2codec-fill-some-of-the-runtime-st.patch deleted file mode 100644 index 90cba21cbb..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0057-FROMGIT-ASoC-codec2codec-fill-some-of-the-runtime-st.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 677c9dc33dad71407a839e9a77f2b05a27e8bba8 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 25 Jul 2019 18:59:49 +0200 -Subject: [PATCH 057/187] FROMGIT: ASoC: codec2codec: fill some of the runtime - stream parameters - -Set the information provided struct snd_soc_pcm_stream in the -struct snd_pcm_runtime of the codec to codec link. - -Signed-off-by: Jerome Brunet -Link: https://lore.kernel.org/r/20190725165949.29699-7-jbrunet@baylibre.com -Signed-off-by: Mark Brown -(cherry picked from commit 9de98628c895d15427138073986eab1e3ce39cb4 - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4) -Signed-off-by: Neil Armstrong ---- - sound/soc/soc-dapm.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 1c953a1b46ce..e16838e1bda2 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -3874,6 +3874,11 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - dapm_update_dai_unlocked(substream, params, sink); - } - -+ runtime->format = params_format(params); -+ runtime->subformat = params_subformat(params); -+ runtime->channels = params_channels(params); -+ runtime->rate = params_rate(params); -+ - out: - if (ret < 0) - kfree(runtime); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch b/packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch new file mode 100644 index 0000000000..a2263811cb --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch @@ -0,0 +1,109 @@ +From ac340ffa549b6b52fd3d942bd9815e80ba8e0c12 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 22 Oct 2019 18:19:43 +0200 +Subject: [PATCH 057/146] WIP: arm64: dts: meson: add libretech cc s905x audio + playback + +Signed-off-by: Jerome Brunet +--- + .../amlogic/meson-gxl-s905x-libretech-cc.dts | 70 +++++++++++++++++++ + 1 file changed, 70 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +index e8348b2728db..7184bf509e82 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +@@ -8,6 +8,7 @@ + /dts-v1/; + + #include ++#include + + #include "meson-gxl-s905x.dtsi" + +@@ -21,6 +22,13 @@ + ethernet0 = ðmac; + }; + ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&hdmi_5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +@@ -124,6 +132,68 @@ + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_3v3>; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-LIBRETECH-S905X-CC"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Line", "Lineout"; ++ audio-routing = "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "Lineout", "AU2 OUTL", ++ "Lineout", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0058-FROMGIT-drm-meson-mask-value-when-writing-bits-relax.patch b/packages/linux/patches/amlogic/amlogic-0058-FROMGIT-drm-meson-mask-value-when-writing-bits-relax.patch deleted file mode 100644 index 0c05378312..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0058-FROMGIT-drm-meson-mask-value-when-writing-bits-relax.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 02944405ce58586a746cdad6cf878bdf22f113ad Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:47:56 +0200 -Subject: [PATCH 058/187] FROMGIT: drm: meson: mask value when writing bits - relaxed - -The value used in the macro writel_bits_relaxed has to be masked since -we don't want change the bits outside the mask. - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86y31r82fo.fsf@baylibre.com -(cherry picked from commit f237bf2de82eafd224eb981c6c0bca8a9e039af6 - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_registers.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index 410e324d6f93..2e6537a21bc4 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -10,7 +10,7 @@ - #define _REG(reg) ((reg) << 2) - - #define writel_bits_relaxed(mask, val, addr) \ -- writel_relaxed((readl_relaxed(addr) & ~(mask)) | (val), addr) -+ writel_relaxed((readl_relaxed(addr) & ~(mask)) | ((val) & (mask)), addr) - - /* vpp2 */ - #define VPP2_DUMMY_DATA 0x1900 --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch b/packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch new file mode 100644 index 0000000000..0045a88b8c --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch @@ -0,0 +1,109 @@ +From 382ebdffe4fe718f903578f875884f4112264186 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 4 Dec 2019 17:05:49 +0100 +Subject: [PATCH 058/146] WIP: arm64: dts: meson: add libretech ac s805x audio + playback + +Signed-off-by: Jerome Brunet +--- + .../amlogic/meson-gxl-s805x-libretech-ac.dts | 70 +++++++++++++++++++ + 1 file changed, 70 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts +index 4d5949496596..fa333fe4d968 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts +@@ -8,6 +8,7 @@ + /dts-v1/; + + #include ++#include + + #include "meson-gxl-s905x.dtsi" + +@@ -97,6 +98,15 @@ + regulator-always-on; + }; + ++ vddio_ao18: regulator-vddio_ao18 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDIO_AO18"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_3v3>; ++ regulator-always-on; ++ }; ++ + vddio_boot: regulator-vddio_boot { + compatible = "regulator-fixed"; + regulator-name = "VDDIO_BOOT"; +@@ -105,6 +115,66 @@ + vin-supply = <&vcc_3v3>; + regulator-always-on; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-LIBRETECH-S805X-AC"; ++ audio-widgets = "Speaker", "9J5-3 LEFT", ++ "Speaker", "9J5-2 RIGHT"; ++ audio-routing = "9J5-3 LEFT", "ACODEC LOLN", ++ "9J5-2 RIGHT", "ACODEC LORN"; ++ 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0059-FROMGIT-drm-meson-crtc-use-proper-macros-instead-of-.patch b/packages/linux/patches/amlogic/amlogic-0059-FROMGIT-drm-meson-crtc-use-proper-macros-instead-of-.patch deleted file mode 100644 index 36b85be591..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0059-FROMGIT-drm-meson-crtc-use-proper-macros-instead-of-.patch +++ /dev/null @@ -1,94 +0,0 @@ -From c7ef88d28cf2fa50a696fd8a4904ea86caa83581 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:48:12 +0200 -Subject: [PATCH 059/187] FROMGIT: drm: meson: crtc: use proper macros instead - of magic constants - -This patch add new macros which describe couple bits field of the -following registers: -- VD1_BLEND_SRC_CTRL -- VPP_SC_MISC - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86wohb82fa.fsf@baylibre.com -(cherry picked from commit 39bf9985b8598f20a3bf49844d2ac538a0d5697f - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_crtc.c | 17 +++++++++++------ - drivers/gpu/drm/meson/meson_registers.h | 16 ++++++++++++++++ - 2 files changed, 27 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c -index aa8ea107524e..6f7d6d258615 100644 ---- a/drivers/gpu/drm/meson/meson_crtc.c -+++ b/drivers/gpu/drm/meson/meson_crtc.c -@@ -267,11 +267,11 @@ static void meson_crtc_enable_vd1(struct meson_drm *priv) - - static void meson_g12a_crtc_enable_vd1(struct meson_drm *priv) - { -- writel_relaxed(((1 << 16) | /* post bld premult*/ -- (1 << 8) | /* post src */ -- (1 << 4) | /* pre bld premult*/ -- (1 << 0)), -- priv->io_base + _REG(VD1_BLEND_SRC_CTRL)); -+ writel_relaxed(VD_BLEND_PREBLD_SRC_VD1 | -+ VD_BLEND_PREBLD_PREMULT_EN | -+ VD_BLEND_POSTBLD_SRC_VD1 | -+ VD_BLEND_POSTBLD_PREMULT_EN, -+ priv->io_base + _REG(VD1_BLEND_SRC_CTRL)); - } - - void meson_crtc_irq(struct meson_drm *priv) -@@ -489,7 +489,12 @@ void meson_crtc_irq(struct meson_drm *priv) - writel_relaxed(priv->viu.vd1_range_map_cr, - priv->io_base + meson_crtc->viu_offset + - _REG(VD1_IF0_RANGE_MAP_CR)); -- writel_relaxed(0x78404, -+ writel_relaxed(VPP_VSC_BANK_LENGTH(4) | -+ VPP_HSC_BANK_LENGTH(4) | -+ VPP_SC_VD_EN_ENABLE | -+ VPP_SC_TOP_EN_ENABLE | -+ VPP_SC_HSC_EN_ENABLE | -+ VPP_SC_VSC_EN_ENABLE, - priv->io_base + _REG(VPP_SC_MISC)); - writel_relaxed(priv->viu.vpp_pic_in_height, - priv->io_base + _REG(VPP_PIC_IN_HEIGHT)); -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index 2e6537a21bc4..da31f22fed65 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -360,6 +360,12 @@ - #define VPP_HSC_REGION4_PHASE_SLOPE 0x1d17 - #define VPP_HSC_PHASE_CTRL 0x1d18 - #define VPP_SC_MISC 0x1d19 -+#define VPP_SC_VD_EN_ENABLE BIT(15) -+#define VPP_SC_TOP_EN_ENABLE BIT(16) -+#define VPP_SC_HSC_EN_ENABLE BIT(17) -+#define VPP_SC_VSC_EN_ENABLE BIT(18) -+#define VPP_VSC_BANK_LENGTH(length) (length & 0x7) -+#define VPP_HSC_BANK_LENGTH(length) ((length & 0x7) << 8) - #define VPP_PREBLEND_VD1_H_START_END 0x1d1a - #define VPP_PREBLEND_VD1_V_START_END 0x1d1b - #define VPP_POSTBLEND_VD1_H_START_END 0x1d1c -@@ -1628,6 +1634,16 @@ - #define VPP_SLEEP_CTRL 0x1dfa - #define VD1_BLEND_SRC_CTRL 0x1dfb - #define VD2_BLEND_SRC_CTRL 0x1dfc -+#define VD_BLEND_PREBLD_SRC_VD1 (1 << 0) -+#define VD_BLEND_PREBLD_SRC_VD2 (2 << 0) -+#define VD_BLEND_PREBLD_SRC_OSD1 (3 << 0) -+#define VD_BLEND_PREBLD_SRC_OSD2 (4 << 0) -+#define VD_BLEND_PREBLD_PREMULT_EN BIT(4) -+#define VD_BLEND_POSTBLD_SRC_VD1 (1 << 8) -+#define VD_BLEND_POSTBLD_SRC_VD2 (2 << 8) -+#define VD_BLEND_POSTBLD_SRC_OSD1 (3 << 8) -+#define VD_BLEND_POSTBLD_SRC_OSD2 (4 << 8) -+#define VD_BLEND_POSTBLD_PREMULT_EN BIT(16) - #define OSD1_BLEND_SRC_CTRL 0x1dfd - #define OSD2_BLEND_SRC_CTRL 0x1dfe - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0059-WIP-arm64-dts-meson-add-sound-support-to-the-librete.patch b/packages/linux/patches/amlogic/amlogic-0059-WIP-arm64-dts-meson-add-sound-support-to-the-librete.patch new file mode 100644 index 0000000000..18e322971c --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0059-WIP-arm64-dts-meson-add-sound-support-to-the-librete.patch @@ -0,0 +1,127 @@ +From 75ba992dc1dfd9a186c71c92741e26bdd4043117 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 17 Dec 2019 11:05:36 +0100 +Subject: [PATCH 059/146] WIP: arm64: dts: meson: add sound support to the + libretech-pc + +Add HDMI sound support on the libretech PC form factor + +Signed-off-by: Jerome Brunet +--- + .../dts/amlogic/meson-gx-libretech-pc.dtsi | 79 +++++++++++++++++++ + 1 file changed, 79 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi +index 248b018c83d5..c8a1d97f146d 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi +@@ -8,6 +8,7 @@ + + #include + #include ++#include + + / { + adc-keys { +@@ -29,6 +30,13 @@ + spi0 = &spifc; + }; + ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&vcc5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +@@ -175,6 +183,69 @@ + regulator-settling-time-up-us = <200>; + regulator-settling-time-down-us = <50000>; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-LIBRETECH-S9XX-PC"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Speaker", "7J4-14 LEFT", ++ "Speaker", "7J4-11 RIGHT"; ++ audio-routing = "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "7J4-14 LEFT", "AU2 OUTL", ++ "7J4-11 RIGHT", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cec_AO { +@@ -211,6 +282,14 @@ + }; + }; + ++&acodec { ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; ++}; ++ + &pinctrl_periphs { + /* + * Make sure the reset pin of the usb HUB is driven high to take +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0060-FROMGIT-drm-meson-drv-use-macro-when-initializing-vp.patch b/packages/linux/patches/amlogic/amlogic-0060-FROMGIT-drm-meson-drv-use-macro-when-initializing-vp.patch deleted file mode 100644 index 5f36c7995c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0060-FROMGIT-drm-meson-drv-use-macro-when-initializing-vp.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 01cf6811716dcbd183d7564778f0031e680e8a73 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:48:27 +0200 -Subject: [PATCH 060/187] FROMGIT: drm: meson: drv: use macro when initializing - vpu - -This patch add new macro which is used to set WRARB/RDARB mode of -the VPU. - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86v9wv82f1.fsf@baylibre.com -(cherry picked from commit bfb86819829e5ed5eaba4b9449ecfe6db4f9f91e - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_drv.c | 26 +++++++++++++++++++++---- - drivers/gpu/drm/meson/meson_registers.h | 1 + - 2 files changed, 23 insertions(+), 4 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c -index 2310c96fff46..50096697adc3 100644 ---- a/drivers/gpu/drm/meson/meson_drv.c -+++ b/drivers/gpu/drm/meson/meson_drv.c -@@ -149,10 +149,28 @@ static struct regmap_config meson_regmap_config = { - - static void meson_vpu_init(struct meson_drm *priv) - { -- writel_relaxed(0x210000, priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); -- writel_relaxed(0x10000, priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); -- writel_relaxed(0x900000, priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); -- writel_relaxed(0x20000, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); -+ u32 value; -+ -+ /* -+ * Slave dc0 and dc5 connected to master port 1. -+ * By default other slaves are connected to master port 0. -+ */ -+ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1) | -+ VPU_RDARB_SLAVE_TO_MASTER_PORT(5, 1); -+ writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); -+ -+ /* Slave dc0 connected to master port 1 */ -+ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1); -+ writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); -+ -+ /* Slave dc4 and dc7 connected to master port 1 */ -+ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(4, 1) | -+ VPU_RDARB_SLAVE_TO_MASTER_PORT(7, 1); -+ writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); -+ -+ /* Slave dc1 connected to master port 1 */ -+ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(1, 1); -+ writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); - } - - static void meson_remove_framebuffers(void) -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index da31f22fed65..1c3825978e28 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -1486,6 +1486,7 @@ - #define VPU_RDARB_MODE_L1C2 0x2799 - #define VPU_RDARB_MODE_L2C1 0x279d - #define VPU_WRARB_MODE_L2C1 0x27a2 -+#define VPU_RDARB_SLAVE_TO_MASTER_PORT(dc, port) (port << (16 + dc)) - - /* osd super scale */ - #define OSDSR_HV_SIZEIN 0x3130 --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch b/packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch new file mode 100644 index 0000000000..7ee7ed5e3e --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch @@ -0,0 +1,109 @@ +From 17a05478590bd50ba98fbecccdeac66b9c100972 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 18 Feb 2020 03:54:58 +0000 +Subject: [PATCH 060/146] WIP: arm64: dts: meson: add audio playback to + s905x-p212 dtsi + +Signed-off-by: Christian Hewitt +--- + .../dts/amlogic/meson-gxl-s905x-p212.dtsi | 70 +++++++++++++++++++ + 1 file changed, 70 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +index 43eb7d149e36..ba74f54c5b3f 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +@@ -11,6 +11,7 @@ + /* Common DTSI for devices which are based on the P212 reference board. */ + + #include "meson-gxl-s905x.dtsi" ++#include + + / { + aliases { +@@ -23,6 +24,13 @@ + stdout-path = "serial0:115200n8"; + }; + ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&hdmi_5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x80000000>; +@@ -86,6 +94,68 @@ + clocks = <&wifi32k>; + clock-names = "ext_clock"; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-S905X-P212"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Line", "Lineout"; ++ audio-routing = "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "Lineout", "AU2 OUTL", ++ "Lineout", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + ðmac { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0061-FROMGIT-drm-meson-vpp-use-proper-macros-instead-of-m.patch b/packages/linux/patches/amlogic/amlogic-0061-FROMGIT-drm-meson-vpp-use-proper-macros-instead-of-m.patch deleted file mode 100644 index 929f040e87..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0061-FROMGIT-drm-meson-vpp-use-proper-macros-instead-of-m.patch +++ /dev/null @@ -1,145 +0,0 @@ -From b4b285a0d192a96092108850ca9a1634e03a5045 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:48:35 +0200 -Subject: [PATCH 061/187] FROMGIT: drm: meson: vpp: use proper macros instead - of magic constants - -This patch add new macros which are used to set the following -registers: -- VPP_OSD_SCALE_COEF_IDX -- VPP_DOLBY_CTRL -- VPP_OFIFO_SIZE -- VPP_HOLD_LINES -- VPP_SC_MISC -- VPP_VADJ_CTRL - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -[narmstrong: put back 0x1020080 in VPP_DUMMY_DATA1 for GXM] -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86tvcf82eu.fsf@baylibre.com -(cherry picked from commit 0ce266d018f4749c7049df76d7f670a675bfa9c6 - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_registers.h | 8 ++++++++ - drivers/gpu/drm/meson/meson_vpp.c | 25 ++++++++++++++++--------- - 2 files changed, 24 insertions(+), 9 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index 1c3825978e28..fdd946b7ebb6 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -339,6 +339,7 @@ - #define VPP_LINE_IN_LENGTH 0x1d01 - #define VPP_PIC_IN_HEIGHT 0x1d02 - #define VPP_SCALE_COEF_IDX 0x1d03 -+#define VPP_SCALE_HORIZONTAL_COEF BIT(8) - #define VPP_SCALE_COEF 0x1d04 - #define VPP_VSC_REGION12_STARTP 0x1d05 - #define VPP_VSC_REGION34_STARTP 0x1d06 -@@ -375,6 +376,8 @@ - #define VPP_PREBLEND_H_SIZE 0x1d20 - #define VPP_POSTBLEND_H_SIZE 0x1d21 - #define VPP_HOLD_LINES 0x1d22 -+#define VPP_POSTBLEND_HOLD_LINES(lines) (lines & 0xf) -+#define VPP_PREBLEND_HOLD_LINES(lines) ((lines & 0xf) << 8) - #define VPP_BLEND_ONECOLOR_CTRL 0x1d23 - #define VPP_PREBLEND_CURRENT_XY 0x1d24 - #define VPP_POSTBLEND_CURRENT_XY 0x1d25 -@@ -393,6 +396,8 @@ - #define VPP_OSD2_PREBLEND BIT(17) - #define VPP_COLOR_MNG_ENABLE BIT(28) - #define VPP_OFIFO_SIZE 0x1d27 -+#define VPP_OFIFO_SIZE_MASK GENMASK(13, 0) -+#define VPP_OFIFO_SIZE_DEFAULT (0xfff << 20 | 0x1000) - #define VPP_FIFO_STATUS 0x1d28 - #define VPP_SMOKE_CTRL 0x1d29 - #define VPP_SMOKE1_VAL 0x1d2a -@@ -408,6 +413,8 @@ - #define VPP_HSC_PHASE_CTRL1 0x1d34 - #define VPP_HSC_INI_PAT_CTRL 0x1d35 - #define VPP_VADJ_CTRL 0x1d40 -+#define VPP_MINUS_BLACK_LVL_VADJ1_ENABLE BIT(1) -+ - #define VPP_VADJ1_Y 0x1d41 - #define VPP_VADJ1_MA_MB 0x1d42 - #define VPP_VADJ1_MC_MD 0x1d43 -@@ -467,6 +474,7 @@ - #define VPP_PEAKING_VGAIN 0x1d92 - #define VPP_PEAKING_NLP_1 0x1d93 - #define VPP_DOLBY_CTRL 0x1d93 -+#define VPP_PPS_DUMMY_DATA_MODE (1 << 17) - #define VPP_PEAKING_NLP_2 0x1d94 - #define VPP_PEAKING_NLP_3 0x1d95 - #define VPP_PEAKING_NLP_4 0x1d96 -diff --git a/drivers/gpu/drm/meson/meson_vpp.c b/drivers/gpu/drm/meson/meson_vpp.c -index bfee30fa6e34..beec199d75e1 100644 ---- a/drivers/gpu/drm/meson/meson_vpp.c -+++ b/drivers/gpu/drm/meson/meson_vpp.c -@@ -57,7 +57,7 @@ static void meson_vpp_write_scaling_filter_coefs(struct meson_drm *priv, - { - int i; - -- writel_relaxed(is_horizontal ? BIT(8) : 0, -+ writel_relaxed(is_horizontal ? VPP_SCALE_HORIZONTAL_COEF : 0, - priv->io_base + _REG(VPP_OSD_SCALE_COEF_IDX)); - for (i = 0; i < 33; i++) - writel_relaxed(coefs[i], -@@ -82,7 +82,7 @@ static void meson_vpp_write_vd_scaling_filter_coefs(struct meson_drm *priv, - { - int i; - -- writel_relaxed(is_horizontal ? BIT(8) : 0, -+ writel_relaxed(is_horizontal ? VPP_SCALE_HORIZONTAL_COEF : 0, - priv->io_base + _REG(VPP_SCALE_COEF_IDX)); - for (i = 0; i < 33; i++) - writel_relaxed(coefs[i], -@@ -97,7 +97,8 @@ void meson_vpp_init(struct meson_drm *priv) - else if (meson_vpu_is_compatible(priv, "amlogic,meson-gxm-vpu")) { - writel_bits_relaxed(0xff << 16, 0xff << 16, - priv->io_base + _REG(VIU_MISC_CTRL1)); -- writel_relaxed(0x20000, priv->io_base + _REG(VPP_DOLBY_CTRL)); -+ writel_relaxed(VPP_PPS_DUMMY_DATA_MODE, -+ priv->io_base + _REG(VPP_DOLBY_CTRL)); - writel_relaxed(0x1020080, - priv->io_base + _REG(VPP_DUMMY_DATA1)); - } else if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) -@@ -105,12 +106,13 @@ void meson_vpp_init(struct meson_drm *priv) - - /* Initialize vpu fifo control registers */ - if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) -- writel_relaxed(0xfff << 20 | 0x1000, -+ writel_relaxed(VPP_OFIFO_SIZE_DEFAULT, - priv->io_base + _REG(VPP_OFIFO_SIZE)); - else -- writel_relaxed(readl_relaxed(priv->io_base + _REG(VPP_OFIFO_SIZE)) | -- 0x77f, priv->io_base + _REG(VPP_OFIFO_SIZE)); -- writel_relaxed(0x08080808, priv->io_base + _REG(VPP_HOLD_LINES)); -+ writel_bits_relaxed(VPP_OFIFO_SIZE_MASK, 0x77f, -+ priv->io_base + _REG(VPP_OFIFO_SIZE)); -+ writel_relaxed(VPP_POSTBLEND_HOLD_LINES(4) | VPP_PREBLEND_HOLD_LINES(4), -+ priv->io_base + _REG(VPP_HOLD_LINES)); - - if (!meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) { - /* Turn off preblend */ -@@ -138,10 +140,15 @@ void meson_vpp_init(struct meson_drm *priv) - writel_relaxed(0, priv->io_base + _REG(VPP_OSD_SC_CTRL0)); - writel_relaxed(0, priv->io_base + _REG(VPP_OSD_VSC_CTRL0)); - writel_relaxed(0, priv->io_base + _REG(VPP_OSD_HSC_CTRL0)); -- writel_relaxed(4 | (4 << 8) | BIT(15), -+ -+ /* Set horizontal/vertical bank length and enable video scale out */ -+ writel_relaxed(VPP_VSC_BANK_LENGTH(4) | VPP_HSC_BANK_LENGTH(4) | -+ VPP_SC_VD_EN_ENABLE, - priv->io_base + _REG(VPP_SC_MISC)); - -- writel_relaxed(1, priv->io_base + _REG(VPP_VADJ_CTRL)); -+ /* Enable minus black level for vadj1 */ -+ writel_relaxed(VPP_MINUS_BLACK_LVL_VADJ1_ENABLE, -+ priv->io_base + _REG(VPP_VADJ_CTRL)); - - /* Write in the proper filter coefficients. */ - meson_vpp_write_scaling_filter_coefs(priv, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0061-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch b/packages/linux/patches/amlogic/amlogic-0061-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch new file mode 100644 index 0000000000..3ab47d8c12 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0061-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch @@ -0,0 +1,109 @@ +From 0fad7c2ff463b25f36a817f76733103b292368a4 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 19 Feb 2020 04:27:30 +0000 +Subject: [PATCH 061/146] WIP: arm64: dts: meson: add audio playback to khadas + vim2 + +Signed-off-by: Christian Hewitt +--- + .../dts/amlogic/meson-gxm-khadas-vim2.dts | 70 +++++++++++++++++++ + 1 file changed, 70 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +index f82f25c1a5f9..a25786c68def 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +@@ -8,6 +8,7 @@ + /dts-v1/; + + #include ++#include + #include + + #include "meson-gxm.dtsi" +@@ -25,6 +26,13 @@ + stdout-path = "serial0:115200n8"; + }; + ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&hdmi_5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x80000000>; +@@ -189,6 +197,68 @@ + clock-frequency = <32768>; + pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXM-KHADAS-VIM2"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Line", "Lineout"; ++ audio-routing = "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "Lineout", "AU2 OUTL", ++ "Lineout", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0062-FROMGIT-drm-meson-viu-use-proper-macros-instead-of-m.patch b/packages/linux/patches/amlogic/amlogic-0062-FROMGIT-drm-meson-viu-use-proper-macros-instead-of-m.patch deleted file mode 100644 index e955fcecfc..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0062-FROMGIT-drm-meson-viu-use-proper-macros-instead-of-m.patch +++ /dev/null @@ -1,251 +0,0 @@ -From cc4641aca0030c1313789041306e055322c9e030 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:48:43 +0200 -Subject: [PATCH 062/187] FROMGIT: drm: meson: viu: use proper macros instead - of magic constants - -This patch add new macros which are used to set the following -registers: -- VIU_SW_RESET -- VIU_OSD1_CTRL_STAT -- VIU_OSD2_CTRL_STAT -- VIU_OSD1_FIFO_CTRL_STAT -- VIU_OSD2_FIFO_CTRL_STAT -- VIU_MISC_CTRL0 -- VIU_OSD_BLEND_CTRL -- OSD1_BLEND_SRC_CTRL -- OSD2_BLEND_SRC_CTRL -- DOLBY_PATH_CTRL - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -[narmstrong: fix OSD1_BLEND_SRC_CTRL register init value for G12A] -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86sgrz82em.fsf@baylibre.com -(cherry picked from commit 147ae1cbaa18429b9450fd47136a29653294aaad - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_plane.c | 2 +- - drivers/gpu/drm/meson/meson_registers.h | 27 ++++++++ - drivers/gpu/drm/meson/meson_viu.c | 82 +++++++++++++------------ - 3 files changed, 72 insertions(+), 39 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c -index 7a7e88dadd0b..c83471b69a1b 100644 ---- a/drivers/gpu/drm/meson/meson_plane.c -+++ b/drivers/gpu/drm/meson/meson_plane.c -@@ -332,7 +332,7 @@ static void meson_plane_atomic_disable(struct drm_plane *plane, - - /* Disable OSD1 */ - if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) -- writel_bits_relaxed(3 << 8, 0, -+ writel_bits_relaxed(VIU_OSD1_POSTBLD_SRC_OSD1, 0, - priv->io_base + _REG(OSD1_BLEND_SRC_CTRL)); - else - writel_bits_relaxed(VPP_OSD1_POSTBLEND, 0, -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index fdd946b7ebb6..2b4968fd1455 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -136,11 +136,19 @@ - #define VIU_ADDR_START 0x1a00 - #define VIU_ADDR_END 0x1aff - #define VIU_SW_RESET 0x1a01 -+#define VIU_SW_RESET_OSD1 BIT(0) - #define VIU_MISC_CTRL0 0x1a06 -+#define VIU_CTRL0_VD1_AFBC_MASK 0x170000 - #define VIU_MISC_CTRL1 0x1a07 - #define D2D3_INTF_LENGTH 0x1a08 - #define D2D3_INTF_CTRL0 0x1a09 - #define VIU_OSD1_CTRL_STAT 0x1a10 -+#define VIU_OSD1_OSD_BLK_ENABLE BIT(0) -+#define VIU_OSD1_POSTBLD_SRC_VD1 (1 << 8) -+#define VIU_OSD1_POSTBLD_SRC_VD2 (2 << 8) -+#define VIU_OSD1_POSTBLD_SRC_OSD1 (3 << 8) -+#define VIU_OSD1_POSTBLD_SRC_OSD2 (4 << 8) -+#define VIU_OSD1_OSD_ENABLE BIT(21) - #define VIU_OSD1_CTRL_STAT2 0x1a2d - #define VIU_OSD1_COLOR_ADDR 0x1a11 - #define VIU_OSD1_COLOR 0x1a12 -@@ -230,6 +238,12 @@ - #define VIU_OSD3_MALI_UNPACK_CTRL 0x3d9f - #define VIU_OSD3_DIMM_CTRL 0x3da0 - -+#define VIU_OSD_DDR_PRIORITY_URGENT BIT(0) -+#define VIU_OSD_HOLD_FIFO_LINES(lines) ((lines & 0x1f) << 5) -+#define VIU_OSD_FIFO_DEPTH_VAL(val) ((val & 0x7f) << 12) -+#define VIU_OSD_WORDS_PER_BURST(words) (((words & 0x4) >> 1) << 22) -+#define VIU_OSD_FIFO_LIMITS(size) ((size & 0xf) << 24) -+ - #define VD1_IF0_GEN_REG 0x1a50 - #define VD1_IF0_CANVAS0 0x1a51 - #define VD1_IF0_CANVAS1 0x1a52 -@@ -1610,10 +1624,18 @@ - #define VPU_MAFBC_PREFETCH_CFG_S3 0x3a7c - - #define DOLBY_PATH_CTRL 0x1a0c -+#define DOLBY_BYPASS_EN(val) (val & 0xf) - #define OSD_PATH_MISC_CTRL 0x1a0e - #define MALI_AFBCD_TOP_CTRL 0x1a0f - - #define VIU_OSD_BLEND_CTRL 0x39b0 -+#define VIU_OSD_BLEND_REORDER(dest, src) ((src) << (dest * 4)) -+#define VIU_OSD_BLEND_DIN_EN(bits) ((bits & 0xf) << 20) -+#define VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 BIT(24) -+#define VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 BIT(25) -+#define VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 BIT(26) -+#define VIU_OSD_BLEND_BLEN2_PREMULT_EN(input) ((input & 0x3) << 27) -+#define VIU_OSD_BLEND_HOLD_LINES(lines) ((lines & 0x7) << 29) - #define VIU_OSD_BLEND_CTRL1 0x39c0 - #define VIU_OSD_BLEND_DIN0_SCOPE_H 0x39b1 - #define VIU_OSD_BLEND_DIN0_SCOPE_V 0x39b2 -@@ -1655,6 +1677,11 @@ - #define VD_BLEND_POSTBLD_PREMULT_EN BIT(16) - #define OSD1_BLEND_SRC_CTRL 0x1dfd - #define OSD2_BLEND_SRC_CTRL 0x1dfe -+#define OSD_BLEND_POSTBLD_SRC_VD1 (1 << 8) -+#define OSD_BLEND_POSTBLD_SRC_VD2 (2 << 8) -+#define OSD_BLEND_POSTBLD_SRC_OSD1 (3 << 8) -+#define OSD_BLEND_POSTBLD_SRC_OSD2 (4 << 8) -+#define OSD_BLEND_PATH_SEL_ENABLE BIT(20) - - #define VPP_POST_BLEND_BLEND_DUMMY_DATA 0x3968 - #define VPP_POST_BLEND_DUMMY_ALPHA 0x3969 -diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c -index 4b2b3024d371..4b36e4b21b51 100644 ---- a/drivers/gpu/drm/meson/meson_viu.c -+++ b/drivers/gpu/drm/meson/meson_viu.c -@@ -323,9 +323,9 @@ void meson_viu_osd1_reset(struct meson_drm *priv) - priv->io_base + _REG(VIU_OSD1_CTRL_STAT2)); - - /* Reset OSD1 */ -- writel_bits_relaxed(BIT(0), BIT(0), -+ writel_bits_relaxed(VIU_SW_RESET_OSD1, VIU_SW_RESET_OSD1, - priv->io_base + _REG(VIU_SW_RESET)); -- writel_bits_relaxed(BIT(0), 0, -+ writel_bits_relaxed(VIU_SW_RESET_OSD1, 0, - priv->io_base + _REG(VIU_SW_RESET)); - - /* Rewrite these registers state lost in the reset */ -@@ -338,15 +338,22 @@ void meson_viu_osd1_reset(struct meson_drm *priv) - meson_viu_load_matrix(priv); - } - -+static inline uint32_t meson_viu_osd_burst_length_reg(uint32_t length) -+{ -+ uint32_t val = (((length & 0x80) % 24) / 12); -+ -+ return (((val & 0x3) << 10) | (((val & 0x4) >> 2) << 31)); -+} -+ - void meson_viu_init(struct meson_drm *priv) - { - uint32_t reg; - - /* Disable OSDs */ -- writel_bits_relaxed(BIT(0) | BIT(21), 0, -- priv->io_base + _REG(VIU_OSD1_CTRL_STAT)); -- writel_bits_relaxed(BIT(0) | BIT(21), 0, -- priv->io_base + _REG(VIU_OSD2_CTRL_STAT)); -+ writel_bits_relaxed(VIU_OSD1_OSD_BLK_ENABLE | VIU_OSD1_OSD_ENABLE, 0, -+ priv->io_base + _REG(VIU_OSD1_CTRL_STAT)); -+ writel_bits_relaxed(VIU_OSD1_OSD_BLK_ENABLE | VIU_OSD1_OSD_ENABLE, 0, -+ priv->io_base + _REG(VIU_OSD2_CTRL_STAT)); - - /* On GXL/GXM, Use the 10bit HDR conversion matrix */ - if (meson_vpu_is_compatible(priv, "amlogic,meson-gxm-vpu") || -@@ -357,19 +364,17 @@ void meson_viu_init(struct meson_drm *priv) - true); - - /* Initialize OSD1 fifo control register */ -- reg = BIT(0) | /* Urgent DDR request priority */ -- (4 << 5); /* hold_fifo_lines */ -+ reg = VIU_OSD_DDR_PRIORITY_URGENT | -+ VIU_OSD_HOLD_FIFO_LINES(4) | -+ VIU_OSD_FIFO_DEPTH_VAL(32) | /* fifo_depth_val: 32*8=256 */ -+ VIU_OSD_WORDS_PER_BURST(4) | /* 4 words in 1 burst */ -+ VIU_OSD_FIFO_LIMITS(2); /* fifo_lim: 2*16=32 */ -+ - if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) -- reg |= (1 << 10) | /* burst length 32 */ -- (32 << 12) | /* fifo_depth_val: 32*8=256 */ -- (2 << 22) | /* 4 words in 1 burst */ -- (2 << 24) | -- (1 << 31); -+ reg |= meson_viu_osd_burst_length_reg(32); - else -- reg |= (3 << 10) | /* burst length 64 */ -- (32 << 12) | /* fifo_depth_val: 32*8=256 */ -- (2 << 22) | /* 4 words in 1 burst */ -- (2 << 24); -+ reg |= meson_viu_osd_burst_length_reg(64); -+ - writel_relaxed(reg, priv->io_base + _REG(VIU_OSD1_FIFO_CTRL_STAT)); - writel_relaxed(reg, priv->io_base + _REG(VIU_OSD2_FIFO_CTRL_STAT)); - -@@ -382,12 +387,9 @@ void meson_viu_init(struct meson_drm *priv) - priv->io_base + _REG(VIU_OSD2_CTRL_STAT2)); - - /* Disable VD1 AFBC */ -- /* di_mif0_en=0 mif0_to_vpp_en=0 di_mad_en=0 */ -- writel_bits_relaxed(0x7 << 16, 0, -- priv->io_base + _REG(VIU_MISC_CTRL0)); -- /* afbc vd1 set=0 */ -- writel_bits_relaxed(BIT(20), 0, -- priv->io_base + _REG(VIU_MISC_CTRL0)); -+ /* di_mif0_en=0 mif0_to_vpp_en=0 di_mad_en=0 and afbc vd1 set=0*/ -+ writel_bits_relaxed(VIU_CTRL0_VD1_AFBC_MASK, 0, -+ priv->io_base + _REG(VIU_MISC_CTRL0)); - writel_relaxed(0, priv->io_base + _REG(AFBC_ENABLE)); - - writel_relaxed(0x00FF00C0, -@@ -396,27 +398,31 @@ void meson_viu_init(struct meson_drm *priv) - priv->io_base + _REG(VD2_IF0_LUMA_FIFO_SIZE)); - - if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) { -- writel_relaxed(4 << 29 | -- 1 << 27 | -- 1 << 26 | /* blend_din0 input to blend0 */ -- 1 << 25 | /* blend1_dout to blend2 */ -- 1 << 24 | /* blend1_din3 input to blend1 */ -- 1 << 20 | -- 0 << 16 | -- 1, -- priv->io_base + _REG(VIU_OSD_BLEND_CTRL)); -- writel_relaxed(1 << 20, -- priv->io_base + _REG(OSD1_BLEND_SRC_CTRL)); -- writel_relaxed(1 << 20, -- priv->io_base + _REG(OSD2_BLEND_SRC_CTRL)); -+ writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) | -+ VIU_OSD_BLEND_REORDER(1, 0) | -+ VIU_OSD_BLEND_REORDER(2, 0) | -+ VIU_OSD_BLEND_REORDER(3, 0) | -+ VIU_OSD_BLEND_DIN_EN(1) | -+ VIU_OSD_BLEND1_DIN3_BYPASS_TO_DOUT1 | -+ VIU_OSD_BLEND1_DOUT_BYPASS_TO_BLEND2 | -+ VIU_OSD_BLEND_DIN0_BYPASS_TO_DOUT0 | -+ VIU_OSD_BLEND_BLEN2_PREMULT_EN(1) | -+ VIU_OSD_BLEND_HOLD_LINES(4), -+ priv->io_base + _REG(VIU_OSD_BLEND_CTRL)); -+ -+ writel_relaxed(OSD_BLEND_PATH_SEL_ENABLE, -+ priv->io_base + _REG(OSD1_BLEND_SRC_CTRL)); -+ writel_relaxed(OSD_BLEND_PATH_SEL_ENABLE, -+ priv->io_base + _REG(OSD2_BLEND_SRC_CTRL)); - writel_relaxed(0, priv->io_base + _REG(VD1_BLEND_SRC_CTRL)); - writel_relaxed(0, priv->io_base + _REG(VD2_BLEND_SRC_CTRL)); - writel_relaxed(0, - priv->io_base + _REG(VIU_OSD_BLEND_DUMMY_DATA0)); - writel_relaxed(0, - priv->io_base + _REG(VIU_OSD_BLEND_DUMMY_ALPHA)); -- writel_bits_relaxed(0x3 << 2, 0x3 << 2, -- priv->io_base + _REG(DOLBY_PATH_CTRL)); -+ -+ writel_bits_relaxed(DOLBY_BYPASS_EN(0xc), DOLBY_BYPASS_EN(0xc), -+ priv->io_base + _REG(DOLBY_PATH_CTRL)); - } - - priv->viu.osd1_enabled = false; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0062-WIP-arm64-dts-meson-gxbb-add-playback-audio-devices.patch b/packages/linux/patches/amlogic/amlogic-0062-WIP-arm64-dts-meson-gxbb-add-playback-audio-devices.patch new file mode 100644 index 0000000000..91e96b916b --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0062-WIP-arm64-dts-meson-gxbb-add-playback-audio-devices.patch @@ -0,0 +1,48 @@ +From f8c9f131746fbb1d1e595677b341fcbdace84fd3 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 18 Feb 2020 12:23:31 +0000 +Subject: [PATCH 062/146] WIP: arm64: dts: meson-gxbb: add playback audio + devices + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 23 +++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +index 0cb40326b0d3..ccaa1a8e28c5 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +@@ -241,6 +241,29 @@ + }; + }; + ++&aiu { ++ compatible = "amlogic,aiu-gxbb", "amlogic,aiu"; ++ clocks = <&clkc CLKID_AIU_GLUE>, ++ <&clkc CLKID_I2S_OUT>, ++ <&clkc CLKID_AOCLK_GATE>, ++ <&clkc CLKID_CTS_AMCLK>, ++ <&clkc CLKID_MIXER_IFACE>, ++ <&clkc CLKID_IEC958>, ++ <&clkc CLKID_IEC958_GATE>, ++ <&clkc CLKID_CTS_MCLK_I958>, ++ <&clkc CLKID_CTS_I958>; ++ clock-names = "pclk", ++ "i2s_pclk", ++ "i2s_aoclk", ++ "i2s_mclk", ++ "i2s_mixer", ++ "spdif_pclk", ++ "spdif_aoclk", ++ "spdif_mclk", ++ "spdif_mclk_sel"; ++ resets = <&reset RESET_AIU>; ++}; ++ + &apb { + mali: gpu@c0000 { + compatible = "amlogic,meson-gxbb-mali", "arm,mali-450"; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0063-FROMGIT-drm-meson-venc-use-proper-macros-instead-of-.patch b/packages/linux/patches/amlogic/amlogic-0063-FROMGIT-drm-meson-venc-use-proper-macros-instead-of-.patch deleted file mode 100644 index 0069314d18..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0063-FROMGIT-drm-meson-venc-use-proper-macros-instead-of-.patch +++ /dev/null @@ -1,477 +0,0 @@ -From b4ead82b8e357549fe6dfe21d174a5e1ed0834fa Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:48:50 +0200 -Subject: [PATCH 063/187] FROMGIT: drm: meson: venc: use proper macros instead - of magic constants - -This patch add new macros which are used to set the following -registers: -- ENCI_CFILT_CTRL -- ENCI_CFILT_CTRL2 -- ENCI_MACV_MAX_AMP -- ENCI_VIDEO_MODE_ADV -- ENCI_VFIFO2VD_CTL -- ENCI_VIDEO_EN -- ENCP_VIDEO_MODE -- VPU_HDMI_SETTING -- VENC_UPSAMPLE_CTRL0 -- VENC_UPSAMPLE_CTRL1 -- VENC_UPSAMPLE_CTRL2 -- VENC_VDAC_FIFO_CTRL -- VENC_VDAC_DAC0_FILT_CTRL0 -- VENC_INTCTRL - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86r27j82ef.fsf@baylibre.com -(cherry picked from commit 7eef9e6104545e3aed75ac84129ab332e71b6557 - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_registers.h | 51 ++++++++ - drivers/gpu/drm/meson/meson_venc.c | 155 +++++++++++++++++++----- - drivers/gpu/drm/meson/meson_venc_cvbs.c | 3 +- - 3 files changed, 177 insertions(+), 32 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index 2b4968fd1455..ec73eaa4a0bf 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -732,6 +732,25 @@ - #define VENC_UPSAMPLE_CTRL0 0x1b64 - #define VENC_UPSAMPLE_CTRL1 0x1b65 - #define VENC_UPSAMPLE_CTRL2 0x1b66 -+#define VENC_UPSAMPLE_CTRL_F0_2_CLK_RATIO BIT(0) -+#define VENC_UPSAMPLE_CTRL_F1_EN BIT(5) -+#define VENC_UPSAMPLE_CTRL_F1_UPSAMPLE_EN BIT(6) -+#define VENC_UPSAMPLE_CTRL_INTERLACE_HIGH_LUMA (0x0 << 12) -+#define VENC_UPSAMPLE_CTRL_CVBS (0x1 << 12) -+#define VENC_UPSAMPLE_CTRL_S_VIDEO_LUMA (0x2 << 12) -+#define VENC_UPSAMPLE_CTRL_S_VIDEO_CHROMA (0x3 << 12) -+#define VENC_UPSAMPLE_CTRL_INTERLACE_PB (0x4 << 12) -+#define VENC_UPSAMPLE_CTRL_INTERLACE_PR (0x5 << 12) -+#define VENC_UPSAMPLE_CTRL_INTERLACE_R (0x6 << 12) -+#define VENC_UPSAMPLE_CTRL_INTERLACE_G (0x7 << 12) -+#define VENC_UPSAMPLE_CTRL_INTERLACE_B (0x8 << 12) -+#define VENC_UPSAMPLE_CTRL_PROGRESSIVE_Y (0x9 << 12) -+#define VENC_UPSAMPLE_CTRL_PROGRESSIVE_PB (0xa << 12) -+#define VENC_UPSAMPLE_CTRL_PROGRESSIVE_PR (0xb << 12) -+#define VENC_UPSAMPLE_CTRL_PROGRESSIVE_R (0xc << 12) -+#define VENC_UPSAMPLE_CTRL_PROGRESSIVE_G (0xd << 12) -+#define VENC_UPSAMPLE_CTRL_PROGRESSIVE_B (0xe << 12) -+#define VENC_UPSAMPLE_CTRL_VDAC_TEST_VALUE (0xf << 12) - #define TCON_INVERT_CTL 0x1b67 - #define VENC_VIDEO_PROG_MODE 0x1b68 - #define VENC_ENCI_LINE 0x1b69 -@@ -740,6 +759,7 @@ - #define VENC_ENCP_PIXEL 0x1b6c - #define VENC_STATA 0x1b6d - #define VENC_INTCTRL 0x1b6e -+#define VENC_INTCTRL_ENCI_LNRST_INT_EN BIT(1) - #define VENC_INTFLAG 0x1b6f - #define VENC_VIDEO_TST_EN 0x1b70 - #define VENC_VIDEO_TST_MDSEL 0x1b71 -@@ -750,6 +770,7 @@ - #define VENC_VIDEO_TST_CLRBAR_WIDTH 0x1b76 - #define VENC_VIDEO_TST_VDCNT_STSET 0x1b77 - #define VENC_VDAC_DACSEL0 0x1b78 -+#define VENC_VDAC_SEL_ATV_DMD BIT(5) - #define VENC_VDAC_DACSEL1 0x1b79 - #define VENC_VDAC_DACSEL2 0x1b7a - #define VENC_VDAC_DACSEL3 0x1b7b -@@ -770,6 +791,7 @@ - #define VENC_VDAC_DAC5_GAINCTRL 0x1bfa - #define VENC_VDAC_DAC5_OFFSET 0x1bfb - #define VENC_VDAC_FIFO_CTRL 0x1bfc -+#define VENC_VDAC_FIFO_EN_ENCI_ENABLE BIT(13) - #define ENCL_TCON_INVERT_CTL 0x1bfd - #define ENCP_VIDEO_EN 0x1b80 - #define ENCP_VIDEO_SYNC_MODE 0x1b81 -@@ -785,6 +807,7 @@ - #define ENCP_VIDEO_SYNC_OFFST 0x1b8b - #define ENCP_VIDEO_MACV_OFFST 0x1b8c - #define ENCP_VIDEO_MODE 0x1b8d -+#define ENCP_VIDEO_MODE_DE_V_HIGH BIT(14) - #define ENCP_VIDEO_MODE_ADV 0x1b8e - #define ENCP_DBG_PX_RST 0x1b90 - #define ENCP_DBG_LN_RST 0x1b91 -@@ -863,6 +886,11 @@ - #define C656_FS_LNED 0x1be7 - #define ENCI_VIDEO_MODE 0x1b00 - #define ENCI_VIDEO_MODE_ADV 0x1b01 -+#define ENCI_VIDEO_MODE_ADV_DMXMD(val) (val & 0x3) -+#define ENCI_VIDEO_MODE_ADV_VBICTL_LINE_17_22 BIT(2) -+#define ENCI_VIDEO_MODE_ADV_YBW_MEDIUM (0 << 4) -+#define ENCI_VIDEO_MODE_ADV_YBW_LOW (0x1 << 4) -+#define ENCI_VIDEO_MODE_ADV_YBW_HIGH (0x2 << 4) - #define ENCI_VIDEO_FSC_ADJ 0x1b02 - #define ENCI_VIDEO_BRIGHT 0x1b03 - #define ENCI_VIDEO_CONT 0x1b04 -@@ -933,13 +961,17 @@ - #define ENCI_DBG_MAXPX 0x1b4c - #define ENCI_DBG_MAXLN 0x1b4d - #define ENCI_MACV_MAX_AMP 0x1b50 -+#define ENCI_MACV_MAX_AMP_ENABLE_CHANGE BIT(15) -+#define ENCI_MACV_MAX_AMP_VAL(val) (val & 0x83ff) - #define ENCI_MACV_PULSE_LO 0x1b51 - #define ENCI_MACV_PULSE_HI 0x1b52 - #define ENCI_MACV_BKP_MAX 0x1b53 - #define ENCI_CFILT_CTRL 0x1b54 -+#define ENCI_CFILT_CMPT_SEL_HIGH BIT(1) - #define ENCI_CFILT7 0x1b55 - #define ENCI_YC_DELAY 0x1b56 - #define ENCI_VIDEO_EN 0x1b57 -+#define ENCI_VIDEO_EN_ENABLE BIT(0) - #define ENCI_DVI_HSO_BEGIN 0x1c00 - #define ENCI_DVI_HSO_END 0x1c01 - #define ENCI_DVI_VSO_BLINE_EVN 0x1c02 -@@ -951,6 +983,10 @@ - #define ENCI_DVI_VSO_END_EVN 0x1c08 - #define ENCI_DVI_VSO_END_ODD 0x1c09 - #define ENCI_CFILT_CTRL2 0x1c0a -+#define ENCI_CFILT_CMPT_CR_DLY(delay) (delay & 0xf) -+#define ENCI_CFILT_CMPT_CB_DLY(delay) ((delay & 0xf) << 4) -+#define ENCI_CFILT_CVBS_CR_DLY(delay) ((delay & 0xf) << 8) -+#define ENCI_CFILT_CVBS_CB_DLY(delay) ((delay & 0xf) << 12) - #define ENCI_DACSEL_0 0x1c0b - #define ENCI_DACSEL_1 0x1c0c - #define ENCP_DACSEL_0 0x1c0d -@@ -965,6 +1001,8 @@ - #define ENCI_TST_CLRBAR_WIDTH 0x1c16 - #define ENCI_TST_VDCNT_STSET 0x1c17 - #define ENCI_VFIFO2VD_CTL 0x1c18 -+#define ENCI_VFIFO2VD_CTL_ENABLE BIT(0) -+#define ENCI_VFIFO2VD_CTL_VD_SEL(val) ((val & 0xff) << 8) - #define ENCI_VFIFO2VD_PIXEL_START 0x1c19 - #define ENCI_VFIFO2VD_PIXEL_END 0x1c1a - #define ENCI_VFIFO2VD_LINE_TOP_START 0x1c1b -@@ -1027,6 +1065,7 @@ - #define VENC_VDAC_DAC5_FILT_CTRL0 0x1c56 - #define VENC_VDAC_DAC5_FILT_CTRL1 0x1c57 - #define VENC_VDAC_DAC0_FILT_CTRL0 0x1c58 -+#define VENC_VDAC_DAC0_FILT_CTRL0_EN BIT(0) - #define VENC_VDAC_DAC0_FILT_CTRL1 0x1c59 - #define VENC_VDAC_DAC1_FILT_CTRL0 0x1c5a - #define VENC_VDAC_DAC1_FILT_CTRL1 0x1c5b -@@ -1432,6 +1471,18 @@ - #define VIU2_SEL_VENC_ENCP (2 << 2) - #define VIU2_SEL_VENC_ENCT (3 << 2) - #define VPU_HDMI_SETTING 0x271b -+#define VPU_HDMI_ENCI_DATA_TO_HDMI BIT(0) -+#define VPU_HDMI_ENCP_DATA_TO_HDMI BIT(1) -+#define VPU_HDMI_INV_HSYNC BIT(2) -+#define VPU_HDMI_INV_VSYNC BIT(3) -+#define VPU_HDMI_OUTPUT_CRYCB (0 << 5) -+#define VPU_HDMI_OUTPUT_YCBCR (1 << 5) -+#define VPU_HDMI_OUTPUT_YCRCB (2 << 5) -+#define VPU_HDMI_OUTPUT_CBCRY (3 << 5) -+#define VPU_HDMI_OUTPUT_CBYCR (4 << 5) -+#define VPU_HDMI_OUTPUT_CRCBY (5 << 5) -+#define VPU_HDMI_WR_RATE(rate) (((rate & 0x1f) - 1) << 8) -+#define VPU_HDMI_RD_RATE(rate) (((rate & 0x1f) - 1) << 12) - #define ENCI_INFO_READ 0x271c - #define ENCP_INFO_READ 0x271d - #define ENCT_INFO_READ 0x271e -diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c -index 7b7a0d8d737c..918df02d2aef 100644 ---- a/drivers/gpu/drm/meson/meson_venc.c -+++ b/drivers/gpu/drm/meson/meson_venc.c -@@ -976,6 +976,7 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - unsigned int eof_lines; - unsigned int sof_lines; - unsigned int vsync_lines; -+ u32 reg; - - /* Use VENCI for 480i and 576i and double HDMI pixels */ - if (mode->flags & DRM_MODE_FLAG_DBLCLK) { -@@ -1048,8 +1049,11 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - unsigned int lines_f1; - - /* CVBS Filter settings */ -- writel_relaxed(0x12, priv->io_base + _REG(ENCI_CFILT_CTRL)); -- writel_relaxed(0x12, priv->io_base + _REG(ENCI_CFILT_CTRL2)); -+ writel_relaxed(ENCI_CFILT_CMPT_SEL_HIGH | 0x10, -+ priv->io_base + _REG(ENCI_CFILT_CTRL)); -+ writel_relaxed(ENCI_CFILT_CMPT_CR_DLY(2) | -+ ENCI_CFILT_CMPT_CB_DLY(1), -+ priv->io_base + _REG(ENCI_CFILT_CTRL2)); - - /* Digital Video Select : Interlace, clk27 clk, external */ - writel_relaxed(0, priv->io_base + _REG(VENC_DVI_SETTING)); -@@ -1071,8 +1075,9 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - priv->io_base + _REG(ENCI_SYNC_VSO_ODDLN)); - - /* Macrovision max amplitude change */ -- writel_relaxed(vmode->enci.macv_max_amp, -- priv->io_base + _REG(ENCI_MACV_MAX_AMP)); -+ writel_relaxed(ENCI_MACV_MAX_AMP_ENABLE_CHANGE | -+ ENCI_MACV_MAX_AMP_VAL(vmode->enci.macv_max_amp), -+ priv->io_base + _REG(ENCI_MACV_MAX_AMP)); - - /* Video mode */ - writel_relaxed(vmode->enci.video_prog_mode, -@@ -1088,7 +1093,10 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - * Bypass luma low pass filter - * No macrovision on CSYNC - */ -- writel_relaxed(0x26, priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); -+ writel_relaxed(ENCI_VIDEO_MODE_ADV_DMXMD(2) | -+ ENCI_VIDEO_MODE_ADV_VBICTL_LINE_17_22 | -+ ENCI_VIDEO_MODE_ADV_YBW_HIGH, -+ priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); - - writel(vmode->enci.sch_adjust, - priv->io_base + _REG(ENCI_VIDEO_SCH)); -@@ -1104,8 +1112,17 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - /* UNreset Interlaced TV Encoder */ - writel_relaxed(0, priv->io_base + _REG(ENCI_DBG_PX_RST)); - -- /* Enable Vfifo2vd, Y_Cb_Y_Cr select */ -- writel_relaxed(0x4e01, priv->io_base + _REG(ENCI_VFIFO2VD_CTL)); -+ /* -+ * Enable Vfifo2vd and set Y_Cb_Y_Cr: -+ * Corresponding value: -+ * Y => 00 or 10 -+ * Cb => 01 -+ * Cr => 11 -+ * Ex: 0x4e => 01001110 would mean Cb/Y/Cr/Y -+ */ -+ writel_relaxed(ENCI_VFIFO2VD_CTL_ENABLE | -+ ENCI_VFIFO2VD_CTL_VD_SEL(0x4e), -+ priv->io_base + _REG(ENCI_VFIFO2VD_CTL)); - - /* Timings */ - writel_relaxed(vmode->enci.pixel_start, -@@ -1127,7 +1144,8 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - meson_vpp_setup_mux(priv, MESON_VIU_VPP_MUX_ENCI); - - /* Interlace video enable */ -- writel_relaxed(1, priv->io_base + _REG(ENCI_VIDEO_EN)); -+ writel_relaxed(ENCI_VIDEO_EN_ENABLE, -+ priv->io_base + _REG(ENCI_VIDEO_EN)); - - lines_f0 = mode->vtotal >> 1; - lines_f1 = lines_f0 + 1; -@@ -1374,7 +1392,8 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - writel_relaxed(1, priv->io_base + _REG(ENCP_VIDEO_EN)); - - /* Set DE signal’s polarity is active high */ -- writel_bits_relaxed(BIT(14), BIT(14), -+ writel_bits_relaxed(ENCP_VIDEO_MODE_DE_V_HIGH, -+ ENCP_VIDEO_MODE_DE_V_HIGH, - priv->io_base + _REG(ENCP_VIDEO_MODE)); - - /* Program DE timing */ -@@ -1493,13 +1512,39 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - meson_vpp_setup_mux(priv, MESON_VIU_VPP_MUX_ENCP); - } - -- writel_relaxed((use_enci ? 1 : 2) | -- (mode->flags & DRM_MODE_FLAG_PHSYNC ? 1 << 2 : 0) | -- (mode->flags & DRM_MODE_FLAG_PVSYNC ? 1 << 3 : 0) | -- 4 << 5 | -- (venc_repeat ? 1 << 8 : 0) | -- (hdmi_repeat ? 1 << 12 : 0), -- priv->io_base + _REG(VPU_HDMI_SETTING)); -+ /* Set VPU HDMI setting */ -+ /* Select ENCP or ENCI data to HDMI */ -+ if (use_enci) -+ reg = VPU_HDMI_ENCI_DATA_TO_HDMI; -+ else -+ reg = VPU_HDMI_ENCP_DATA_TO_HDMI; -+ -+ /* Invert polarity of HSYNC from VENC */ -+ if (mode->flags & DRM_MODE_FLAG_PHSYNC) -+ reg |= VPU_HDMI_INV_HSYNC; -+ -+ /* Invert polarity of VSYNC from VENC */ -+ if (mode->flags & DRM_MODE_FLAG_PVSYNC) -+ reg |= VPU_HDMI_INV_VSYNC; -+ -+ /* Output data format: CbYCr */ -+ reg |= VPU_HDMI_OUTPUT_CBYCR; -+ -+ /* -+ * Write rate to the async FIFO between VENC and HDMI. -+ * One write every 2 wr_clk. -+ */ -+ if (venc_repeat) -+ reg |= VPU_HDMI_WR_RATE(2); -+ -+ /* -+ * Read rate to the async FIFO between VENC and HDMI. -+ * One read every 2 wr_clk. -+ */ -+ if (hdmi_repeat) -+ reg |= VPU_HDMI_RD_RATE(2); -+ -+ writel_relaxed(reg, priv->io_base + _REG(VPU_HDMI_SETTING)); - - priv->venc.hdmi_repeat = hdmi_repeat; - priv->venc.venc_repeat = venc_repeat; -@@ -1512,12 +1557,17 @@ EXPORT_SYMBOL_GPL(meson_venc_hdmi_mode_set); - void meson_venci_cvbs_mode_set(struct meson_drm *priv, - struct meson_cvbs_enci_mode *mode) - { -+ u32 reg; -+ - if (mode->mode_tag == priv->venc.current_mode) - return; - - /* CVBS Filter settings */ -- writel_relaxed(0x12, priv->io_base + _REG(ENCI_CFILT_CTRL)); -- writel_relaxed(0x12, priv->io_base + _REG(ENCI_CFILT_CTRL2)); -+ writel_relaxed(ENCI_CFILT_CMPT_SEL_HIGH | 0x10, -+ priv->io_base + _REG(ENCI_CFILT_CTRL)); -+ writel_relaxed(ENCI_CFILT_CMPT_CR_DLY(2) | -+ ENCI_CFILT_CMPT_CB_DLY(1), -+ priv->io_base + _REG(ENCI_CFILT_CTRL2)); - - /* Digital Video Select : Interlace, clk27 clk, external */ - writel_relaxed(0, priv->io_base + _REG(VENC_DVI_SETTING)); -@@ -1539,8 +1589,9 @@ void meson_venci_cvbs_mode_set(struct meson_drm *priv, - priv->io_base + _REG(ENCI_SYNC_VSO_ODDLN)); - - /* Macrovision max amplitude change */ -- writel_relaxed(0x8100 + mode->macv_max_amp, -- priv->io_base + _REG(ENCI_MACV_MAX_AMP)); -+ writel_relaxed(ENCI_MACV_MAX_AMP_ENABLE_CHANGE | -+ ENCI_MACV_MAX_AMP_VAL(mode->macv_max_amp), -+ priv->io_base + _REG(ENCI_MACV_MAX_AMP)); - - /* Video mode */ - writel_relaxed(mode->video_prog_mode, -@@ -1556,7 +1607,10 @@ void meson_venci_cvbs_mode_set(struct meson_drm *priv, - * Bypass luma low pass filter - * No macrovision on CSYNC - */ -- writel_relaxed(0x26, priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); -+ writel_relaxed(ENCI_VIDEO_MODE_ADV_DMXMD(2) | -+ ENCI_VIDEO_MODE_ADV_VBICTL_LINE_17_22 | -+ ENCI_VIDEO_MODE_ADV_YBW_HIGH, -+ priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); - - writel(mode->sch_adjust, priv->io_base + _REG(ENCI_VIDEO_SCH)); - -@@ -1588,16 +1642,50 @@ void meson_venci_cvbs_mode_set(struct meson_drm *priv, - /* UNreset Interlaced TV Encoder */ - writel_relaxed(0, priv->io_base + _REG(ENCI_DBG_PX_RST)); - -- /* Enable Vfifo2vd, Y_Cb_Y_Cr select */ -- writel_relaxed(0x4e01, priv->io_base + _REG(ENCI_VFIFO2VD_CTL)); -+ /* -+ * Enable Vfifo2vd and set Y_Cb_Y_Cr: -+ * Corresponding value: -+ * Y => 00 or 10 -+ * Cb => 01 -+ * Cr => 11 -+ * Ex: 0x4e => 01001110 would mean Cb/Y/Cr/Y -+ */ -+ writel_relaxed(ENCI_VFIFO2VD_CTL_ENABLE | -+ ENCI_VFIFO2VD_CTL_VD_SEL(0x4e), -+ priv->io_base + _REG(ENCI_VFIFO2VD_CTL)); - - /* Power UP Dacs */ - writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_SETTING)); - - /* Video Upsampling */ -- writel_relaxed(0x0061, priv->io_base + _REG(VENC_UPSAMPLE_CTRL0)); -- writel_relaxed(0x4061, priv->io_base + _REG(VENC_UPSAMPLE_CTRL1)); -- writel_relaxed(0x5061, priv->io_base + _REG(VENC_UPSAMPLE_CTRL2)); -+ /* -+ * CTRL0, CTRL1 and CTRL2: -+ * Filter0: input data sample every 2 cloks -+ * Filter1: filtering and upsample enable -+ */ -+ reg = VENC_UPSAMPLE_CTRL_F0_2_CLK_RATIO | VENC_UPSAMPLE_CTRL_F1_EN | -+ VENC_UPSAMPLE_CTRL_F1_UPSAMPLE_EN; -+ -+ /* -+ * Upsample CTRL0: -+ * Interlace High Bandwidth Luma -+ */ -+ writel_relaxed(VENC_UPSAMPLE_CTRL_INTERLACE_HIGH_LUMA | reg, -+ priv->io_base + _REG(VENC_UPSAMPLE_CTRL0)); -+ -+ /* -+ * Upsample CTRL1: -+ * Interlace Pb -+ */ -+ writel_relaxed(VENC_UPSAMPLE_CTRL_INTERLACE_PB | reg, -+ priv->io_base + _REG(VENC_UPSAMPLE_CTRL1)); -+ -+ /* -+ * Upsample CTRL2: -+ * Interlace R -+ */ -+ writel_relaxed(VENC_UPSAMPLE_CTRL_INTERLACE_PR | reg, -+ priv->io_base + _REG(VENC_UPSAMPLE_CTRL2)); - - /* Select Interlace Y DACs */ - writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL0)); -@@ -1611,14 +1699,16 @@ void meson_venci_cvbs_mode_set(struct meson_drm *priv, - meson_vpp_setup_mux(priv, MESON_VIU_VPP_MUX_ENCI); - - /* Enable ENCI FIFO */ -- writel_relaxed(0x2000, priv->io_base + _REG(VENC_VDAC_FIFO_CTRL)); -+ writel_relaxed(VENC_VDAC_FIFO_EN_ENCI_ENABLE, -+ priv->io_base + _REG(VENC_VDAC_FIFO_CTRL)); - - /* Select ENCI DACs 0, 1, 4, and 5 */ - writel_relaxed(0x11, priv->io_base + _REG(ENCI_DACSEL_0)); - writel_relaxed(0x11, priv->io_base + _REG(ENCI_DACSEL_1)); - - /* Interlace video enable */ -- writel_relaxed(1, priv->io_base + _REG(ENCI_VIDEO_EN)); -+ writel_relaxed(ENCI_VIDEO_EN_ENABLE, -+ priv->io_base + _REG(ENCI_VIDEO_EN)); - - /* Configure Video Saturation / Contrast / Brightness / Hue */ - writel_relaxed(mode->video_saturation, -@@ -1631,7 +1721,8 @@ void meson_venci_cvbs_mode_set(struct meson_drm *priv, - priv->io_base + _REG(ENCI_VIDEO_HUE)); - - /* Enable DAC0 Filter */ -- writel_relaxed(0x1, priv->io_base + _REG(VENC_VDAC_DAC0_FILT_CTRL0)); -+ writel_relaxed(VENC_VDAC_DAC0_FILT_CTRL0_EN, -+ priv->io_base + _REG(VENC_VDAC_DAC0_FILT_CTRL0)); - writel_relaxed(0xfc48, priv->io_base + _REG(VENC_VDAC_DAC0_FILT_CTRL1)); - - /* 0 in Macrovision register 0 */ -@@ -1652,7 +1743,8 @@ unsigned int meson_venci_get_field(struct meson_drm *priv) - - void meson_venc_enable_vsync(struct meson_drm *priv) - { -- writel_relaxed(2, priv->io_base + _REG(VENC_INTCTRL)); -+ writel_relaxed(VENC_INTCTRL_ENCI_LNRST_INT_EN, -+ priv->io_base + _REG(VENC_INTCTRL)); - regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25)); - } - -@@ -1680,7 +1772,8 @@ void meson_venc_init(struct meson_drm *priv) - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0); - - /* Disable HDMI */ -- writel_bits_relaxed(0x3, 0, -+ writel_bits_relaxed(VPU_HDMI_ENCI_DATA_TO_HDMI | -+ VPU_HDMI_ENCP_DATA_TO_HDMI, 0, - priv->io_base + _REG(VPU_HDMI_SETTING)); - - /* Disable all encoders */ -diff --git a/drivers/gpu/drm/meson/meson_venc_cvbs.c b/drivers/gpu/drm/meson/meson_venc_cvbs.c -index 6313a519f257..7ecc6bb6c8f8 100644 ---- a/drivers/gpu/drm/meson/meson_venc_cvbs.c -+++ b/drivers/gpu/drm/meson/meson_venc_cvbs.c -@@ -172,7 +172,8 @@ static void meson_venc_cvbs_encoder_enable(struct drm_encoder *encoder) - struct meson_drm *priv = meson_venc_cvbs->priv; - - /* VDAC0 source is not from ATV */ -- writel_bits_relaxed(BIT(5), 0, priv->io_base + _REG(VENC_VDAC_DACSEL0)); -+ writel_bits_relaxed(VENC_VDAC_SEL_ATV_DMD, 0, -+ priv->io_base + _REG(VENC_VDAC_DACSEL0)); - - if (meson_vpu_is_compatible(priv, "amlogic,meson-gxbb-vpu")) { - regmap_write(priv->hhi, HHI_VDAC_CNTL0, 1); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch b/packages/linux/patches/amlogic/amlogic-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch new file mode 100644 index 0000000000..23f8bafac0 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch @@ -0,0 +1,157 @@ +From 12d1a0d333ed209569376378ea097b11136fd804 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 19 Feb 2020 04:33:58 +0000 +Subject: [PATCH 063/146] WIP: arm64: dts: meson: add audio playback to nexbox + a1 + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 113 ++++++++++++++++++ + 1 file changed, 113 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +index c2bd4dbbf38c..3b0538f75a68 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +@@ -9,6 +9,8 @@ + + /dts-v1/; + ++#include ++ + #include "meson-gxm.dtsi" + + / { +@@ -24,11 +26,44 @@ + stdout-path = "serial0:115200n8"; + }; + ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&hdmi_5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x80000000>; + }; + ++ vddio_ao18: regulator-vddio_ao18 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDIO_AO18"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ hdmi_5v: regulator-hdmi-5v { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "HDMI_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ ++ gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-always-on; ++ }; ++ + vddio_boot: regulator-vddio-boot { + compatible = "regulator-fixed"; + regulator-name = "VDDIO_BOOT"; +@@ -75,6 +110,84 @@ + }; + }; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXM-NEXBOX-A1"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Line", "Lineout"; ++ audio-routing = "AU2 INL", "ACODEC LOLP", ++ "AU2 INR", "ACODEC LORP", ++ "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "Lineout", "AU2 OUTL", ++ "Lineout", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ ++ dai-link-4 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-5 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_h_pins>; ++ pinctrl-names = "default"; + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0064-FROMGIT-drm-meson-global-clean-up.patch b/packages/linux/patches/amlogic/amlogic-0064-FROMGIT-drm-meson-global-clean-up.patch deleted file mode 100644 index c29047dd4f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0064-FROMGIT-drm-meson-global-clean-up.patch +++ /dev/null @@ -1,209 +0,0 @@ -From 4627f69c34cd19ea34e143c4016c792f9d23a3f3 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:48:57 +0200 -Subject: [PATCH 064/187] FROMGIT: drm: meson: global clean-up - -This patch aims to: -- Add general and TODO comments -- Respect coding style for multi-line comments -- Align macro definitions -- Remove useless macro - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86pnn382e8.fsf@baylibre.com -(cherry picked from commit e1012141242db89259175eeaac36b3de04377664 - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_dw_hdmi.c | 2 ++ - drivers/gpu/drm/meson/meson_dw_hdmi.h | 12 ++++++---- - drivers/gpu/drm/meson/meson_registers.h | 31 +++++++++++-------------- - drivers/gpu/drm/meson/meson_vclk.c | 4 +++- - drivers/gpu/drm/meson/meson_venc.c | 10 ++++---- - 5 files changed, 33 insertions(+), 26 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c -index df3f9ddd2234..1579ff76c1ed 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.c -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c -@@ -428,6 +428,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, - /* Enable internal pixclk, tmds_clk, spdif_clk, i2s_clk, cecclk */ - dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL, - 0x3, 0x3); -+ -+ /* Enable cec_clk and hdcp22_tmdsclk_en */ - dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL, - 0x3 << 4, 0x3 << 4); - -diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.h b/drivers/gpu/drm/meson/meson_dw_hdmi.h -index 1b2ef043eb5c..08e1c14e4ea0 100644 ---- a/drivers/gpu/drm/meson/meson_dw_hdmi.h -+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.h -@@ -100,7 +100,8 @@ - #define HDMITX_TOP_INTR_RXSENSE_RISE BIT(6) - #define HDMITX_TOP_INTR_RXSENSE_FALL BIT(7) - --/* Bit 14:12 RW tmds_sel: 3'b000=Output zero; 3'b001=Output normal TMDS data; -+/* -+ * Bit 14:12 RW tmds_sel: 3'b000=Output zero; 3'b001=Output normal TMDS data; - * 3'b010=Output PRBS data; 3'b100=Output shift pattern. Default 0. - * Bit 11: 9 RW shift_pttn_repeat: 0=New pattern every clk cycle; 1=New pattern - * every 2 clk cycles; ...; 7=New pattern every 8 clk cycles. Default 0. -@@ -135,7 +136,8 @@ - /* Bit 9: 0 RW tmds_clk_pttn[29:20]. Default 0. */ - #define HDMITX_TOP_TMDS_CLK_PTTN_23 (0x00B) - --/* Bit 1 RW shift_tmds_clk_pttn:1=Enable shifting clk pattern, -+/* -+ * Bit 1 RW shift_tmds_clk_pttn:1=Enable shifting clk pattern, - * used when TMDS CLK rate = TMDS character rate /4. Default 0. - * Bit 0 R Reserved. Default 0. - * [ 1] shift_tmds_clk_pttn -@@ -143,12 +145,14 @@ - */ - #define HDMITX_TOP_TMDS_CLK_PTTN_CNTL (0x00C) - --/* Bit 0 RW revocmem_wr_fail: Read back 1 to indicate Host write REVOC MEM -+/* -+ * Bit 0 RW revocmem_wr_fail: Read back 1 to indicate Host write REVOC MEM - * failure, write 1 to clear the failure flag. Default 0. - */ - #define HDMITX_TOP_REVOCMEM_STAT (0x00D) - --/* Bit 1 R filtered RxSense status -+/* -+ * Bit 1 R filtered RxSense status - * Bit 0 R filtered HPD status. - */ - #define HDMITX_TOP_STAT0 (0x00E) -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index ec73eaa4a0bf..cf55723b8f16 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -396,19 +396,19 @@ - #define VPP_PREBLEND_CURRENT_XY 0x1d24 - #define VPP_POSTBLEND_CURRENT_XY 0x1d25 - #define VPP_MISC 0x1d26 --#define VPP_PREBLEND_ENABLE BIT(6) --#define VPP_POSTBLEND_ENABLE BIT(7) --#define VPP_OSD2_ALPHA_PREMULT BIT(8) --#define VPP_OSD1_ALPHA_PREMULT BIT(9) --#define VPP_VD1_POSTBLEND BIT(10) --#define VPP_VD2_POSTBLEND BIT(11) --#define VPP_OSD1_POSTBLEND BIT(12) --#define VPP_OSD2_POSTBLEND BIT(13) --#define VPP_VD1_PREBLEND BIT(14) --#define VPP_VD2_PREBLEND BIT(15) --#define VPP_OSD1_PREBLEND BIT(16) --#define VPP_OSD2_PREBLEND BIT(17) --#define VPP_COLOR_MNG_ENABLE BIT(28) -+#define VPP_PREBLEND_ENABLE BIT(6) -+#define VPP_POSTBLEND_ENABLE BIT(7) -+#define VPP_OSD2_ALPHA_PREMULT BIT(8) -+#define VPP_OSD1_ALPHA_PREMULT BIT(9) -+#define VPP_VD1_POSTBLEND BIT(10) -+#define VPP_VD2_POSTBLEND BIT(11) -+#define VPP_OSD1_POSTBLEND BIT(12) -+#define VPP_OSD2_POSTBLEND BIT(13) -+#define VPP_VD1_PREBLEND BIT(14) -+#define VPP_VD2_PREBLEND BIT(15) -+#define VPP_OSD1_PREBLEND BIT(16) -+#define VPP_OSD2_PREBLEND BIT(17) -+#define VPP_COLOR_MNG_ENABLE BIT(28) - #define VPP_OFIFO_SIZE 0x1d27 - #define VPP_OFIFO_SIZE_MASK GENMASK(13, 0) - #define VPP_OFIFO_SIZE_DEFAULT (0xfff << 20 | 0x1000) -@@ -619,6 +619,7 @@ - #define OSD34_SCI_WH_M1 0x3d29 - #define OSD34_SCO_H_START_END 0x3d2a - #define OSD34_SCO_V_START_END 0x3d2b -+ - /* viu2 */ - #define VIU2_ADDR_START 0x1e00 - #define VIU2_ADDR_END 0x1eff -@@ -1601,7 +1602,6 @@ - #define OSD1_AFBCD_STATUS 0x31a8 - #define OSD1_AFBCD_PIXEL_HSCOPE 0x31a9 - #define OSD1_AFBCD_PIXEL_VSCOPE 0x31aa --#define VIU_MISC_CTRL1 0x1a07 - - /* add for gxm and 962e dv core2 */ - #define DOLBY_CORE2A_SWAP_CTRL1 0x3434 -@@ -1616,8 +1616,6 @@ - #define VPU_MAFBC_COMMAND 0x3a05 - #define VPU_MAFBC_STATUS 0x3a06 - #define VPU_MAFBC_SURFACE_CFG 0x3a07 -- --/* osd afbc on g12a */ - #define VPU_MAFBC_HEADER_BUF_ADDR_LOW_S0 0x3a10 - #define VPU_MAFBC_HEADER_BUF_ADDR_HIGH_S0 0x3a11 - #define VPU_MAFBC_FORMAT_SPECIFIER_S0 0x3a12 -@@ -1738,6 +1736,5 @@ - #define VPP_POST_BLEND_DUMMY_ALPHA 0x3969 - #define VPP_RDARB_MODE 0x3978 - #define VPP_RDARB_REQEN_SLV 0x3979 --#define VPU_RDARB_MODE_L2C1 0x279d - - #endif /* __MESON_REGISTERS_H */ -diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c -index 26732f038d19..e7c2b439d0f7 100644 ---- a/drivers/gpu/drm/meson/meson_vclk.c -+++ b/drivers/gpu/drm/meson/meson_vclk.c -@@ -495,6 +495,7 @@ void meson_hdmi_pll_set_params(struct meson_drm *priv, unsigned int m, - regmap_write(priv->hhi, HHI_HDMI_PLL_CNTL, 0x0b3a0400 | m); - - /* Enable and reset */ -+ /* TODO: add specific macro for g12a here */ - regmap_update_bits(priv->hhi, HHI_HDMI_PLL_CNTL, - 0x3 << 28, 0x3 << 28); - -@@ -969,7 +970,8 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target, - meson_venci_cvbs_clock_config(priv); - return; - } else if (target == MESON_VCLK_TARGET_DMT) { -- /* The DMT clock path is fixed after the PLL: -+ /* -+ * The DMT clock path is fixed after the PLL: - * - automatic PLL freq + OD management - * - vid_pll_div = VID_PLL_DIV_5 - * - vclk_div = 2 -diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c -index 918df02d2aef..2835133ab676 100644 ---- a/drivers/gpu/drm/meson/meson_venc.c -+++ b/drivers/gpu/drm/meson/meson_venc.c -@@ -61,9 +61,9 @@ - /* HHI Registers */ - #define HHI_GCLK_MPEG2 0x148 /* 0x52 offset in data sheet */ - #define HHI_VDAC_CNTL0 0x2F4 /* 0xbd offset in data sheet */ --#define HHI_VDAC_CNTL0_G12A 0x2EC /* 0xbd offset in data sheet */ -+#define HHI_VDAC_CNTL0_G12A 0x2EC /* 0xbb offset in data sheet */ - #define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */ --#define HHI_VDAC_CNTL1_G12A 0x2F0 /* 0xbe offset in data sheet */ -+#define HHI_VDAC_CNTL1_G12A 0x2F0 /* 0xbc offset in data sheet */ - #define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 offset in data sheet */ - - struct meson_cvbs_enci_mode meson_cvbs_enci_pal = { -@@ -1085,7 +1085,8 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, - writel_relaxed(vmode->enci.video_mode, - priv->io_base + _REG(ENCI_VIDEO_MODE)); - -- /* Advanced Video Mode : -+ /* -+ * Advanced Video Mode : - * Demux shifting 0x2 - * Blank line end at line17/22 - * High bandwidth Luma Filter -@@ -1599,7 +1600,8 @@ void meson_venci_cvbs_mode_set(struct meson_drm *priv, - writel_relaxed(mode->video_mode, - priv->io_base + _REG(ENCI_VIDEO_MODE)); - -- /* Advanced Video Mode : -+ /* -+ * Advanced Video Mode : - * Demux shifting 0x2 - * Blank line end at line17/22 - * High bandwidth Luma Filter --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch b/packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch new file mode 100644 index 0000000000..b4027992d3 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch @@ -0,0 +1,72 @@ +From 4afc5a48754695e99624ad8f1635b45f51f89dd3 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 19 Feb 2020 12:15:02 +0000 +Subject: [PATCH 064/146] WIP: arm64: dts: meson: add audio playback to odroid + c2 + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxbb-odroidc2.dts | 40 +++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +index 6ded279c40c8..76841f75a8a8 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +@@ -9,6 +9,7 @@ + + #include "meson-gxbb.dtsi" + #include ++#include + + / { + compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb"; +@@ -172,6 +173,45 @@ + }; + }; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-ODROID-C2"; ++ 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0065-FROMGIT-drm-meson-add-macro-used-to-enable-HDMI-PLL.patch b/packages/linux/patches/amlogic/amlogic-0065-FROMGIT-drm-meson-add-macro-used-to-enable-HDMI-PLL.patch deleted file mode 100644 index 4781c87798..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0065-FROMGIT-drm-meson-add-macro-used-to-enable-HDMI-PLL.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 3be55b1a28c1b490731124e2e28d12c9fc7c8c28 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:49:04 +0200 -Subject: [PATCH 065/187] FROMGIT: drm: meson: add macro used to enable HDMI - PLL - -This patch add new macro HHI_HDMI_PLL_CNTL_EN which is used to enable -HDMI PLL. - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86o92n82e1.fsf@baylibre.com -(cherry picked from commit 0703146060786f972aaa22cad9c877a6067fd47d - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_vclk.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c -index e7c2b439d0f7..be6e152fc75a 100644 ---- a/drivers/gpu/drm/meson/meson_vclk.c -+++ b/drivers/gpu/drm/meson/meson_vclk.c -@@ -96,6 +96,7 @@ - #define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */ - - #define HHI_HDMI_PLL_CNTL 0x320 /* 0xc8 offset in data sheet */ -+#define HHI_HDMI_PLL_CNTL_EN BIT(30) - #define HHI_HDMI_PLL_CNTL2 0x324 /* 0xc9 offset in data sheet */ - #define HHI_HDMI_PLL_CNTL3 0x328 /* 0xca offset in data sheet */ - #define HHI_HDMI_PLL_CNTL4 0x32C /* 0xcb offset in data sheet */ -@@ -468,7 +469,7 @@ void meson_hdmi_pll_set_params(struct meson_drm *priv, unsigned int m, - - /* Enable and unreset */ - regmap_update_bits(priv->hhi, HHI_HDMI_PLL_CNTL, -- 0x7 << 28, 0x4 << 28); -+ 0x7 << 28, HHI_HDMI_PLL_CNTL_EN); - - /* Poll for lock bit */ - regmap_read_poll_timeout(priv->hhi, HHI_HDMI_PLL_CNTL, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0065-WIP-arm64-dts-meson-add-audio-playback-to-p20x-dtsi.patch b/packages/linux/patches/amlogic/amlogic-0065-WIP-arm64-dts-meson-add-audio-playback-to-p20x-dtsi.patch new file mode 100644 index 0000000000..e4da8f802a --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0065-WIP-arm64-dts-meson-add-audio-playback-to-p20x-dtsi.patch @@ -0,0 +1,90 @@ +From d532a10ddc137630f270abc54a49432eb1dcf05c Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 19 Feb 2020 11:12:18 +0000 +Subject: [PATCH 065/146] WIP: arm64: dts: meson: add audio playback to p20x + dtsi + +Signed-off-by: chewitt +--- + .../boot/dts/amlogic/meson-gxbb-p20x.dtsi | 58 +++++++++++++++++++ + 1 file changed, 58 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +index e803a466fe4e..1c428f9d6039 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +@@ -6,6 +6,7 @@ + */ + + #include "meson-gxbb.dtsi" ++#include + + / { + aliases { +@@ -113,6 +114,63 @@ + }; + }; + }; ++ ++ ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-P20X"; ++ 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_y_pins>; ++ pinctrl-names = "default"; + }; + + &cec_AO { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0066-FROMGIT-drm-meson-venc-set-the-correct-macrovision-m.patch b/packages/linux/patches/amlogic/amlogic-0066-FROMGIT-drm-meson-venc-set-the-correct-macrovision-m.patch deleted file mode 100644 index d3ac2035de..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0066-FROMGIT-drm-meson-venc-set-the-correct-macrovision-m.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 1c5d496c2b594c47b2fc678c3a6699c182dd4b94 Mon Sep 17 00:00:00 2001 -From: Julien Masson -Date: Mon, 24 Jun 2019 16:49:12 +0200 -Subject: [PATCH 066/187] FROMGIT: drm: meson: venc: set the correct - macrovision max amplitude value - -According to the register description of ENCI_MACV_MAX_AMP, the -macrovision max amplitude value should be: -- hdmi 480i => 0xb -- hdmi 576i => 0x7 - -The max value is 0x7ff (10 bits). - -Signed-off-by: Julien Masson -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong -Link: https://patchwork.freedesktop.org/patch/msgid/86mui782dt.fsf@baylibre.com -(cherry picked from commit a84ddb83806ed43a67f6fe6a03b0b4695cc314c3 - git://anongit.freedesktop.org/drm/drm-misc drm-misc-next) ---- - drivers/gpu/drm/meson/meson_venc.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c -index 2835133ab676..acad16ff7371 100644 ---- a/drivers/gpu/drm/meson/meson_venc.c -+++ b/drivers/gpu/drm/meson/meson_venc.c -@@ -192,7 +192,7 @@ union meson_hdmi_venc_mode meson_hdmi_enci_mode_480i = { - .hso_end = 129, - .vso_even = 3, - .vso_odd = 260, -- .macv_max_amp = 0x810b, -+ .macv_max_amp = 0xb, - .video_prog_mode = 0xf0, - .video_mode = 0x8, - .sch_adjust = 0x20, -@@ -212,7 +212,7 @@ union meson_hdmi_venc_mode meson_hdmi_enci_mode_576i = { - .hso_end = 129, - .vso_even = 3, - .vso_odd = 260, -- .macv_max_amp = 8107, -+ .macv_max_amp = 0x7, - .video_prog_mode = 0xff, - .video_mode = 0x13, - .sch_adjust = 0x28, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0066-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch b/packages/linux/patches/amlogic/amlogic-0066-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch new file mode 100644 index 0000000000..2f54be8c60 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0066-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch @@ -0,0 +1,70 @@ +From 8c7fee8ff955e4afff1341859ee11c741f2e943a Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 19 Feb 2020 11:31:56 +0000 +Subject: [PATCH 066/146] WIP: arm64: dts: meson: add audio playback to wetek + hub + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 41 +++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts +index 83b985bb015e..5222c4e0fb61 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts +@@ -7,10 +7,51 @@ + /dts-v1/; + + #include "meson-gxbb-wetek.dtsi" ++#include + + / { + compatible = "wetek,hub", "amlogic,meson-gxbb"; + model = "WeTek Hub"; ++ ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-WETEK-HUB"; ++ 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &ir { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch b/packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch new file mode 100644 index 0000000000..03e46ea750 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch @@ -0,0 +1,89 @@ +From 539c1c15ac9f9fe95050ed7f8b8674a930dab927 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 18 Feb 2020 12:29:53 +0000 +Subject: [PATCH 067/146] WIP: arm64: dts: meson: add audio playback to wetek + play2 + +Signed-off-by: Christian Hewitt +--- + .../dts/amlogic/meson-gxbb-wetek-play2.dts | 57 +++++++++++++++++++ + 1 file changed, 57 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts +index 1d32d1f6d032..6c3925e66a56 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts +@@ -8,6 +8,7 @@ + + #include "meson-gxbb-wetek.dtsi" + #include ++#include + + / { + compatible = "wetek,play2", "amlogic,meson-gxbb"; +@@ -39,6 +40,62 @@ + gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>; + }; + }; ++ ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-WETEK-PLAY2"; ++ 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <512>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_y_pins>; ++ pinctrl-names = "default"; + }; + + &i2c_A { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0068-FROMLIST-arm64-dts-meson-g12b-add-cpus-OPP-tables.patch b/packages/linux/patches/amlogic/amlogic-0068-FROMLIST-arm64-dts-meson-g12b-add-cpus-OPP-tables.patch deleted file mode 100644 index 9f39a62d18..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0068-FROMLIST-arm64-dts-meson-g12b-add-cpus-OPP-tables.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 8fff8460f60a83b6bca994d5a74c04f986456eef Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:21 +0200 -Subject: [PATCH 068/187] FROMLIST: arm64: dts: meson-g12b: add cpus OPP tables - -Add the OPP table taken from the HardKernel Odroid-N2 DTS. - -The Amlogic G12B SoC seems to available in 2 types : -- low-speed: Cortex-A73 Cluster up to 1,704GHz -- high-speed: Cortex-A73 Cluster up to 2.208GHz - -The Cortex-A73 Cluster can be clocked up to 1,896GHz for both types. - -The Vendor Amlogic A311D OPP table are slighly different, with lower -voltages than the HardKernel S922X tables but seems to be high-speed type. - -This adds the conservative OPP table with the S922X higher voltages -and the maximum low-speed OPP frequency. - -The values were tested to be stable on an HardKernel Odroid-N2 board -running the arm64 cpuburn at [1] and cycling between all the possible -cpufreq translations for both clusters and checking the final frequency -using the clock-measurer, script at [2]. - -[1] https://github.com/ssvb/cpuburn-arm/blob/master/cpuburn-a53.S -[2] https://gist.github.com/superna9999/d4de964dbc0f84b7d527e1df2ddea25f - -Signed-off-by: Neil Armstrong ---- - arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 115 ++++++++++++++++++++ - 1 file changed, 115 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -index d5edbc1a1991..98ae8a7c8b41 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -@@ -95,6 +95,121 @@ - compatible = "cache"; - }; - }; -+ -+ cpu_opp_table_0: opp-table-0 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-666666666 { -+ opp-hz = /bits/ 64 <666666666>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <731000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <761000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <831000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1896000000 { -+ opp-hz = /bits/ 64 <1896000000>; -+ opp-microvolt = <981000>; -+ }; -+ }; -+ -+ cpub_opp_table_1: opp-table-1 { -+ compatible = "operating-points-v2"; -+ opp-shared; -+ -+ opp-100000000 { -+ opp-hz = /bits/ 64 <100000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-250000000 { -+ opp-hz = /bits/ 64 <250000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-500000000 { -+ opp-hz = /bits/ 64 <500000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-666666666 { -+ opp-hz = /bits/ 64 <666666666>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-1000000000 { -+ opp-hz = /bits/ 64 <1000000000>; -+ opp-microvolt = <751000>; -+ }; -+ -+ opp-1200000000 { -+ opp-hz = /bits/ 64 <1200000000>; -+ opp-microvolt = <771000>; -+ }; -+ -+ opp-1398000000 { -+ opp-hz = /bits/ 64 <1398000000>; -+ opp-microvolt = <791000>; -+ }; -+ -+ opp-1512000000 { -+ opp-hz = /bits/ 64 <1512000000>; -+ opp-microvolt = <821000>; -+ }; -+ -+ opp-1608000000 { -+ opp-hz = /bits/ 64 <1608000000>; -+ opp-microvolt = <861000>; -+ }; -+ -+ opp-1704000000 { -+ opp-hz = /bits/ 64 <1704000000>; -+ opp-microvolt = <891000>; -+ }; -+ }; - }; - - &clkc { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0131-HACK-fix-Kodi-sysinfo-CPU-information.patch b/packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch similarity index 78% rename from packages/linux/patches/amlogic/amlogic-0131-HACK-fix-Kodi-sysinfo-CPU-information.patch rename to packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch index 3fc5e38e57..e0470690e6 100644 --- a/packages/linux/patches/amlogic/amlogic-0131-HACK-fix-Kodi-sysinfo-CPU-information.patch +++ b/packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch @@ -1,7 +1,7 @@ -From 124cfc76bcc9eafb6ca5e608ba3044db489f6c68 Mon Sep 17 00:00:00 2001 +From 549431bd739f0516860784bbd3e96b901acd3f9d Mon Sep 17 00:00:00 2001 From: chewitt Date: Sat, 13 Apr 2019 05:45:18 +0000 -Subject: [PATCH 131/187] HACK: fix Kodi sysinfo CPU information +Subject: [PATCH 068/146] HACK: fix Kodi sysinfo CPU information This allows the CPU information to show in the Kodi sysinfo screen, e.g. @@ -13,10 +13,10 @@ Signed-off-by: Christian Hewitt 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c -index 876055e37352..b6e158430fe1 100644 +index 86136075ae41..f321dc2d8129 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c -@@ -139,8 +139,7 @@ static int c_show(struct seq_file *m, void *v) +@@ -147,8 +147,7 @@ static int c_show(struct seq_file *m, void *v) * "processor". Give glibc what it expects. */ seq_printf(m, "processor\t: %d\n", i); diff --git a/packages/linux/patches/amlogic/amlogic-0069-FROMLIST-arm64-dts-meson-g12b-odroid-n2-enable-DVFS.patch b/packages/linux/patches/amlogic/amlogic-0069-FROMLIST-arm64-dts-meson-g12b-odroid-n2-enable-DVFS.patch deleted file mode 100644 index 0f3e6e5c5a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0069-FROMLIST-arm64-dts-meson-g12b-odroid-n2-enable-DVFS.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 72424dbccd2b9c88a5958c536dce992a639777d3 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 29 Jul 2019 15:26:22 +0200 -Subject: [PATCH 069/187] FROMLIST: arm64: dts: meson-g12b-odroid-n2: enable - DVFS - -Enable DVFS for the Odroid-N2 by setting the clock, OPP and supply -for each cores of each CPU clusters. - -The first cluster uses the "VDDCPU_B" power supply, and the second -cluster uses the "VDDCPU_A" power supply. - -Each power supply can achieve 0.73V to 1.01V using 2 distinct PWM -outputs clocked at 800KHz with an inverse duty-cycle. - -DVFS has been tested by running the arm64 cpuburn at [1] and cycling -between all the possible cpufreq translations of each cluster and -checking the final frequency using the clock-measurer, script at [2]. - -[1] https://github.com/ssvb/cpuburn-arm/blob/master/cpuburn-a53.S -[2] https://gist.github.com/superna9999/d4de964dbc0f84b7d527e1df2ddea25f - -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong ---- - .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 96 +++++++++++++++++++ - 1 file changed, 96 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 237adae0ffae..6cfc2c69bb4f 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -115,6 +115,44 @@ - /* 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"; -@@ -246,6 +284,48 @@ - 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) */ -@@ -317,6 +397,22 @@ - pinctrl-names = "default"; - }; - -+&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"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch b/packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch new file mode 100644 index 0000000000..3c0c3a8051 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch @@ -0,0 +1,40 @@ +From d0ecb91fbd0224d36fb4a76ba9d373bdb398e642 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 7 Jan 2020 07:12:47 +0000 +Subject: [PATCH 069/146] HACK: media: cec: silence CEC timeout message + +If testing with an AVR that does not pass-through CEC state the system +log fills with timeout messages. Silence this to stop the log rotation +and ensure other issues are visible. + +[ 42.718009] cec-meson_ao_cec: message ff 84 50 00 01 timed out +[ 45.021994] cec-meson_ao_cec: message ff 87 00 15 82 timed out +[ 47.325965] cec-meson_ao_cec: message 10 timed out +[ 49.630023] cec-meson_ao_cec: message 10 timed out +[ 51.933960] cec-meson_ao_cec: message 10 timed out + +Signed-off-by: Christian Hewitt +--- + drivers/media/cec/cec-adap.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c +index 6c95dc471d4c..8613cc93eb93 100644 +--- a/drivers/media/cec/cec-adap.c ++++ b/drivers/media/cec/cec-adap.c +@@ -510,9 +510,9 @@ int cec_thread_func(void *_adap) + * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s). + */ + if (adap->transmitting) { +- pr_warn("cec-%s: message %*ph timed out\n", adap->name, +- adap->transmitting->msg.len, +- adap->transmitting->msg.msg); ++ //pr_warn("cec-%s: message %*ph timed out\n", adap->name, ++ // adap->transmitting->msg.len, ++ // adap->transmitting->msg.msg); + /* Just give up on this. */ + cec_data_cancel(adap->transmitting, + CEC_TX_STATUS_TIMEOUT); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0070-FROMLIST-dt-bindings-thermal-Add-DT-bindings-documen.patch b/packages/linux/patches/amlogic/amlogic-0070-FROMLIST-dt-bindings-thermal-Add-DT-bindings-documen.patch deleted file mode 100644 index dd22fcb163..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0070-FROMLIST-dt-bindings-thermal-Add-DT-bindings-documen.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 4c553d047b2117f7caf1ee3a352f1e5464f5d47b Mon Sep 17 00:00:00 2001 -From: Guillaume La Roque -Date: Tue, 6 Aug 2019 15:05:01 +0200 -Subject: [PATCH 070/187] FROMLIST: dt-bindings: thermal: Add DT bindings - documentation for Amlogic Thermal - -Adding the devicetree binding documentation for the Amlogic temperature -sensor found in the Amlogic Meson G12 SoCs. -the G12A and G12B SoCs are supported. - -Signed-off-by: Guillaume La Roque -Signed-off-by: Neil Armstrong ---- - .../bindings/thermal/amlogic,thermal.yaml | 54 +++++++++++++++++++ - 1 file changed, 54 insertions(+) - create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml - -diff --git a/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml b/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml -new file mode 100644 -index 000000000000..d25e59113398 ---- /dev/null -+++ b/Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml -@@ -0,0 +1,54 @@ -+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/thermal/amlogic,thermal.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Amlogic Thermal -+ -+maintainers: -+ - Guillaume La Roque -+ -+description: Binding for Amlogic Thermal Driver -+ -+properties: -+ compatible: -+ items: -+ - enum: -+ - amlogic,g12-cpu-thermal -+ - amlogic,g12-ddr-thermal -+ - const: amlogic,g12-thermal -+ -+ reg: -+ maxItems: 1 -+ -+ interrupts: -+ maxItems: 1 -+ -+ clocks: -+ maxItems: 1 -+ -+ amlogic,ao-secure: -+ description: phandle to the ao-secure syscon -+ $ref: '/schemas/types.yaml#/definitions/phandle' -+ -+ -+required: -+ - compatible -+ - reg -+ - interrupts -+ - clocks -+ - amlogic,ao-secure -+ -+examples: -+ - | -+ cpu_temp: temperature-sensor@ff634800 { -+ compatible = "amlogic,g12-cpu-thermal", -+ "amlogic,g12-thermal"; -+ reg = <0xff634800 0x50>; -+ interrupts = <0x0 0x24 0x0>; -+ clocks = <&clk 164>; -+ #thermal-sensor-cells = <0>; -+ amlogic,ao-secure = <&sec_AO>; -+ }; -+... --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch b/packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch new file mode 100644 index 0000000000..002d5802a2 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch @@ -0,0 +1,112 @@ +From 0ad39c62080a471c6f94ab64feb832728be37eda Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Thu, 12 Dec 2019 13:48:45 +0000 +Subject: [PATCH 070/146] HACK: revert mm: emit tracepoint when RSS changes + +--- + include/linux/mm.h | 14 +++----------- + include/trace/events/kmem.h | 28 ---------------------------- + mm/memory.c | 6 ------ + 3 files changed, 3 insertions(+), 45 deletions(-) + +diff --git a/include/linux/mm.h b/include/linux/mm.h +index 52269e56c514..e9d7fdacb676 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1629,27 +1629,19 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) + return (unsigned long)val; + } + +-void mm_trace_rss_stat(struct mm_struct *mm, int member, long count); +- + static inline void add_mm_counter(struct mm_struct *mm, int member, long value) + { +- long count = atomic_long_add_return(value, &mm->rss_stat.count[member]); +- +- mm_trace_rss_stat(mm, member, count); ++ atomic_long_add(value, &mm->rss_stat.count[member]); + } + + static inline void inc_mm_counter(struct mm_struct *mm, int member) + { +- long count = atomic_long_inc_return(&mm->rss_stat.count[member]); +- +- mm_trace_rss_stat(mm, member, count); ++ atomic_long_inc(&mm->rss_stat.count[member]); + } + + static inline void dec_mm_counter(struct mm_struct *mm, int member) + { +- long count = atomic_long_dec_return(&mm->rss_stat.count[member]); +- +- mm_trace_rss_stat(mm, member, count); ++ atomic_long_dec(&mm->rss_stat.count[member]); + } + + /* Optimized variant when page is already known not to be PageAnon */ +diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h +index f65b1f6db22d..788e049f899c 100644 +--- a/include/trace/events/kmem.h ++++ b/include/trace/events/kmem.h +@@ -335,34 +335,6 @@ static unsigned int __maybe_unused mm_ptr_to_hash(const void *ptr) + #define __PTR_TO_HASHVAL + #endif + +-TRACE_EVENT(rss_stat, +- +- TP_PROTO(struct mm_struct *mm, +- int member, +- long count), +- +- TP_ARGS(mm, member, count), +- +- TP_STRUCT__entry( +- __field(unsigned int, mm_id) +- __field(unsigned int, curr) +- __field(int, member) +- __field(long, size) +- ), +- +- TP_fast_assign( +- __entry->mm_id = mm_ptr_to_hash(mm); +- __entry->curr = !!(current->mm == mm); +- __entry->member = member; +- __entry->size = (count << PAGE_SHIFT); +- ), +- +- TP_printk("mm_id=%u curr=%d member=%d size=%ldB", +- __entry->mm_id, +- __entry->curr, +- __entry->member, +- __entry->size) +- ); + #endif /* _TRACE_KMEM_H */ + + /* This part must be outside protection */ +diff --git a/mm/memory.c b/mm/memory.c +index 0bccc622e482..958d68e8fa9e 100644 +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -72,8 +72,6 @@ + #include + #include + +-#include +- + #include + #include + #include +@@ -154,10 +152,6 @@ static int __init init_zero_pfn(void) + } + core_initcall(init_zero_pfn); + +-void mm_trace_rss_stat(struct mm_struct *mm, int member, long count) +-{ +- trace_rss_stat(mm, member, count); +-} + + #if defined(SPLIT_RSS_COUNTING) + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0071-FROMLIST-thermal-amlogic-Add-thermal-driver-to-suppo.patch b/packages/linux/patches/amlogic/amlogic-0071-FROMLIST-thermal-amlogic-Add-thermal-driver-to-suppo.patch deleted file mode 100644 index 624fd73d50..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0071-FROMLIST-thermal-amlogic-Add-thermal-driver-to-suppo.patch +++ /dev/null @@ -1,409 +0,0 @@ -From 1c545f91d3fe99df9abd4a835de702a3b37c5c7e Mon Sep 17 00:00:00 2001 -From: Guillaume La Roque -Date: Tue, 6 Aug 2019 15:05:02 +0200 -Subject: [PATCH 071/187] FROMLIST: thermal: amlogic: Add thermal driver to - support G12 SoCs - -Amlogic G12A and G12B SoCs integrate two thermal sensors -with the same design. -One is located close to the DDR controller and the other one is -located close to the PLLs (between the CPU and GPU). - -The calibration data for each of the thermal sensors instance is -stored in a different location within the AO region. - -Implement reading the temperature from each thermal sensor. - -The IP block has more functionality, which may be added to this driver -in the future: -- chip reset when the temperature exceeds a configurable threshold -- up to four interrupts when the temperature has risen above a -configurable threshold -- up to four interrupts when the temperature has fallen below a -configurable threshold - -Signed-off-by: Guillaume La Roque -Signed-off-by: Neil Armstrong ---- - drivers/thermal/Kconfig | 11 + - drivers/thermal/Makefile | 1 + - drivers/thermal/amlogic_thermal.c | 336 ++++++++++++++++++++++++++++++ - 3 files changed, 348 insertions(+) - create mode 100644 drivers/thermal/amlogic_thermal.c - -diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig -index 9966364a6deb..0f31bb4bc372 100644 ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -348,6 +348,17 @@ config MTK_THERMAL - Enable this option if you want to have support for thermal management - controller present in Mediatek SoCs - -+config AMLOGIC_THERMAL -+ tristate "Amlogic Thermal Support" -+ default ARCH_MESON -+ depends on OF && ARCH_MESON -+ help -+ If you say yes here you get support for Amlogic Thermal -+ for G12 SoC Family. -+ -+ This driver can also be built as a module. If so, the module will -+ be called amlogic_thermal. -+ - menu "Intel thermal drivers" - depends on X86 || X86_INTEL_QUARK || COMPILE_TEST - source "drivers/thermal/intel/Kconfig" -diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile -index 74a37c7f847a..baeb70bf0568 100644 ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -54,3 +54,4 @@ obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o - obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o - obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o - obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o -+obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o -diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c -new file mode 100644 -index 000000000000..672d11abd8c7 ---- /dev/null -+++ b/drivers/thermal/amlogic_thermal.c -@@ -0,0 +1,336 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Amlogic Thermal Sensor Driver -+ * -+ * Copyright (C) 2017 Huan Biao -+ * Copyright (C) 2019 Guillaume La Roque -+ * -+ * Register value to celsius temperature formulas: -+ * Read_Val m * U -+ * U = ---------, Uptat = --------- -+ * 2^16 1 + n * U -+ * -+ * Temperature = A * ( Uptat + u_efuse / 2^16 )- B -+ * -+ * A B m n : calibration parameters -+ * u_efuse : fused calibration value, it's a signed 16 bits value -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "thermal_core.h" -+ -+#define TSENSOR_CFG_REG1 0x4 -+ #define TSENSOR_CFG_REG1_RSET_VBG BIT(12) -+ #define TSENSOR_CFG_REG1_RSET_ADC BIT(11) -+ #define TSENSOR_CFG_REG1_VCM_EN BIT(10) -+ #define TSENSOR_CFG_REG1_VBG_EN BIT(9) -+ #define TSENSOR_CFG_REG1_OUT_CTL BIT(6) -+ #define TSENSOR_CFG_REG1_FILTER_EN BIT(5) -+ #define TSENSOR_CFG_REG1_DEM_EN BIT(3) -+ #define TSENSOR_CFG_REG1_CH_SEL GENMASK(1, 0) -+ #define TSENSOR_CFG_REG1_ENABLE \ -+ (TSENSOR_CFG_REG1_FILTER_EN | \ -+ TSENSOR_CFG_REG1_VCM_EN | \ -+ TSENSOR_CFG_REG1_VBG_EN | \ -+ TSENSOR_CFG_REG1_DEM_EN | \ -+ TSENSOR_CFG_REG1_CH_SEL) -+ -+#define TSENSOR_STAT0 0x40 -+ -+#define TSENSOR_STAT9 0x64 -+ -+#define TSENSOR_READ_TEMP_MASK GENMASK(15, 0) -+#define TSENSOR_TEMP_MASK GENMASK(11, 0) -+ -+#define TSENSOR_TRIM_SIGN_MASK BIT(15) -+#define TSENSOR_TRIM_TEMP_MASK GENMASK(14, 0) -+#define TSENSOR_TRIM_VERSION_MASK GENMASK(31, 24) -+ -+#define TSENSOR_TRIM_VERSION(_version) \ -+ FIELD_GET(TSENSOR_TRIM_VERSION_MASK, _version) -+ -+#define TSENSOR_TRIM_CALIB_VALID_MASK (GENMASK(3, 2) | BIT(7)) -+ -+#define TSENSOR_CALIB_OFFSET 1 -+#define TSENSOR_CALIB_SHIFT 4 -+ -+/** -+ * struct amlogic_thermal_soc_calib_data -+ * @A, B, m, n: calibration parameters -+ * This structure is required for configuration of amlogic thermal driver. -+ */ -+struct amlogic_thermal_soc_calib_data { -+ int A; -+ int B; -+ int m; -+ int n; -+}; -+ -+/** -+ * struct amlogic_thermal_data -+ * @u_efuse_off: register offset to read fused calibration value -+ * @soc: calibration parameters structure pointer -+ * @regmap_config: regmap config for the device -+ * This structure is required for configuration of amlogic thermal driver. -+ */ -+struct amlogic_thermal_data { -+ int u_efuse_off; -+ const struct amlogic_thermal_soc_calib_data *calibration_parameters; -+ const struct regmap_config *regmap_config; -+}; -+ -+struct amlogic_thermal { -+ struct platform_device *pdev; -+ const struct amlogic_thermal_data *data; -+ struct regmap *regmap; -+ struct regmap *sec_ao_map; -+ struct clk *clk; -+ struct thermal_zone_device *tzd; -+ u32 trim_info; -+ void __iomem *base; -+}; -+ -+/* -+ * Calculate a temperature value from a temperature code. -+ * The unit of the temperature is degree milliCelsius. -+ */ -+static int amlogic_thermal_code_to_millicelsius(struct amlogic_thermal *pdata, -+ int temp_code) -+{ -+ const struct amlogic_thermal_soc_calib_data *param = -+ pdata->data->calibration_parameters; -+ int temp; -+ s64 factor, Uptat, uefuse; -+ -+ uefuse = pdata->trim_info & TSENSOR_TRIM_SIGN_MASK ? -+ ~(pdata->trim_info & TSENSOR_TRIM_TEMP_MASK) + 1 : -+ (pdata->trim_info & TSENSOR_TRIM_TEMP_MASK); -+ -+ factor = param->n * temp_code; -+ factor = div_s64(factor, 100); -+ -+ Uptat = temp_code * param->m; -+ Uptat = div_s64(Uptat, 100); -+ Uptat = Uptat * BIT(16); -+ Uptat = div_s64(Uptat, BIT(16) + factor); -+ -+ temp = (Uptat + uefuse) * param->A; -+ temp = div_s64(temp, BIT(16)); -+ temp = (temp - param->B) * 100; -+ -+ return temp; -+} -+ -+static int amlogic_thermal_initialize(struct amlogic_thermal *pdata) -+{ -+ int ret = 0; -+ int ver; -+ -+ regmap_read(pdata->sec_ao_map, pdata->data->u_efuse_off, -+ &pdata->trim_info); -+ -+ ver = TSENSOR_TRIM_VERSION(pdata->trim_info); -+ -+ if ((ver & TSENSOR_TRIM_CALIB_VALID_MASK) == 0) { -+ ret = -EINVAL; -+ dev_err(&pdata->pdev->dev, -+ "tsensor thermal calibration not supported: 0x%x!\n", -+ ver); -+ } -+ -+ return ret; -+} -+ -+static int amlogic_thermal_enable(struct amlogic_thermal *data) -+{ -+ int ret; -+ -+ ret = clk_prepare_enable(data->clk); -+ if (ret) -+ return ret; -+ regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, -+ TSENSOR_CFG_REG1_ENABLE, TSENSOR_CFG_REG1_ENABLE); -+ -+ return 0; -+} -+ -+static int amlogic_thermal_disable(struct amlogic_thermal *data) -+{ -+ regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, -+ TSENSOR_CFG_REG1_ENABLE, 0); -+ clk_disable_unprepare(data->clk); -+ -+ return 0; -+} -+ -+static int amlogic_thermal_get_temp(void *data, int *temp) -+{ -+ unsigned int tval; -+ struct amlogic_thermal *pdata = data; -+ -+ if (!data) -+ return -EINVAL; -+ -+ regmap_read(pdata->regmap, TSENSOR_STAT0, &tval); -+ *temp = -+ amlogic_thermal_code_to_millicelsius(pdata, -+ tval & TSENSOR_READ_TEMP_MASK); -+ -+ return 0; -+} -+ -+static const struct thermal_zone_of_device_ops amlogic_thermal_ops = { -+ .get_temp = amlogic_thermal_get_temp, -+}; -+ -+static const struct regmap_config amlogic_thermal_regmap_config_g12 = { -+ .reg_bits = 8, -+ .val_bits = 32, -+ .reg_stride = 4, -+ .max_register = TSENSOR_STAT9, -+}; -+ -+static const struct amlogic_thermal_soc_calib_data amlogic_thermal_g12 = { -+ .A = 9411, -+ .B = 3159, -+ .m = 424, -+ .n = 324, -+}; -+ -+static const struct amlogic_thermal_data amlogic_thermal_g12_cpu_param = { -+ .u_efuse_off = 0x128, -+ .calibration_parameters = &amlogic_thermal_g12, -+ .regmap_config = &amlogic_thermal_regmap_config_g12, -+}; -+ -+static const struct amlogic_thermal_data amlogic_thermal_g12_ddr_param = { -+ .u_efuse_off = 0xf0, -+ .calibration_parameters = &amlogic_thermal_g12, -+ .regmap_config = &amlogic_thermal_regmap_config_g12, -+}; -+ -+static const struct of_device_id of_amlogic_thermal_match[] = { -+ { -+ .compatible = "amlogic,g12-ddr-thermal", -+ .data = &amlogic_thermal_g12_ddr_param, -+ }, -+ { -+ .compatible = "amlogic,g12-cpu-thermal", -+ .data = &amlogic_thermal_g12_cpu_param, -+ }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, of_amlogic_thermal_match); -+ -+static int amlogic_thermal_probe(struct platform_device *pdev) -+{ -+ struct amlogic_thermal *pdata; -+ struct device *dev = &pdev->dev; -+ struct resource *res; -+ int ret; -+ -+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); -+ if (!pdata) -+ return -ENOMEM; -+ -+ pdata->data = of_device_get_match_data(dev); -+ pdata->pdev = pdev; -+ platform_set_drvdata(pdev, pdata); -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ pdata->base = devm_ioremap_resource(dev, res); -+ if (IS_ERR(pdata->base)) { -+ dev_err(dev, "failed to get io address\n"); -+ return PTR_ERR(pdata->base); -+ } -+ -+ pdata->regmap = devm_regmap_init_mmio(dev, pdata->base, -+ pdata->data->regmap_config); -+ if (IS_ERR(pdata->regmap)) -+ return PTR_ERR(pdata->regmap); -+ -+ pdata->clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(pdata->clk)) { -+ if (PTR_ERR(pdata->clk) != -EPROBE_DEFER) -+ dev_err(dev, "failed to get clock\n"); -+ return PTR_ERR(pdata->clk); -+ } -+ -+ pdata->sec_ao_map = syscon_regmap_lookup_by_phandle -+ (pdev->dev.of_node, "amlogic,ao-secure"); -+ if (IS_ERR(pdata->sec_ao_map)) { -+ dev_err(dev, "syscon regmap lookup failed.\n"); -+ return PTR_ERR(pdata->sec_ao_map); -+ } -+ -+ pdata->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, -+ 0, -+ pdata, -+ &amlogic_thermal_ops); -+ if (IS_ERR(pdata->tzd)) { -+ ret = PTR_ERR(pdata->tzd); -+ dev_err(dev, "Failed to register tsensor: %d\n", ret); -+ return PTR_ERR(pdata->tzd); -+ } -+ -+ ret = amlogic_thermal_initialize(pdata); -+ if (ret) -+ return ret; -+ -+ ret = amlogic_thermal_enable(pdata); -+ if (ret) -+ clk_disable_unprepare(pdata->clk); -+ -+ return ret; -+} -+ -+static int amlogic_thermal_remove(struct platform_device *pdev) -+{ -+ struct amlogic_thermal *data = platform_get_drvdata(pdev); -+ -+ return amlogic_thermal_disable(data); -+} -+ -+static int __maybe_unused amlogic_thermal_suspend(struct device *dev) -+{ -+ struct amlogic_thermal *data = dev_get_drvdata(dev); -+ -+ return amlogic_thermal_disable(data); -+} -+ -+static int __maybe_unused amlogic_thermal_resume(struct device *dev) -+{ -+ struct amlogic_thermal *data = dev_get_drvdata(dev); -+ -+ return amlogic_thermal_enable(data); -+} -+ -+static SIMPLE_DEV_PM_OPS(amlogic_thermal_pm_ops, -+ amlogic_thermal_suspend, amlogic_thermal_resume); -+ -+static struct platform_driver amlogic_thermal_driver = { -+ .driver = { -+ .name = "amlogic_thermal", -+ .pm = &amlogic_thermal_pm_ops, -+ .of_match_table = of_amlogic_thermal_match, -+ }, -+ .probe = amlogic_thermal_probe, -+ .remove = amlogic_thermal_remove, -+}; -+ -+module_platform_driver(amlogic_thermal_driver); -+ -+MODULE_AUTHOR("Guillaume La Roque "); -+MODULE_DESCRIPTION("Amlogic thermal driver"); -+MODULE_LICENSE("GPL v2"); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0071-HACK-mmc-meson-gx-force-max_segs-max_blk_count-value.patch b/packages/linux/patches/amlogic/amlogic-0071-HACK-mmc-meson-gx-force-max_segs-max_blk_count-value.patch new file mode 100644 index 0000000000..b3c05e7f30 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0071-HACK-mmc-meson-gx-force-max_segs-max_blk_count-value.patch @@ -0,0 +1,37 @@ +From 91500a871db490d0f1b0be10cb1481c06d096234 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Tue, 24 Dec 2019 05:50:45 +0000 +Subject: [PATCH 071/146] HACK: mmc: meson-gx: force max_segs/max_blk_count + values in dram access quirk + +Temporary workaround for the G12A and G12B SDIO chip bug that causes sdio +issues with brcmfmac. Patch is based on [1] by @hyphop (Khadas) and hints +from @superna9999. + +[1] https://github.com/hyphop/khadas-linux-kernel/blob/master/patches/linux-5.4.5/0005-VIM3_wifi_hack.patch + +Signed-off-by: Christian Hewitt +--- + drivers/mmc/host/meson-gx-mmc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c +index 35400cf2a2e4..a49f63791b0e 100644 +--- a/drivers/mmc/host/meson-gx-mmc.c ++++ b/drivers/mmc/host/meson-gx-mmc.c +@@ -1144,8 +1144,10 @@ static int meson_mmc_probe(struct platform_device *pdev) + mmc->caps |= MMC_CAP_CMD23; + if (host->dram_access_quirk) { + /* Limit to the available sram memory */ +- mmc->max_segs = SD_EMMC_SRAM_DATA_BUF_LEN / mmc->max_blk_size; +- mmc->max_blk_count = mmc->max_segs; ++ //mmc->max_segs = SD_EMMC_SRAM_DATA_BUF_LEN / mmc->max_blk_size; ++ //mmc->max_blk_count = mmc->max_segs; ++ mmc->max_segs = 1; ++ mmc->max_blk_count = 2; + } else { + mmc->max_blk_count = CMD_CFG_LENGTH_MASK; + mmc->max_segs = SD_EMMC_DESC_BUF_LEN / +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0072-FROMLIST-arm64-dts-amlogic-g12-add-temperature-senso.patch b/packages/linux/patches/amlogic/amlogic-0072-FROMLIST-arm64-dts-amlogic-g12-add-temperature-senso.patch deleted file mode 100644 index 408d2252c8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0072-FROMLIST-arm64-dts-amlogic-g12-add-temperature-senso.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 172e6c28c86207dc6c6dcac6937f230f7064e85c Mon Sep 17 00:00:00 2001 -From: Guillaume La Roque -Date: Tue, 6 Aug 2019 15:05:03 +0200 -Subject: [PATCH 072/187] FROMLIST: arm64: dts: amlogic: g12: add temperature - sensor - -Add cpu and ddr temperature sensors for G12 Socs - -Signed-off-by: Guillaume La Roque -Reviewed-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong ---- - .../boot/dts/amlogic/meson-g12-common.dtsi | 20 +++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index 27bb242dc95d..71fd725dee77 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -1355,6 +1355,26 @@ - }; - }; - -+ cpu_temp: temperature-sensor@34800 { -+ compatible = "amlogic,g12-cpu-thermal", -+ "amlogic,g12-thermal"; -+ reg = <0x0 0x34800 0x0 0x50>; -+ interrupts = ; -+ clocks = <&clkc CLKID_TS>; -+ #thermal-sensor-cells = <0>; -+ amlogic,ao-secure = <&sec_AO>; -+ }; -+ -+ ddr_temp: temperature-sensor@34c00 { -+ compatible = "amlogic,g12-ddr-thermal", -+ "amlogic,g12-thermal"; -+ reg = <0x0 0x34c00 0x0 0x50>; -+ interrupts = ; -+ clocks = <&clkc CLKID_TS>; -+ #thermal-sensor-cells = <0>; -+ amlogic,ao-secure = <&sec_AO>; -+ }; -+ - usb2_phy0: phy@36000 { - compatible = "amlogic,g12a-usb2-phy"; - reg = <0x0 0x36000 0x0 0x2000>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0136-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch b/packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch similarity index 85% rename from packages/linux/patches/amlogic/amlogic-0136-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch rename to packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch index c6d70291ef..b1d65b487e 100644 --- a/packages/linux/patches/amlogic/amlogic-0136-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch +++ b/packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch @@ -1,7 +1,7 @@ -From b2e8a3e8eb2d14647c4ebf75a28f25e4ce4ac6cb Mon Sep 17 00:00:00 2001 +From 6cd56ed16246f8022a963438975c669dd9540206 Mon Sep 17 00:00:00 2001 From: kszaq Date: Sat, 6 Jul 2019 07:54:44 +0000 -Subject: [PATCH 136/187] HACK: arm64: dts: meson-gx: add ATF BL32 reserved +Subject: [PATCH 072/146] HACK: arm64: dts: meson-gx: add ATF BL32 reserved memory region Vendor firmware/uboot has an additional reserved region for BL32 trusted @@ -16,7 +16,7 @@ Signed-off-by: kszaq 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -index 0ed78e10ce98..5a5cfaad3f5f 100644 +index 962a56e0e8b4..3f55ef2ae021 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi @@ -41,6 +41,12 @@ diff --git a/packages/linux/patches/amlogic/amlogic-0073-FROMLIST-arm64-dts-meson-sei510-Add-minimal-thermal-.patch b/packages/linux/patches/amlogic/amlogic-0073-FROMLIST-arm64-dts-meson-sei510-Add-minimal-thermal-.patch deleted file mode 100644 index a9e5c2b012..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0073-FROMLIST-arm64-dts-meson-sei510-Add-minimal-thermal-.patch +++ /dev/null @@ -1,129 +0,0 @@ -From de8e242975fb7b191a50581028f3a68f842f8e16 Mon Sep 17 00:00:00 2001 -From: Guillaume La Roque -Date: Tue, 6 Aug 2019 15:05:04 +0200 -Subject: [PATCH 073/187] FROMLIST: arm64: dts: meson: sei510: Add minimal - thermal zone - -Add minimal thermal zone for two temperature sensor -One is located close to the DDR and the other one is -located close to the PLLs (between the CPU and GPU) - -Signed-off-by: Guillaume La Roque -Acked-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong ---- - .../boot/dts/amlogic/meson-g12a-sei510.dts | 56 +++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -index c9fa23a56562..3e8621d7e6a5 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - / { - compatible = "seirobotics,sei510", "amlogic,g12a"; -@@ -33,6 +34,53 @@ - ethernet0 = ðmac; - }; - -+ thermal-zones { -+ cpu-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&cpu_temp>; -+ -+ trips { -+ cpu_critical: cpu-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&cpu_critical>; -+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ -+ ddr-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&ddr_temp>; -+ -+ trips { -+ ddr_critical: ddr-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&ddr_critical>; -+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ }; -+ - mono_dac: audio-codec-0 { - compatible = "maxim,max98357a"; - #sound-dai-cells = <0>; -@@ -321,6 +369,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu1 { -@@ -328,6 +377,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu2 { -@@ -335,6 +385,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu3 { -@@ -342,6 +393,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cvbs_vdac_port { -@@ -368,6 +420,10 @@ - status = "okay"; - }; - -+&mali { -+ #cooling-cells = <2>; -+}; -+ - &hdmi_tx { - status = "okay"; - pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0130-HACK-set-meson-gx-cma-pool-to-896MB.patch b/packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch similarity index 79% rename from packages/linux/patches/amlogic/amlogic-0130-HACK-set-meson-gx-cma-pool-to-896MB.patch rename to packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch index 7eb9e34140..4d1b2b6c44 100644 --- a/packages/linux/patches/amlogic/amlogic-0130-HACK-set-meson-gx-cma-pool-to-896MB.patch +++ b/packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch @@ -1,7 +1,7 @@ -From f90560cb0a13699cab17ad0b7c71a54dd9847c95 Mon Sep 17 00:00:00 2001 +From e78756bc70272b72ef1c02d8b7dec66ad5db8eb6 Mon Sep 17 00:00:00 2001 From: chewitt Date: Sat, 13 Apr 2019 05:41:51 +0000 -Subject: [PATCH 130/187] HACK: set meson-gx cma pool to 896MB +Subject: [PATCH 073/146] HACK: set meson-gx cma pool to 896MB This change sets the CMA pool to a larger 896MB! value for (WIP) vdec use @@ -11,10 +11,10 @@ Signed-off-by: Christian Hewitt 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -index 65155abbe082..0ed78e10ce98 100644 +index 3f55ef2ae021..807db6e73a49 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -44,7 +44,7 @@ +@@ -50,7 +50,7 @@ linux,cma { compatible = "shared-dma-pool"; reusable; diff --git a/packages/linux/patches/amlogic/amlogic-0074-FROMLIST-arm64-dts-amlogic-odroid-n2-add-minimal-the.patch b/packages/linux/patches/amlogic/amlogic-0074-FROMLIST-arm64-dts-amlogic-odroid-n2-add-minimal-the.patch deleted file mode 100644 index 08603b85d0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0074-FROMLIST-arm64-dts-amlogic-odroid-n2-add-minimal-the.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 218e3c2f2bb65d75f964c8e359b09116655bb678 Mon Sep 17 00:00:00 2001 -From: Guillaume La Roque -Date: Tue, 6 Aug 2019 15:05:05 +0200 -Subject: [PATCH 074/187] FROMLIST: arm64: dts: amlogic: odroid-n2: add minimal - thermal zone - -Add minimal thermal zone for two temperature sensor -One is located close to the DDR and the other one is -located close to the PLLs (between the CPU and GPU) - -Signed-off-by: Guillaume La Roque -Acked-by: Martin Blumenstingl -Signed-off-by: Neil Armstrong ---- - .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 60 +++++++++++++++++++ - 1 file changed, 60 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 6cfc2c69bb4f..57c84aa9890c 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - / { - compatible = "hardkernel,odroid-n2", "amlogic,g12b"; -@@ -20,6 +21,55 @@ - ethernet0 = ðmac; - }; - -+ thermal-zones { -+ cpu-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&cpu_temp>; -+ -+ trips { -+ cpu_critical: cpu-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&cpu_critical>; -+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ -+ ddr-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&ddr_temp>; -+ -+ trips { -+ ddr_critical: ddr-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&ddr_critical>; -+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -289,6 +339,7 @@ - operating-points-v2 = <&cpu_opp_table_0>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu1 { -@@ -296,6 +347,7 @@ - operating-points-v2 = <&cpu_opp_table_0>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu100 { -@@ -303,6 +355,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu101 { -@@ -310,6 +363,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu102 { -@@ -317,6 +371,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu103 { -@@ -324,6 +379,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &ext_mdio { -@@ -378,6 +434,10 @@ - }; - }; - -+&mali { -+ #cooling-cells = <2>; -+}; -+ - &hdmi_tx { - status = "okay"; - pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0129-HACK-set-meson-g12-cma-pool-to-896MB.patch b/packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch similarity index 80% rename from packages/linux/patches/amlogic/amlogic-0129-HACK-set-meson-g12-cma-pool-to-896MB.patch rename to packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch index fab25f93de..7ad6af16e2 100644 --- a/packages/linux/patches/amlogic/amlogic-0129-HACK-set-meson-g12-cma-pool-to-896MB.patch +++ b/packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch @@ -1,7 +1,7 @@ -From bebe3a1088285bf3a6aef30ee33fdf01dc7f3035 Mon Sep 17 00:00:00 2001 +From 6f2a3ca26bc7cfb7a06da5241f6e9432bea9197a Mon Sep 17 00:00:00 2001 From: chewitt Date: Wed, 14 Aug 2019 19:58:14 +0000 -Subject: [PATCH 129/187] HACK: set meson-g12 cma pool to 896MB +Subject: [PATCH 074/146] HACK: set meson-g12 cma pool to 896MB This change sets the CMA pool to a larger 896MB! value for (WIP) vdec use @@ -11,10 +11,10 @@ Signed-off-by: Christian Hewitt 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index e4aa4a3b06bd..a006c712074f 100644 +index 4625bdd08c07..3deace05d345 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -80,7 +80,7 @@ +@@ -71,7 +71,7 @@ linux,cma { compatible = "shared-dma-pool"; reusable; diff --git a/packages/linux/patches/amlogic/amlogic-0075-FROMLIST-MAINTAINERS-add-entry-for-Amlogic-Thermal-d.patch b/packages/linux/patches/amlogic/amlogic-0075-FROMLIST-MAINTAINERS-add-entry-for-Amlogic-Thermal-d.patch deleted file mode 100644 index 4182f92239..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0075-FROMLIST-MAINTAINERS-add-entry-for-Amlogic-Thermal-d.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 9454987725e4b5ba6d97bb965ce20cdc12c4c25e Mon Sep 17 00:00:00 2001 -From: Guillaume La Roque -Date: Tue, 6 Aug 2019 15:05:06 +0200 -Subject: [PATCH 075/187] FROMLIST: MAINTAINERS: add entry for Amlogic Thermal - driver - -Add myself as maintainer for Amlogic Thermal driver. - -Signed-off-by: Guillaume La Roque -Reviewed-by: Neil Armstrong -Signed-off-by: Neil Armstrong ---- - MAINTAINERS | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/MAINTAINERS b/MAINTAINERS -index a50e97a63bc8..9c389c6a8e44 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -15940,6 +15940,15 @@ F: Documentation/thermal/cpu-cooling-api.rst - F: drivers/thermal/cpu_cooling.c - F: include/linux/cpu_cooling.h - -+THERMAL DRIVER FOR AMLOGIC SOCS -+M: Guillaume La Roque -+L: linux-pm@vger.kernel.org -+L: linux-amlogic@lists.infradead.org -+W: http://linux-meson.com/ -+S: Supported -+F: drivers/thermal/amlogic_thermal.c -+F: Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml -+ - THINKPAD ACPI EXTRAS DRIVER - M: Henrique de Moraes Holschuh - L: ibm-acpi-devel@lists.sourceforge.net --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0086-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch b/packages/linux/patches/amlogic/amlogic-0075-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch similarity index 86% rename from packages/linux/patches/amlogic/amlogic-0086-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch rename to packages/linux/patches/amlogic/amlogic-0075-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch index 6d4454342f..4e5719adb3 100644 --- a/packages/linux/patches/amlogic/amlogic-0086-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch +++ b/packages/linux/patches/amlogic/amlogic-0075-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch @@ -1,19 +1,19 @@ -From 298ce9d58ec4bbe0d1106d37cd8fddea0c83f4f2 Mon Sep 17 00:00:00 2001 +From e78d4dc4e45bbc6cb77c9c16ffb06c25a7bbbe17 Mon Sep 17 00:00:00 2001 From: Igor Vavro Date: Sat, 10 Aug 2019 13:55:34 +0000 -Subject: [PATCH 086/187] FROMLIST: pinctrl: meson: add missing tsin pinctrl +Subject: [PATCH 075/146] FROMLIST: pinctrl: meson: add missing tsin pinctrl for meson gxbb/gxl This patch adds missing tsin pinctrl definitions for meson gxbb and gxl/gxm Signed-off-by: Igor Vavro --- - drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 35 ++++++++++++++++++++++ - drivers/pinctrl/meson/pinctrl-meson-gxl.c | 27 +++++++++++++++++ - 2 files changed, 62 insertions(+) + drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 43 ++++++++++++++++++++-- + drivers/pinctrl/meson/pinctrl-meson-gxl.c | 27 ++++++++++++++ + 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c -index 6c640837073e..eaedc8d67900 100644 +index 926b9997159a..25325235d82f 100644 --- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c +++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c @@ -231,10 +231,24 @@ static const unsigned int hdmi_hpd_pins[] = { GPIOH_0 }; @@ -41,7 +41,7 @@ index 6c640837073e..eaedc8d67900 100644 static const unsigned int spdif_out_y_pins[] = { GPIOY_12 }; static const unsigned int gen_clk_out_pins[] = { GPIOY_15 }; -@@ -437,8 +451,18 @@ static struct meson_pmx_group meson_gxbb_periphs_groups[] = { +@@ -437,12 +451,22 @@ static struct meson_pmx_group meson_gxbb_periphs_groups[] = { GROUP(pwm_a_x, 3, 17), GROUP(pwm_e, 2, 30), GROUP(pwm_f_x, 3, 18), @@ -51,15 +51,23 @@ index 6c640837073e..eaedc8d67900 100644 + GROUP(tsin_b_d0, 3, 7), /* Bank Y */ +- GROUP(uart_cts_c, 1, 17), +- GROUP(uart_rts_c, 1, 16), +- GROUP(uart_tx_c, 1, 19), +- GROUP(uart_rx_c, 1, 18), + GROUP(tsin_a_fail, 3, 3), + GROUP(tsin_a_d_valid, 3, 2), + GROUP(tsin_a_sop, 3, 1), + GROUP(tsin_a_clk, 3, 0), + GROUP(tsin_a_d0, 3, 4), + GROUP(tsin_a_dp, 3, 5), - GROUP(uart_cts_c, 1, 19), - GROUP(uart_rts_c, 1, 18), - GROUP(uart_tx_c, 1, 17), ++ GROUP(uart_cts_c, 1, 19), ++ GROUP(uart_rts_c, 1, 18), ++ GROUP(uart_tx_c, 1, 17), ++ GROUP(uart_rx_c, 1, 16), + GROUP(pwm_a_y, 1, 21), + GROUP(pwm_f_y, 1, 20), + GROUP(i2s_out_ch23_y, 1, 5), @@ -601,6 +625,15 @@ static const char * const gpio_periphs_groups[] = { "GPIOX_20", "GPIOX_21", "GPIOX_22", }; @@ -86,7 +94,7 @@ index 6c640837073e..eaedc8d67900 100644 static struct meson_pmx_func meson_gxbb_aobus_functions[] = { diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c -index 72c5373c8dc1..759245e29710 100644 +index 1b6e8646700f..45d58311db27 100644 --- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c +++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c @@ -241,6 +241,17 @@ static const unsigned int tsin_a_dp_pins[] = { diff --git a/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-doc-dt-bindings-usb-dwc3-Update-entries-for.patch b/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-doc-dt-bindings-usb-dwc3-Update-entries-for.patch new file mode 100644 index 0000000000..3e0cd713b9 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-doc-dt-bindings-usb-dwc3-Update-entries-for.patch @@ -0,0 +1,34 @@ +From ad6f8481a1aec44752921c6a45f5703ae5caed00 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 17 Oct 2019 21:03:22 +0000 +Subject: [PATCH 076/146] FROMLIST: doc: dt: bindings: usb: dwc3: Update + entries for disabling SS instances in park mode + +This patch updates the documentation with the information related +to the quirks that needs to be added for disabling all SuperSpeed XHCi +instances in park mode. + +CC: Dongjin Kim +Cc: Jianxin Pan +Reported-by: Tim +Signed-off-by: Neil Armstrong +--- + Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt +index 66780a47ad85..c977a3ba2f35 100644 +--- a/Documentation/devicetree/bindings/usb/dwc3.txt ++++ b/Documentation/devicetree/bindings/usb/dwc3.txt +@@ -75,6 +75,8 @@ Optional properties: + from P0 to P1/P2/P3 without delay. + - snps,dis-tx-ipgap-linecheck-quirk: when set, disable u2mac linestate check + during HS transmit. ++ - snps,parkmode-disable-ss-quirk: when set, all SuperSpeed bus instances in ++ park mode are disabled. + - snps,dis_metastability_quirk: when set, disable metastability workaround. + CAUTION: use only if you are absolutely sure of it. + - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-drm-bridge-dw-hdmi-i2s-support-more-i2s-for.patch b/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-drm-bridge-dw-hdmi-i2s-support-more-i2s-for.patch deleted file mode 100644 index bb4da6c8af..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-drm-bridge-dw-hdmi-i2s-support-more-i2s-for.patch +++ /dev/null @@ -1,82 +0,0 @@ -From f83aaf878245ba8f757fa00cb86dd610f0dfd7eb Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:19 +0200 -Subject: [PATCH 076/187] FROMLIST: drm/bridge: dw-hdmi-i2s: support more i2s - format - -The dw-hdmi-i2s supports more formats than just regular i2s. -Add support for left justified, right justified and dsp modes -A and B. - -Reviewed-by: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - .../drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 26 ++++++++++++++++--- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 6 +++-- - 2 files changed, 27 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index 5cbb71a866d5..2b624cff541d 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -44,9 +44,8 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - u8 inputclkfs = 0; - - /* it cares I2S only */ -- if ((fmt->fmt != HDMI_I2S) || -- (fmt->bit_clk_master | fmt->frame_clk_master)) { -- dev_err(dev, "unsupported format/settings\n"); -+ if (fmt->bit_clk_master | fmt->frame_clk_master) { -+ dev_err(dev, "unsupported clock settings\n"); - return -EINVAL; - } - -@@ -63,6 +62,27 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - break; - } - -+ switch (fmt->fmt) { -+ case HDMI_I2S: -+ conf1 |= HDMI_AUD_CONF1_MODE_I2S; -+ break; -+ case HDMI_RIGHT_J: -+ conf1 |= HDMI_AUD_CONF1_MODE_RIGHT_J; -+ break; -+ case HDMI_LEFT_J: -+ conf1 |= HDMI_AUD_CONF1_MODE_LEFT_J; -+ break; -+ case HDMI_DSP_A: -+ conf1 |= HDMI_AUD_CONF1_MODE_BURST_1; -+ break; -+ case HDMI_DSP_B: -+ conf1 |= HDMI_AUD_CONF1_MODE_BURST_2; -+ break; -+ default: -+ dev_err(dev, "unsupported format\n"); -+ return -EINVAL; -+ } -+ - dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); - - hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -index 4e3ec09d3ca4..091d7c28aa17 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -@@ -869,8 +869,10 @@ enum { - - /* AUD_CONF1 field values */ - HDMI_AUD_CONF1_MODE_I2S = 0x00, -- HDMI_AUD_CONF1_MODE_RIGHT_J = 0x02, -- HDMI_AUD_CONF1_MODE_LEFT_J = 0x04, -+ HDMI_AUD_CONF1_MODE_RIGHT_J = 0x20, -+ HDMI_AUD_CONF1_MODE_LEFT_J = 0x40, -+ HDMI_AUD_CONF1_MODE_BURST_1 = 0x60, -+ HDMI_AUD_CONF1_MODE_BURST_2 = 0x80, - HDMI_AUD_CONF1_WIDTH_16 = 0x10, - HDMI_AUD_CONF1_WIDTH_24 = 0x18, - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-drm-bridge-dw-hdmi-move-audio-channel-setup.patch b/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-drm-bridge-dw-hdmi-move-audio-channel-setup.patch deleted file mode 100644 index 3515d09668..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-drm-bridge-dw-hdmi-move-audio-channel-setup.patch +++ /dev/null @@ -1,127 +0,0 @@ -From a2f80afa03c22f54a69e3c59cdf3e74990b9f0bd Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:20 +0200 -Subject: [PATCH 077/187] FROMLIST: drm/bridge: dw-hdmi: move audio channel - setup out of ahb - -Part of the channel count setup done in dw-hdmi ahb should -actually be done whatever the interface providing the data. - -Reviewed-by: Jonas Karlman -Let's move it to dw-hdmi driver instead. - -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - .../drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 20 +++--------- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 32 +++++++++++++++++++ - include/drm/bridge/dw_hdmi.h | 2 ++ - 3 files changed, 38 insertions(+), 16 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c -index a494186ae6ce..2b7539701b42 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c -@@ -63,10 +63,6 @@ enum { - HDMI_REVISION_ID = 0x0001, - HDMI_IH_AHBDMAAUD_STAT0 = 0x0109, - HDMI_IH_MUTE_AHBDMAAUD_STAT0 = 0x0189, -- HDMI_FC_AUDICONF2 = 0x1027, -- HDMI_FC_AUDSCONF = 0x1063, -- HDMI_FC_AUDSCONF_LAYOUT1 = 1 << 0, -- HDMI_FC_AUDSCONF_LAYOUT0 = 0 << 0, - HDMI_AHB_DMA_CONF0 = 0x3600, - HDMI_AHB_DMA_START = 0x3601, - HDMI_AHB_DMA_STOP = 0x3602, -@@ -403,7 +399,7 @@ static int dw_hdmi_prepare(struct snd_pcm_substream *substream) - { - struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_dw_hdmi *dw = substream->private_data; -- u8 threshold, conf0, conf1, layout, ca; -+ u8 threshold, conf0, conf1, ca; - - /* Setup as per 3.0.5 FSL 4.1.0 BSP */ - switch (dw->revision) { -@@ -434,20 +430,12 @@ static int dw_hdmi_prepare(struct snd_pcm_substream *substream) - conf1 = default_hdmi_channel_config[runtime->channels - 2].conf1; - ca = default_hdmi_channel_config[runtime->channels - 2].ca; - -- /* -- * For >2 channel PCM audio, we need to select layout 1 -- * and set an appropriate channel map. -- */ -- if (runtime->channels > 2) -- layout = HDMI_FC_AUDSCONF_LAYOUT1; -- else -- layout = HDMI_FC_AUDSCONF_LAYOUT0; -- - writeb_relaxed(threshold, dw->data.base + HDMI_AHB_DMA_THRSLD); - writeb_relaxed(conf0, dw->data.base + HDMI_AHB_DMA_CONF0); - writeb_relaxed(conf1, dw->data.base + HDMI_AHB_DMA_CONF1); -- writeb_relaxed(layout, dw->data.base + HDMI_FC_AUDSCONF); -- writeb_relaxed(ca, dw->data.base + HDMI_FC_AUDICONF2); -+ -+ dw_hdmi_set_channel_count(dw->data.hdmi, runtime->channels); -+ dw_hdmi_set_channel_allocation(dw->data.hdmi, ca); - - switch (runtime->format) { - case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 218a7b2308f7..be6d6819bef4 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -645,6 +645,38 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) - } - EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate); - -+void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt) -+{ -+ u8 layout; -+ -+ mutex_lock(&hdmi->audio_mutex); -+ -+ /* -+ * For >2 channel PCM audio, we need to select layout 1 -+ * and set an appropriate channel map. -+ */ -+ if (cnt > 2) -+ layout = HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_LAYOUT1; -+ else -+ layout = HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_LAYOUT0; -+ -+ hdmi_modb(hdmi, layout, HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_MASK, -+ HDMI_FC_AUDSCONF); -+ -+ mutex_unlock(&hdmi->audio_mutex); -+} -+EXPORT_SYMBOL_GPL(dw_hdmi_set_channel_count); -+ -+void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca) -+{ -+ mutex_lock(&hdmi->audio_mutex); -+ -+ hdmi_writeb(hdmi, ca, HDMI_FC_AUDICONF2); -+ -+ mutex_unlock(&hdmi->audio_mutex); -+} -+EXPORT_SYMBOL_GPL(dw_hdmi_set_channel_allocation); -+ - static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) - { - if (enable) -diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index c402364aec0d..cf528c289857 100644 ---- a/include/drm/bridge/dw_hdmi.h -+++ b/include/drm/bridge/dw_hdmi.h -@@ -155,6 +155,8 @@ void dw_hdmi_resume(struct dw_hdmi *hdmi); - void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); - - void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); -+void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt); -+void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca); - void dw_hdmi_audio_enable(struct dw_hdmi *hdmi); - void dw_hdmi_audio_disable(struct dw_hdmi *hdmi); - void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-usb-dwc3-gadget-Add-support-for-disabling-S.patch b/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-usb-dwc3-gadget-Add-support-for-disabling-S.patch new file mode 100644 index 0000000000..29f8e95ebf --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-usb-dwc3-gadget-Add-support-for-disabling-S.patch @@ -0,0 +1,85 @@ +From aee4900b43ffcc9641d0f16199294f6631d97e22 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 17 Oct 2019 21:04:34 +0000 +Subject: [PATCH 077/146] FROMLIST: usb: dwc3: gadget: Add support for + disabling SS instances in park mode + +In certain circumstances, the XHCI SuperSpeed instance in park mode +can fail to recover, thus on Amlogic G12A/G12B/SM1 SoCs when there is high +load on the single XHCI SuperSpeed instance, the controller can crash like: + xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command. + xhci-hcd xhci-hcd.0.auto: Host halt failed, -110 + xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead + xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command. + hub 2-1.1:1.0: hub_ext_port_status failed (err = -22) + xhci-hcd xhci-hcd.0.auto: HC died; cleaning up + usb 2-1.1-port1: cannot reset (err = -22) + +Setting the PARKMODE_DISABLE_SS bit in the DWC3_USB3_GUCTL1 mitigates +the issue. The bit is described as : +"When this bit is set to '1' all SS bus instances in park mode are disabled" + +CC: Dongjin Kim +Cc: Jianxin Pan +Reported-by: Tim +Signed-off-by: Neil Armstrong +--- + drivers/usb/dwc3/core.c | 5 +++++ + drivers/usb/dwc3/core.h | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c +index 1d85c42b9c67..43bd5b1ea9e2 100644 +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1029,6 +1029,9 @@ static int dwc3_core_init(struct dwc3 *dwc) + if (dwc->dis_tx_ipgap_linecheck_quirk) + reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; + ++ if (dwc->parkmode_disable_ss_quirk) ++ reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; ++ + dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); + } + +@@ -1342,6 +1345,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) + "snps,dis-del-phy-power-chg-quirk"); + dwc->dis_tx_ipgap_linecheck_quirk = device_property_read_bool(dev, + "snps,dis-tx-ipgap-linecheck-quirk"); ++ dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, ++ "snps,parkmode-disable-ss-quirk"); + + dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, + "snps,tx_de_emphasis_quirk"); +diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h +index 77c4a9abe365..3ecc69c5b150 100644 +--- a/drivers/usb/dwc3/core.h ++++ b/drivers/usb/dwc3/core.h +@@ -249,6 +249,7 @@ + #define DWC3_GUCTL_HSTINAUTORETRY BIT(14) + + /* Global User Control 1 Register */ ++#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) + #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) + #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) + +@@ -1024,6 +1025,8 @@ struct dwc3_scratchpad_array { + * change quirk. + * @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate + * check during HS transmit. ++ * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed ++ * instances in park mode. + * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk + * @tx_de_emphasis: Tx de-emphasis value + * 0 - -6dB de-emphasis +@@ -1215,6 +1218,7 @@ struct dwc3 { + unsigned dis_u2_freeclk_exists_quirk:1; + unsigned dis_del_phy_power_chg_quirk:1; + unsigned dis_tx_ipgap_linecheck_quirk:1; ++ unsigned parkmode_disable_ss_quirk:1; + + unsigned tx_de_emphasis_quirk:1; + unsigned tx_de_emphasis:2; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-arm64-dts-g12-common-add-parkmode_disable_s.patch b/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-arm64-dts-g12-common-add-parkmode_disable_s.patch new file mode 100644 index 0000000000..c5e587c1dc --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-arm64-dts-g12-common-add-parkmode_disable_s.patch @@ -0,0 +1,40 @@ +From 3bbafb8837231ef9af9836e0cc8deccfe0f65290 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 17 Oct 2019 21:05:34 +0000 +Subject: [PATCH 078/146] FROMLIST: arm64: dts: g12-common: add + parkmode_disable_ss_quirk on DWC3 controller + +When high load on the DWC3 SuperSpee port, the controller crashed as: +[ 221.141621] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command. +[ 221.157631] xhci-hcd xhci-hcd.0.auto: Host halt failed, -110 +[ 221.157635] xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead +[ 221.159901] xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command. +[ 221.159961] hub 2-1.1:1.0: hub_ext_port_status failed (err = -22) +[ 221.160076] xhci-hcd xhci-hcd.0.auto: HC died; cleaning up +[ 221.165946] usb 2-1.1-port1: cannot reset (err = -22) + +Setting the parkmode_disable_ss_quirk quirk fixes the issue. + +CC: Dongjin Kim +Cc: Jianxin Pan +Reported-by: Tim +Signed-off-by: Neil Armstrong +--- + arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +index 3deace05d345..d66b9ad9c966 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +@@ -2231,6 +2231,7 @@ + dr_mode = "host"; + snps,dis_u2_susphy_quirk; + snps,quirk-frame-length-adjustment; ++ snps,parkmode-disable-ss-quirk; + }; + }; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-drm-bridge-dw-hdmi-set-channel-count-in-the.patch b/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-drm-bridge-dw-hdmi-set-channel-count-in-the.patch deleted file mode 100644 index b3ef42ddb0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-drm-bridge-dw-hdmi-set-channel-count-in-the.patch +++ /dev/null @@ -1,33 +0,0 @@ -From b395156656e7fea0dd6f11add6641119c38d0ff0 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:21 +0200 -Subject: [PATCH 078/187] FROMLIST: drm/bridge: dw-hdmi: set channel count in - the infoframes - -Set the number of channel in the infoframes - -Reviewed-by: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index be6d6819bef4..bed4bb017afd 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -663,6 +663,10 @@ void dw_hdmi_set_channel_count(struct dw_hdmi *hdmi, unsigned int cnt) - hdmi_modb(hdmi, layout, HDMI_FC_AUDSCONF_AUD_PACKET_LAYOUT_MASK, - HDMI_FC_AUDSCONF); - -+ /* Set the audio infoframes channel count */ -+ hdmi_modb(hdmi, (cnt - 1) << HDMI_FC_AUDICONF0_CC_OFFSET, -+ HDMI_FC_AUDICONF0_CC_MASK, HDMI_FC_AUDICONF0); -+ - mutex_unlock(&hdmi->audio_mutex); - } - EXPORT_SYMBOL_GPL(dw_hdmi_set_channel_count); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-Add-a-drm_bridge_state-object.patch b/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-Add-a-drm_bridge_state-object.patch new file mode 100644 index 0000000000..67b9903a7f --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-Add-a-drm_bridge_state-object.patch @@ -0,0 +1,622 @@ +From f7d74763a9958c1239d4aef478ea770ead734ef3 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Mon, 6 Jan 2020 15:34:06 +0100 +Subject: [PATCH 079/146] FROMLIST: drm/bridge: Add a drm_bridge_state object + +One of the last remaining objects to not have its atomic state. + +This is being motivated by our attempt to support runtime bus-format +negotiation between elements of the bridge chain. +This patch just paves the road for such a feature by adding a new +drm_bridge_state object inheriting from drm_private_obj so we can +re-use some of the existing state initialization/tracking logic. + +v10: +* Add changelog to the commit message + +v9: +* Clarify the fact that the bridge->atomic_reset() and + {connector,plane,crtc,...}->reset() semantics are different +* Move the drm_atomic_private_obj_init() call back to + drm_bridge_attach() +* Check the presence of ->atomic_duplicate_state instead of + ->atomic_reset in drm_atomic_add_encoder_bridges() +* Fix copy&paste errors in the atomic bridge state helpers doc +* Add A-b/R-b tags + +v8: +* Move bridge state helpers out of the CONFIG_DEBUGFS section + +v7: +* Move helpers, struct-defs, ... to atomic helper files to avoid the + drm -> drm_kms_helper -> drm circular dep +* Stop providing default implementation for atomic state reset, + duplicate and destroy hooks (has to do with the helper/core split) +* Drop all R-b/T-b as helpers have now be moved to other places + +v6: +* Made helpers private, removed doc and moved them to satisfy dependencies +* Renamed helpers to _default_ + +v5: +* Re-introduced the helpers from v4 + +v4: +* Fix the doc +* Kill default helpers (inlined) +* Fix drm_atomic_get_bridge_state() to check for an ERR_PTR() +* Add Neil's R-b + +v3: +* No changes + +v2: +* Use drm_for_each_bridge_in_chain() +* Rename helpers to be more consistent with the rest of the DRM API +* Improve/fix the doc + +Signed-off-by: Boris Brezillon +Signed-off-by: Neil Armstrong +Reviewed-by: Neil Armstrong +Acked-by: Daniel Vetter +--- + drivers/gpu/drm/drm_atomic.c | 116 ++++++++++++++++++++++ + drivers/gpu/drm/drm_atomic_helper.c | 20 ++++ + drivers/gpu/drm/drm_atomic_state_helper.c | 103 +++++++++++++++++++ + drivers/gpu/drm/drm_bridge.c | 59 ++++++++++- + include/drm/drm_atomic.h | 34 +++++++ + include/drm/drm_atomic_state_helper.h | 13 +++ + include/drm/drm_bridge.h | 60 +++++++++++ + 7 files changed, 400 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c +index d33691512a8e..65c46ed049c5 100644 +--- a/drivers/gpu/drm/drm_atomic.c ++++ b/drivers/gpu/drm/drm_atomic.c +@@ -30,6 +30,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -1017,6 +1018,121 @@ static void drm_atomic_connector_print_state(struct drm_printer *p, + connector->funcs->atomic_print_state(p, state); + } + ++/** ++ * drm_atomic_get_bridge_state - get bridge state ++ * @state: global atomic state object ++ * @bridge: bridge to get state object for ++ * ++ * This function returns the bridge state for the given bridge, allocating it ++ * if needed. It will also grab the relevant bridge lock to make sure that the ++ * state is consistent. ++ * ++ * Returns: ++ * ++ * Either the allocated state or the error code encoded into the pointer. When ++ * the error is EDEADLK then the w/w mutex code has detected a deadlock and the ++ * entire atomic sequence must be restarted. ++ */ ++struct drm_bridge_state * ++drm_atomic_get_bridge_state(struct drm_atomic_state *state, ++ struct drm_bridge *bridge) ++{ ++ struct drm_private_state *obj_state; ++ ++ obj_state = drm_atomic_get_private_obj_state(state, &bridge->base); ++ if (IS_ERR(obj_state)) ++ return ERR_CAST(obj_state); ++ ++ return drm_priv_to_bridge_state(obj_state); ++} ++EXPORT_SYMBOL(drm_atomic_get_bridge_state); ++ ++/** ++ * drm_atomic_get_old_bridge_state - get old bridge state, if it exists ++ * @state: global atomic state object ++ * @bridge: bridge to grab ++ * ++ * This function returns the old bridge state for the given bridge, or NULL if ++ * the bridge is not part of the global atomic state. ++ */ ++struct drm_bridge_state * ++drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, ++ struct drm_bridge *bridge) ++{ ++ struct drm_private_state *obj_state; ++ ++ obj_state = drm_atomic_get_old_private_obj_state(state, &bridge->base); ++ if (!obj_state) ++ return NULL; ++ ++ return drm_priv_to_bridge_state(obj_state); ++} ++EXPORT_SYMBOL(drm_atomic_get_old_bridge_state); ++ ++/** ++ * drm_atomic_get_new_bridge_state - get new bridge state, if it exists ++ * @state: global atomic state object ++ * @bridge: bridge to grab ++ * ++ * This function returns the new bridge state for the given bridge, or NULL if ++ * the bridge is not part of the global atomic state. ++ */ ++struct drm_bridge_state * ++drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, ++ struct drm_bridge *bridge) ++{ ++ struct drm_private_state *obj_state; ++ ++ obj_state = drm_atomic_get_new_private_obj_state(state, &bridge->base); ++ if (!obj_state) ++ return NULL; ++ ++ return drm_priv_to_bridge_state(obj_state); ++} ++EXPORT_SYMBOL(drm_atomic_get_new_bridge_state); ++ ++/** ++ * drm_atomic_add_encoder_bridges - add bridges attached to an encoder ++ * @state: atomic state ++ * @encoder: DRM encoder ++ * ++ * This function adds all bridges attached to @encoder. This is needed to add ++ * bridge states to @state and make them available when ++ * &bridge_funcs.atomic_{check,pre_enable,enable,disable_post_disable}() are ++ * called ++ * ++ * Returns: ++ * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK ++ * then the w/w mutex code has detected a deadlock and the entire atomic ++ * sequence must be restarted. All other errors are fatal. ++ */ ++int ++drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, ++ struct drm_encoder *encoder) ++{ ++ struct drm_bridge_state *bridge_state; ++ struct drm_bridge *bridge; ++ ++ if (!encoder) ++ return 0; ++ ++ DRM_DEBUG_ATOMIC("Adding all bridges for [encoder:%d:%s] to %p\n", ++ encoder->base.id, encoder->name, state); ++ ++ drm_for_each_bridge_in_chain(encoder, bridge) { ++ /* Skip bridges that don't implement the atomic state hooks. */ ++ if (!bridge->funcs->atomic_duplicate_state) ++ continue; ++ ++ bridge_state = drm_atomic_get_bridge_state(state, bridge); ++ if (IS_ERR(bridge_state)) ++ return PTR_ERR(bridge_state); ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(drm_atomic_add_encoder_bridges); ++ + /** + * drm_atomic_add_affected_connectors - add connectors for CRTC + * @state: atomic state +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c +index 4511c2e07bb9..ad8eae98d9e8 100644 +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -730,6 +730,26 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, + return ret; + } + ++ /* ++ * Iterate over all connectors again, and add all affected bridges to ++ * the state. ++ */ ++ for_each_oldnew_connector_in_state(state, connector, ++ old_connector_state, ++ new_connector_state, i) { ++ struct drm_encoder *encoder; ++ ++ encoder = old_connector_state->best_encoder; ++ ret = drm_atomic_add_encoder_bridges(state, encoder); ++ if (ret) ++ return ret; ++ ++ encoder = new_connector_state->best_encoder; ++ ret = drm_atomic_add_encoder_bridges(state, encoder); ++ if (ret) ++ return ret; ++ } ++ + ret = mode_valid(state); + if (ret) + return ret; +diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c +index 7cf3cf936547..33141d2cdad4 100644 +--- a/drivers/gpu/drm/drm_atomic_state_helper.c ++++ b/drivers/gpu/drm/drm_atomic_state_helper.c +@@ -26,6 +26,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -551,3 +552,105 @@ void __drm_atomic_helper_private_obj_duplicate_state(struct drm_private_obj *obj + memcpy(state, obj->state, sizeof(*state)); + } + EXPORT_SYMBOL(__drm_atomic_helper_private_obj_duplicate_state); ++ ++/** ++ * __drm_atomic_helper_bridge_duplicate_state() - Copy atomic bridge state ++ * @bridge: bridge object ++ * @state: atomic bridge state ++ * ++ * Copies atomic state from a bridge's current state and resets inferred values. ++ * This is useful for drivers that subclass the bridge state. ++ */ ++void __drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge, ++ struct drm_bridge_state *state) ++{ ++ __drm_atomic_helper_private_obj_duplicate_state(&bridge->base, ++ &state->base); ++ state->bridge = bridge; ++} ++EXPORT_SYMBOL(__drm_atomic_helper_bridge_duplicate_state); ++ ++/** ++ * drm_atomic_helper_bridge_duplicate_state() - Duplicate a bridge state object ++ * @bridge: bridge object ++ * ++ * Allocates a new bridge state and initializes it with the current bridge ++ * state values. This helper is meant to be used as a bridge ++ * &drm_bridge_funcs.atomic_duplicate_state hook for bridges that don't ++ * subclass the bridge state. ++ */ ++struct drm_bridge_state * ++drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge) ++{ ++ struct drm_bridge_state *new; ++ ++ if (WARN_ON(!bridge->base.state)) ++ return NULL; ++ ++ new = kzalloc(sizeof(*new), GFP_KERNEL); ++ if (new) ++ __drm_atomic_helper_bridge_duplicate_state(bridge, new); ++ ++ return new; ++} ++EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state); ++ ++/** ++ * drm_atomic_helper_bridge_destroy_state() - Destroy a bridge state object ++ * @bridge: the bridge this state refers to ++ * @state: bridge state to destroy ++ * ++ * Destroys a bridge state previously created by ++ * &drm_atomic_helper_bridge_reset() or ++ * &drm_atomic_helper_bridge_duplicate_state(). This helper is meant to be ++ * used as a bridge &drm_bridge_funcs.atomic_destroy_state hook for bridges ++ * that don't subclass the bridge state. ++ */ ++void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge, ++ struct drm_bridge_state *state) ++{ ++ kfree(state); ++} ++EXPORT_SYMBOL(drm_atomic_helper_bridge_destroy_state); ++ ++/** ++ * __drm_atomic_helper_bridge_reset() - Initialize a bridge state to its ++ * default ++ * @bridge: the bridge this state refers to ++ * @state: bridge state to initialize ++ * ++ * Initializes the bridge state to default values. This is meant to be called ++ * by the bridge &drm_bridge_funcs.atomic_reset hook for bridges that subclass ++ * the bridge state. ++ */ ++void __drm_atomic_helper_bridge_reset(struct drm_bridge *bridge, ++ struct drm_bridge_state *state) ++{ ++ memset(state, 0, sizeof(*state)); ++ state->bridge = bridge; ++} ++EXPORT_SYMBOL(__drm_atomic_helper_bridge_reset); ++ ++/** ++ * drm_atomic_helper_bridge_reset() - Allocate and initialize a bridge state ++ * to its default ++ * @bridge: the bridge this state refers to ++ * @state: bridge state to initialize ++ * ++ * Allocates the bridge state and initializes it to default values. This helper ++ * is meant to be used as a bridge &drm_bridge_funcs.atomic_reset hook for ++ * bridges that don't subclass the bridge state. ++ */ ++struct drm_bridge_state * ++drm_atomic_helper_bridge_reset(struct drm_bridge *bridge) ++{ ++ struct drm_bridge_state *bridge_state; ++ ++ bridge_state = kzalloc(sizeof(*bridge_state), GFP_KERNEL); ++ if (!bridge_state) ++ return ERR_PTR(-ENOMEM); ++ ++ __drm_atomic_helper_bridge_reset(bridge, bridge_state); ++ return bridge_state; ++} ++EXPORT_SYMBOL(drm_atomic_helper_bridge_reset); +diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c +index c2cf0c90fa26..6b08158ebb7e 100644 +--- a/drivers/gpu/drm/drm_bridge.c ++++ b/drivers/gpu/drm/drm_bridge.c +@@ -25,6 +25,7 @@ + #include + #include + ++#include + #include + #include + +@@ -89,6 +90,31 @@ void drm_bridge_remove(struct drm_bridge *bridge) + } + EXPORT_SYMBOL(drm_bridge_remove); + ++static struct drm_private_state * ++drm_bridge_atomic_duplicate_priv_state(struct drm_private_obj *obj) ++{ ++ struct drm_bridge *bridge = drm_priv_to_bridge(obj); ++ struct drm_bridge_state *state; ++ ++ state = bridge->funcs->atomic_duplicate_state(bridge); ++ return state ? &state->base : NULL; ++} ++ ++static void ++drm_bridge_atomic_destroy_priv_state(struct drm_private_obj *obj, ++ struct drm_private_state *s) ++{ ++ struct drm_bridge_state *state = drm_priv_to_bridge_state(s); ++ struct drm_bridge *bridge = drm_priv_to_bridge(obj); ++ ++ bridge->funcs->atomic_destroy_state(bridge, state); ++} ++ ++static const struct drm_private_state_funcs drm_bridge_priv_state_funcs = { ++ .atomic_duplicate_state = drm_bridge_atomic_duplicate_priv_state, ++ .atomic_destroy_state = drm_bridge_atomic_destroy_priv_state, ++}; ++ + /** + * drm_bridge_attach - attach the bridge to an encoder's chain + * +@@ -135,15 +161,35 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, + + if (bridge->funcs->attach) { + ret = bridge->funcs->attach(bridge); +- if (ret < 0) { +- list_del(&bridge->chain_node); +- bridge->dev = NULL; +- bridge->encoder = NULL; +- return ret; ++ if (ret < 0) ++ goto err_reset_bridge; ++ } ++ ++ if (bridge->funcs->atomic_reset) { ++ struct drm_bridge_state *state; ++ ++ state = bridge->funcs->atomic_reset(bridge); ++ if (IS_ERR(state)) { ++ ret = PTR_ERR(state); ++ goto err_detach_bridge; + } ++ ++ drm_atomic_private_obj_init(bridge->dev, &bridge->base, ++ &state->base, ++ &drm_bridge_priv_state_funcs); + } + + return 0; ++ ++err_detach_bridge: ++ if (bridge->funcs->detach) ++ bridge->funcs->detach(bridge); ++ ++err_reset_bridge: ++ bridge->dev = NULL; ++ bridge->encoder = NULL; ++ list_del(&bridge->chain_node); ++ return ret; + } + EXPORT_SYMBOL(drm_bridge_attach); + +@@ -155,6 +201,9 @@ void drm_bridge_detach(struct drm_bridge *bridge) + if (WARN_ON(!bridge->dev)) + return; + ++ if (bridge->funcs->atomic_reset) ++ drm_atomic_private_obj_fini(&bridge->base); ++ + if (bridge->funcs->detach) + bridge->funcs->detach(bridge); + +diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h +index 951dfb15c27b..82a888769b3d 100644 +--- a/include/drm/drm_atomic.h ++++ b/include/drm/drm_atomic.h +@@ -669,6 +669,9 @@ __drm_atomic_get_current_plane_state(struct drm_atomic_state *state, + return plane->state; + } + ++int __must_check ++drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, ++ struct drm_encoder *encoder); + int __must_check + drm_atomic_add_affected_connectors(struct drm_atomic_state *state, + struct drm_crtc *crtc); +@@ -992,4 +995,35 @@ drm_atomic_crtc_effectively_active(const struct drm_crtc_state *state) + return state->active || state->self_refresh_active; + } + ++/** ++ * struct drm_bridge_state - Atomic bridge state object ++ */ ++struct drm_bridge_state { ++ /** ++ * @base: inherit from &drm_private_state ++ */ ++ struct drm_private_state base; ++ ++ /** ++ * @bridge: the bridge this state refers to ++ */ ++ struct drm_bridge *bridge; ++}; ++ ++static inline struct drm_bridge_state * ++drm_priv_to_bridge_state(struct drm_private_state *priv) ++{ ++ return container_of(priv, struct drm_bridge_state, base); ++} ++ ++struct drm_bridge_state * ++drm_atomic_get_bridge_state(struct drm_atomic_state *state, ++ struct drm_bridge *bridge); ++struct drm_bridge_state * ++drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, ++ struct drm_bridge *bridge); ++struct drm_bridge_state * ++drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, ++ struct drm_bridge *bridge); ++ + #endif /* DRM_ATOMIC_H_ */ +diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h +index 8171dea4cc22..3f8f1d627f7c 100644 +--- a/include/drm/drm_atomic_state_helper.h ++++ b/include/drm/drm_atomic_state_helper.h +@@ -26,6 +26,8 @@ + + #include + ++struct drm_bridge; ++struct drm_bridge_state; + struct drm_crtc; + struct drm_crtc_state; + struct drm_plane; +@@ -80,3 +82,14 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, + struct drm_connector_state *state); + void __drm_atomic_helper_private_obj_duplicate_state(struct drm_private_obj *obj, + struct drm_private_state *state); ++ ++void __drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge, ++ struct drm_bridge_state *state); ++struct drm_bridge_state * ++drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge); ++void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge, ++ struct drm_bridge_state *state); ++void __drm_atomic_helper_bridge_reset(struct drm_bridge *bridge, ++ struct drm_bridge_state *state); ++struct drm_bridge_state * ++drm_atomic_helper_bridge_reset(struct drm_bridge *bridge); +diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h +index 694e153a7531..8883dcfe63cb 100644 +--- a/include/drm/drm_bridge.h ++++ b/include/drm/drm_bridge.h +@@ -25,6 +25,8 @@ + + #include + #include ++ ++#include + #include + #include + #include +@@ -338,6 +340,56 @@ struct drm_bridge_funcs { + */ + void (*atomic_post_disable)(struct drm_bridge *bridge, + struct drm_atomic_state *old_state); ++ ++ /** ++ * @atomic_duplicate_state: ++ * ++ * Duplicate the current bridge state object (which is guaranteed to be ++ * non-NULL). ++ * ++ * The atomic_duplicate_state() is optional. When not implemented the ++ * core allocates a drm_bridge_state object and calls ++ * &__drm_atomic_helper_bridge_duplicate_state() to initialize it. ++ * ++ * RETURNS: ++ * A valid drm_bridge_state object or NULL if the allocation fails. ++ */ ++ struct drm_bridge_state *(*atomic_duplicate_state)(struct drm_bridge *bridge); ++ ++ /** ++ * @atomic_destroy_state: ++ * ++ * Destroy a bridge state object previously allocated by ++ * &drm_bridge_funcs.atomic_duplicate_state(). ++ * ++ * The atomic_destroy_state hook is optional. When not implemented the ++ * core calls kfree() on the state. ++ */ ++ void (*atomic_destroy_state)(struct drm_bridge *bridge, ++ struct drm_bridge_state *state); ++ ++ /** ++ * @atomic_reset: ++ * ++ * Reset the bridge to a predefined state (or retrieve its current ++ * state) and return a &drm_bridge_state object matching this state. ++ * This function is called at attach time. ++ * ++ * The atomic_reset hook is mandatory if the bridge implements any of ++ * the atomic hooks, and should be left unassigned otherwise. ++ * ++ * Note that the atomic_reset() semantics is not exactly matching the ++ * reset() semantics found on other components (connector, plane, ...). ++ * 1/ The reset operation happens when the bridge is attached, not when ++ * drm_mode_config_reset() is called ++ * 2/ It's meant to be used exclusively on bridges that have been ++ * converted to the ATOMIC API ++ * ++ * RETURNS: ++ * A valid drm_bridge_state object in case of success, an ERR_PTR() ++ * giving the reason of the failure otherwise. ++ */ ++ struct drm_bridge_state *(*atomic_reset)(struct drm_bridge *bridge); + }; + + /** +@@ -380,6 +432,8 @@ struct drm_bridge_timings { + * struct drm_bridge - central DRM bridge control structure + */ + struct drm_bridge { ++ /** @base: inherit from &drm_private_object */ ++ struct drm_private_obj base; + /** @dev: DRM device this bridge belongs to */ + struct drm_device *dev; + /** @encoder: encoder to which this bridge is connected */ +@@ -404,6 +458,12 @@ struct drm_bridge { + void *driver_private; + }; + ++static inline struct drm_bridge * ++drm_priv_to_bridge(struct drm_private_obj *priv) ++{ ++ return container_of(priv, struct drm_bridge, base); ++} ++ + void drm_bridge_add(struct drm_bridge *bridge); + void drm_bridge_remove(struct drm_bridge *bridge); + struct drm_bridge *of_drm_find_bridge(struct device_node *np); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-dw-hdmi-i2s-enable-lpcm-multi-ch.patch b/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-dw-hdmi-i2s-enable-lpcm-multi-ch.patch deleted file mode 100644 index 9076757da6..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-dw-hdmi-i2s-enable-lpcm-multi-ch.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 591f861a245622b88168e09e69c40acb06af99b9 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:22 +0200 -Subject: [PATCH 079/187] FROMLIST: drm/bridge: dw-hdmi-i2s: enable lpcm multi - channels - -Properly setup the channel count and layout in dw-hdmi i2s driver so -we are not limited to 2 channels. - -Also correct the maximum channel reported by the DAI from 6 to 8 ch - -Reviewed-by: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index 2b624cff541d..caf8aed78fea 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -84,6 +84,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - } - - dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); -+ dw_hdmi_set_channel_count(hdmi, hparms->channels); - - hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); - hdmi_write(audio, conf0, HDMI_AUD_CONF0); -@@ -139,7 +140,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) - - pdata.ops = &dw_hdmi_i2s_ops; - pdata.i2s = 1; -- pdata.max_i2s_channels = 6; -+ pdata.max_i2s_channels = 8; - pdata.data = audio; - - memset(&pdevinfo, 0, sizeof(pdevinfo)); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-bridge-dw-hdmi-i2s-set-the-channel-allo.patch b/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-bridge-dw-hdmi-i2s-set-the-channel-allo.patch deleted file mode 100644 index eb0481dc79..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-bridge-dw-hdmi-i2s-set-the-channel-allo.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ca085fd0d3dee1ef153b4f1a7ab22748daf02ea4 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:23 +0200 -Subject: [PATCH 080/187] FROMLIST: drm/bridge: dw-hdmi-i2s: set the channel - allocation - -setup the channel allocation provided by the generic hdmi-codec driver - -Reviewed-by: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index caf8aed78fea..0864dee8d180 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -85,6 +85,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - - dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); - dw_hdmi_set_channel_count(hdmi, hparms->channels); -+ dw_hdmi_set_channel_allocation(hdmi, hparms->cea.channel_allocation); - - hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); - hdmi_write(audio, conf0, HDMI_AUD_CONF0); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-rcar-du-Plug-atomic-state-hooks-to-the-.patch b/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-rcar-du-Plug-atomic-state-hooks-to-the-.patch new file mode 100644 index 0000000000..ba50973052 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-rcar-du-Plug-atomic-state-hooks-to-the-.patch @@ -0,0 +1,45 @@ +From 2a785aa31675dbdc1039891e3b69ef3d4a680dbd Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Tue, 21 Jan 2020 16:34:32 +0100 +Subject: [PATCH 080/146] FROMLIST: drm/rcar-du: Plug atomic state hooks to the + default implementation + +This is needed to pass a bridge state to all atomic hooks, if we don't +do that, the core can't duplicate/create bridge states. + +v10: +* Add changelog to the commit message + +v9: +* Add Neil's R-b +* Move earlier in the series + +v8: +* No changes + +v7: +* New patch + +Signed-off-by: Boris Brezillon +Reviewed-by: Neil Armstrong +--- + drivers/gpu/drm/rcar-du/rcar_lvds.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c +index 8ffa4fbbdeb3..3a254f1b29fe 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c ++++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c +@@ -682,6 +682,9 @@ static void rcar_lvds_detach(struct drm_bridge *bridge) + static const struct drm_bridge_funcs rcar_lvds_bridge_ops = { + .attach = rcar_lvds_attach, + .detach = rcar_lvds_detach, ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_enable = rcar_lvds_atomic_enable, + .atomic_disable = rcar_lvds_atomic_disable, + .mode_fixup = rcar_lvds_mode_fixup, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-analogix-Plug-atomic-state-hooks.patch b/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-analogix-Plug-atomic-state-hooks.patch new file mode 100644 index 0000000000..b4c4ce964a --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-analogix-Plug-atomic-state-hooks.patch @@ -0,0 +1,45 @@ +From d1cf8cf8857aa4f9ff8750717d3c2371052a94ed Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Tue, 21 Jan 2020 16:35:10 +0100 +Subject: [PATCH 081/146] FROMLIST: drm/bridge: analogix: Plug atomic state + hooks to the default implementation + +This is needed to pass a bridge state to all atomic hooks, if we don't +do that, the core can't duplicate/create bridge states. + +v10: +* Add changelog to the commit message + +v9: +* Add Neil's R-b +* Move earlier in the series + +v8: +* No changes + +v7: +* New patch + +Signed-off-by: Boris Brezillon +Reviewed-by: Neil Armstrong +--- + drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +index 6effe532f820..aaaec39ec2a7 100644 +--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c ++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +@@ -1563,6 +1563,9 @@ static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge, + } + + static const struct drm_bridge_funcs analogix_dp_bridge_funcs = { ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_pre_enable = analogix_dp_bridge_atomic_pre_enable, + .atomic_enable = analogix_dp_bridge_atomic_enable, + .atomic_disable = analogix_dp_bridge_atomic_disable, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-dw-hdmi-i2s-reset-audio-fifo-bef.patch b/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-dw-hdmi-i2s-reset-audio-fifo-bef.patch deleted file mode 100644 index 09dd12a524..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-dw-hdmi-i2s-reset-audio-fifo-bef.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 16e00197334a39c5d00ada023491a57524b2961a Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:24 +0200 -Subject: [PATCH 081/187] FROMLIST: drm/bridge: dw-hdmi-i2s: reset audio fifo - before applying new params - -When changing the audio hw params, reset the audio fifo to make sure -any old remaining data is flushed. - -The databook mentions that such reset should be followed by a reset of -the i2s block to make sure the samples stay aligned - -Reviewed-by: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 6 ++++-- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 1 + - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index 0864dee8d180..41bee0099578 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -49,6 +49,10 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - return -EINVAL; - } - -+ /* Reset the FIFOs before applying new params */ -+ hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); -+ hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2SSWRST_REQ, HDMI_MC_SWRSTZ); -+ - inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; - conf0 = HDMI_AUD_CONF0_I2S_ALL_ENABLE; - -@@ -102,8 +106,6 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) - struct dw_hdmi *hdmi = audio->hdmi; - - dw_hdmi_audio_disable(hdmi); -- -- hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); - } - - static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -index 091d7c28aa17..a272fa393ae6 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -@@ -940,6 +940,7 @@ enum { - HDMI_MC_CLKDIS_PIXELCLK_DISABLE = 0x1, - - /* MC_SWRSTZ field values */ -+ HDMI_MC_SWRSTZ_I2SSWRST_REQ = 0x08, - HDMI_MC_SWRSTZ_TMDSSWRST_REQ = 0x02, - - /* MC_FLOWCTRL field values */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-Patch-atomic-hooks-to-take-a-drm.patch b/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-Patch-atomic-hooks-to-take-a-drm.patch new file mode 100644 index 0000000000..531f757e33 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-Patch-atomic-hooks-to-take-a-drm.patch @@ -0,0 +1,333 @@ +From a89ba179e291fd52ec7597baa2953d50e513cefd Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Mon, 6 Jan 2020 15:34:07 +0100 +Subject: [PATCH 082/146] FROMLIST: drm/bridge: Patch atomic hooks to take a + drm_bridge_state + +This way the drm_bridge_funcs interface is consistent with the rest of +the subsystem. + +The drivers implementing those hooks are patched too. + +v10: +* Add changelog to the commit message + +v8 -> v9: +* No changes + +v7: +* Adjust things to the bridge_state changes + +v6: +* Also fixed rcar-du/rcar_lvds.c same as analogix/analogix_dp_core.c + +v5: +* No changes + +v4: +* Rename func params into old_bridge_state +* Add Laurent's Rb + +v3: +* Old state clarification moved to a separate patch + +v2: +* Pass the old bridge state + +Signed-off-by: Boris Brezillon +Reviewed-by: Laurent Pinchart +Signed-off-by: Neil Armstrong +[narmstrong: renamed state as old_bridge_state in rcar_lvds_atomic_disable] +Reviewed by: Jernej Skrabec +Tested-by: Jonas Karlman +--- +--- + .../drm/bridge/analogix/analogix_dp_core.c | 41 +++++++------ + drivers/gpu/drm/drm_bridge.c | 61 +++++++++++++++---- + drivers/gpu/drm/rcar-du/rcar_lvds.c | 8 ++- + include/drm/drm_bridge.h | 8 +-- + 4 files changed, 82 insertions(+), 36 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +index aaaec39ec2a7..dfb59a5fefea 100644 +--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c ++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +@@ -1289,19 +1289,21 @@ struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp, + return conn_state->crtc; + } + +-static void analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge, +- struct drm_atomic_state *state) ++static void ++analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_bridge_state) + { ++ struct drm_atomic_state *old_state = old_bridge_state->base.state; + struct analogix_dp_device *dp = bridge->driver_private; + struct drm_crtc *crtc; + struct drm_crtc_state *old_crtc_state; + int ret; + +- crtc = analogix_dp_get_new_crtc(dp, state); ++ crtc = analogix_dp_get_new_crtc(dp, old_state); + if (!crtc) + return; + +- old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); ++ old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc); + /* Don't touch the panel if we're coming back from PSR */ + if (old_crtc_state && old_crtc_state->self_refresh_active) + return; +@@ -1366,20 +1368,22 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp) + return ret; + } + +-static void analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge, +- struct drm_atomic_state *state) ++static void ++analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_bridge_state) + { ++ struct drm_atomic_state *old_state = old_bridge_state->base.state; + struct analogix_dp_device *dp = bridge->driver_private; + struct drm_crtc *crtc; + struct drm_crtc_state *old_crtc_state; + int timeout_loop = 0; + int ret; + +- crtc = analogix_dp_get_new_crtc(dp, state); ++ crtc = analogix_dp_get_new_crtc(dp, old_state); + if (!crtc) + return; + +- old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); ++ old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc); + /* Not a full enable, just disable PSR and continue */ + if (old_crtc_state && old_crtc_state->self_refresh_active) { + ret = analogix_dp_disable_psr(dp); +@@ -1440,18 +1444,20 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) + dp->dpms_mode = DRM_MODE_DPMS_OFF; + } + +-static void analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge, +- struct drm_atomic_state *state) ++static void ++analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_bridge_state) + { ++ struct drm_atomic_state *old_state = old_bridge_state->base.state; + struct analogix_dp_device *dp = bridge->driver_private; + struct drm_crtc *crtc; + struct drm_crtc_state *new_crtc_state = NULL; + +- crtc = analogix_dp_get_new_crtc(dp, state); ++ crtc = analogix_dp_get_new_crtc(dp, old_state); + if (!crtc) + goto out; + +- new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); ++ new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc); + if (!new_crtc_state) + goto out; + +@@ -1463,20 +1469,21 @@ static void analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge, + analogix_dp_bridge_disable(bridge); + } + +-static +-void analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge, +- struct drm_atomic_state *state) ++static void ++analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_bridge_state) + { ++ struct drm_atomic_state *old_state = old_bridge_state->base.state; + struct analogix_dp_device *dp = bridge->driver_private; + struct drm_crtc *crtc; + struct drm_crtc_state *new_crtc_state; + int ret; + +- crtc = analogix_dp_get_new_crtc(dp, state); ++ crtc = analogix_dp_get_new_crtc(dp, old_state); + if (!crtc) + return; + +- new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); ++ new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc); + if (!new_crtc_state || !new_crtc_state->self_refresh_active) + return; + +diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c +index 6b08158ebb7e..f6206e655da4 100644 +--- a/drivers/gpu/drm/drm_bridge.c ++++ b/drivers/gpu/drm/drm_bridge.c +@@ -458,10 +458,19 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, + + encoder = bridge->encoder; + list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { +- if (iter->funcs->atomic_disable) +- iter->funcs->atomic_disable(iter, old_state); +- else if (iter->funcs->disable) ++ if (iter->funcs->atomic_disable) { ++ struct drm_bridge_state *old_bridge_state; ++ ++ old_bridge_state = ++ drm_atomic_get_old_bridge_state(old_state, ++ iter); ++ if (WARN_ON(!old_bridge_state)) ++ return; ++ ++ iter->funcs->atomic_disable(iter, old_bridge_state); ++ } else if (iter->funcs->disable) { + iter->funcs->disable(iter); ++ } + + if (iter == bridge) + break; +@@ -492,10 +501,20 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, + + encoder = bridge->encoder; + list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { +- if (bridge->funcs->atomic_post_disable) +- bridge->funcs->atomic_post_disable(bridge, old_state); +- else if (bridge->funcs->post_disable) ++ if (bridge->funcs->atomic_post_disable) { ++ struct drm_bridge_state *old_bridge_state; ++ ++ old_bridge_state = ++ drm_atomic_get_old_bridge_state(old_state, ++ bridge); ++ if (WARN_ON(!old_bridge_state)) ++ return; ++ ++ bridge->funcs->atomic_post_disable(bridge, ++ old_bridge_state); ++ } else if (bridge->funcs->post_disable) { + bridge->funcs->post_disable(bridge); ++ } + } + } + EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); +@@ -524,10 +543,19 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, + + encoder = bridge->encoder; + list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { +- if (iter->funcs->atomic_pre_enable) +- iter->funcs->atomic_pre_enable(iter, old_state); +- else if (iter->funcs->pre_enable) ++ if (iter->funcs->atomic_pre_enable) { ++ struct drm_bridge_state *old_bridge_state; ++ ++ old_bridge_state = ++ drm_atomic_get_old_bridge_state(old_state, ++ iter); ++ if (WARN_ON(!old_bridge_state)) ++ return; ++ ++ iter->funcs->atomic_pre_enable(iter, old_bridge_state); ++ } else if (iter->funcs->pre_enable) { + iter->funcs->pre_enable(iter); ++ } + + if (iter == bridge) + break; +@@ -557,10 +585,19 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, + + encoder = bridge->encoder; + list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { +- if (bridge->funcs->atomic_enable) +- bridge->funcs->atomic_enable(bridge, old_state); +- else if (bridge->funcs->enable) ++ if (bridge->funcs->atomic_enable) { ++ struct drm_bridge_state *old_bridge_state; ++ ++ old_bridge_state = ++ drm_atomic_get_old_bridge_state(old_state, ++ bridge); ++ if (WARN_ON(!old_bridge_state)) ++ return; ++ ++ bridge->funcs->atomic_enable(bridge, old_bridge_state); ++ } else if (bridge->funcs->enable) { + bridge->funcs->enable(bridge); ++ } + } + } + EXPORT_SYMBOL(drm_atomic_bridge_chain_enable); +diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c +index 3a254f1b29fe..06432c881e07 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c ++++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c +@@ -590,8 +590,9 @@ static void __rcar_lvds_atomic_enable(struct drm_bridge *bridge, + } + + static void rcar_lvds_atomic_enable(struct drm_bridge *bridge, +- struct drm_atomic_state *state) ++ struct drm_bridge_state *old_bridge_state) + { ++ struct drm_atomic_state *state = old_bridge_state->base.state; + struct drm_connector *connector; + struct drm_crtc *crtc; + +@@ -603,7 +604,7 @@ static void rcar_lvds_atomic_enable(struct drm_bridge *bridge, + } + + static void rcar_lvds_atomic_disable(struct drm_bridge *bridge, +- struct drm_atomic_state *state) ++ struct drm_bridge_state *old_bridge_state) + { + struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); + +@@ -618,7 +619,8 @@ static void rcar_lvds_atomic_disable(struct drm_bridge *bridge, + + /* Disable the companion LVDS encoder in dual-link mode. */ + if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion) +- lvds->companion->funcs->atomic_disable(lvds->companion, state); ++ lvds->companion->funcs->atomic_disable(lvds->companion, ++ old_bridge_state); + + clk_disable_unprepare(lvds->clocks.mod); + } +diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h +index 8883dcfe63cb..df22f909141f 100644 +--- a/include/drm/drm_bridge.h ++++ b/include/drm/drm_bridge.h +@@ -265,7 +265,7 @@ struct drm_bridge_funcs { + * The @atomic_pre_enable callback is optional. + */ + void (*atomic_pre_enable)(struct drm_bridge *bridge, +- struct drm_atomic_state *old_state); ++ struct drm_bridge_state *old_bridge_state); + + /** + * @atomic_enable: +@@ -290,7 +290,7 @@ struct drm_bridge_funcs { + * The @atomic_enable callback is optional. + */ + void (*atomic_enable)(struct drm_bridge *bridge, +- struct drm_atomic_state *old_state); ++ struct drm_bridge_state *old_bridge_state); + /** + * @atomic_disable: + * +@@ -313,7 +313,7 @@ struct drm_bridge_funcs { + * The @atomic_disable callback is optional. + */ + void (*atomic_disable)(struct drm_bridge *bridge, +- struct drm_atomic_state *old_state); ++ struct drm_bridge_state *old_bridge_state); + + /** + * @atomic_post_disable: +@@ -339,7 +339,7 @@ struct drm_bridge_funcs { + * The @atomic_post_disable callback is optional. + */ + void (*atomic_post_disable)(struct drm_bridge *bridge, +- struct drm_atomic_state *old_state); ++ struct drm_bridge_state *old_bridge_state); + + /** + * @atomic_duplicate_state: +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-dw-hdmi-i2s-enable-only-the-requ.patch b/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-dw-hdmi-i2s-enable-only-the-requ.patch deleted file mode 100644 index 45f22cdd77..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-dw-hdmi-i2s-enable-only-the-requ.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0562d2e2806f7970d76dc6b9107bc7392667eb88 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:25 +0200 -Subject: [PATCH 082/187] FROMLIST: drm/bridge: dw-hdmi-i2s: enable only the - required i2s lanes - -Enable the i2s lanes depending on the number of channel in the stream - -Reviewed-by: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - .../gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 15 ++++++++++++++- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 6 +++++- - 2 files changed, 19 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index 41bee0099578..b8ece9c1ba2c 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -54,7 +54,20 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2SSWRST_REQ, HDMI_MC_SWRSTZ); - - inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; -- conf0 = HDMI_AUD_CONF0_I2S_ALL_ENABLE; -+ conf0 = (HDMI_AUD_CONF0_I2S_SELECT | HDMI_AUD_CONF0_I2S_EN0); -+ -+ /* Enable the required i2s lanes */ -+ switch (hparms->channels) { -+ case 7 ... 8: -+ conf0 |= HDMI_AUD_CONF0_I2S_EN3; -+ /* Fall-thru */ -+ case 5 ... 6: -+ conf0 |= HDMI_AUD_CONF0_I2S_EN2; -+ /* Fall-thru */ -+ case 3 ... 4: -+ conf0 |= HDMI_AUD_CONF0_I2S_EN1; -+ /* Fall-thru */ -+ } - - switch (hparms->sample_width) { - case 16: -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -index a272fa393ae6..6988f12d89d9 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h -@@ -865,7 +865,11 @@ enum { - - /* AUD_CONF0 field values */ - HDMI_AUD_CONF0_SW_RESET = 0x80, -- HDMI_AUD_CONF0_I2S_ALL_ENABLE = 0x2F, -+ HDMI_AUD_CONF0_I2S_SELECT = 0x20, -+ HDMI_AUD_CONF0_I2S_EN3 = 0x08, -+ HDMI_AUD_CONF0_I2S_EN2 = 0x04, -+ HDMI_AUD_CONF0_I2S_EN1 = 0x02, -+ HDMI_AUD_CONF0_I2S_EN0 = 0x01, - - /* AUD_CONF1 field values */ - HDMI_AUD_CONF1_MODE_I2S = 0x00, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-Add-an-atomic_check-hook.patch b/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-Add-an-atomic_check-hook.patch new file mode 100644 index 0000000000..5146ec5709 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-Add-an-atomic_check-hook.patch @@ -0,0 +1,202 @@ +From 307c2206d029f8b006009e53a7143cabfe6002af Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Mon, 6 Jan 2020 15:34:08 +0100 +Subject: [PATCH 083/146] FROMLIST: drm/bridge: Add an ->atomic_check() hook + +So that bridge drivers have a way to check/reject an atomic operation. +The drm_atomic_bridge_chain_check() (which is just a wrapper around +the ->atomic_check() hook) is called in place of +drm_bridge_chain_mode_fixup() (when ->atomic_check() is not implemented, +the core falls back on ->mode_fixup(), so the behavior should stay +the same for existing bridge drivers). + +v10: +* Add changelog to the commit message + +v8 -> v9: +* No changes + +v7: +* Fix a NULL pointer dereference + +v5 -> v6: +* No changes + +v4: +* Add R-bs + +v3: +* No changes + +v2: +* Clarify the fact that ->atomic_check() is replacing ->mode_fixup() + +Signed-off-by: Boris Brezillon +Reviewed-by: Neil Armstrong +Reviewed-by: Laurent Pinchart +Signed-off-by: Neil Armstrong +Reviewed by: Jernej Skrabec +Tested-by: Jonas Karlman +--- + drivers/gpu/drm/drm_atomic_helper.c | 12 +++--- + drivers/gpu/drm/drm_bridge.c | 66 +++++++++++++++++++++++++++++ + include/drm/drm_bridge.h | 29 ++++++++++++- + 3 files changed, 100 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c +index ad8eae98d9e8..afe14f72a824 100644 +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -437,12 +437,12 @@ mode_fixup(struct drm_atomic_state *state) + funcs = encoder->helper_private; + + bridge = drm_bridge_chain_get_first_bridge(encoder); +- ret = drm_bridge_chain_mode_fixup(bridge, +- &new_crtc_state->mode, +- &new_crtc_state->adjusted_mode); +- if (!ret) { +- DRM_DEBUG_ATOMIC("Bridge fixup failed\n"); +- return -EINVAL; ++ ret = drm_atomic_bridge_chain_check(bridge, ++ new_crtc_state, ++ new_conn_state); ++ if (ret) { ++ DRM_DEBUG_ATOMIC("Bridge atomic check failed\n"); ++ return ret; + } + + if (funcs && funcs->atomic_check) { +diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c +index f6206e655da4..c8beb1385771 100644 +--- a/drivers/gpu/drm/drm_bridge.c ++++ b/drivers/gpu/drm/drm_bridge.c +@@ -602,6 +602,72 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, + } + EXPORT_SYMBOL(drm_atomic_bridge_chain_enable); + ++static int drm_atomic_bridge_check(struct drm_bridge *bridge, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ if (bridge->funcs->atomic_check) { ++ struct drm_bridge_state *bridge_state; ++ int ret; ++ ++ bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, ++ bridge); ++ if (WARN_ON(!bridge_state)) ++ return -EINVAL; ++ ++ ret = bridge->funcs->atomic_check(bridge, bridge_state, ++ crtc_state, conn_state); ++ if (ret) ++ return ret; ++ } else if (bridge->funcs->mode_fixup) { ++ if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, ++ &crtc_state->adjusted_mode)) ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/** ++ * drm_atomic_bridge_chain_check() - Do an atomic check on the bridge chain ++ * @bridge: bridge control structure ++ * @crtc_state: new CRTC state ++ * @conn_state: new connector state ++ * ++ * Calls &drm_bridge_funcs.atomic_check() (falls back on ++ * &drm_bridge_funcs.mode_fixup()) op for all the bridges in the encoder chain, ++ * starting from the last bridge to the first. These are called before calling ++ * &drm_encoder_helper_funcs.atomic_check() ++ * ++ * RETURNS: ++ * 0 on success, a negative error code on failure ++ */ ++int drm_atomic_bridge_chain_check(struct drm_bridge *bridge, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct drm_encoder *encoder; ++ struct drm_bridge *iter; ++ ++ if (!bridge) ++ return 0; ++ ++ encoder = bridge->encoder; ++ list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { ++ int ret; ++ ++ ret = drm_atomic_bridge_check(iter, crtc_state, conn_state); ++ if (ret) ++ return ret; ++ ++ if (iter == bridge) ++ break; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(drm_atomic_bridge_chain_check); ++ + #ifdef CONFIG_OF + /** + * of_drm_find_bridge - find the bridge corresponding to the device node in +diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h +index df22f909141f..ff4df6eb2689 100644 +--- a/include/drm/drm_bridge.h ++++ b/include/drm/drm_bridge.h +@@ -111,7 +111,9 @@ struct drm_bridge_funcs { + * this function passes all other callbacks must succeed for this + * configuration. + * +- * The @mode_fixup callback is optional. ++ * The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup() ++ * is not called when &drm_bridge_funcs.atomic_check() is implemented, ++ * so only one of them should be provided. + * + * NOTE: + * +@@ -368,6 +370,28 @@ struct drm_bridge_funcs { + void (*atomic_destroy_state)(struct drm_bridge *bridge, + struct drm_bridge_state *state); + ++ /** ++ * @atomic_check: ++ * ++ * This method is responsible for checking bridge state correctness. ++ * It can also check the state of the surrounding components in chain ++ * to make sure the whole pipeline can work properly. ++ * ++ * &drm_bridge_funcs.atomic_check() hooks are called in reverse ++ * order (from the last to the first bridge). ++ * ++ * This method is optional. &drm_bridge_funcs.mode_fixup() is not ++ * called when &drm_bridge_funcs.atomic_check() is implemented, so only ++ * one of them should be provided. ++ * ++ * RETURNS: ++ * zero if the check passed, a negative error code otherwise. ++ */ ++ int (*atomic_check)(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state); ++ + /** + * @atomic_reset: + * +@@ -542,6 +566,9 @@ void drm_bridge_chain_mode_set(struct drm_bridge *bridge, + void drm_bridge_chain_pre_enable(struct drm_bridge *bridge); + void drm_bridge_chain_enable(struct drm_bridge *bridge); + ++int drm_atomic_bridge_chain_check(struct drm_bridge *bridge, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state); + void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, + struct drm_atomic_state *state); + void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-dw-hdmi-i2s-add-.get_eld-support.patch b/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-dw-hdmi-i2s-add-.get_eld-support.patch deleted file mode 100644 index 51c13b0d72..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-dw-hdmi-i2s-add-.get_eld-support.patch +++ /dev/null @@ -1,82 +0,0 @@ -From b42a8bdf2338eb4cf43b6329a0025779f5f87a85 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:07:26 +0200 -Subject: [PATCH 083/187] FROMLIST: drm/bridge: dw-hdmi-i2s: add .get_eld - support - -Provide the eld to the generic hdmi-codec driver. -This will let the driver enforce the maximum channel number and set the -channel allocation depending on the hdmi sink. - -Cc: Jonas Karlman -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 1 + - drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 11 +++++++++++ - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 1 + - 3 files changed, 13 insertions(+) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h -index 63b5756f463b..cb07dc0da5a7 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h -@@ -14,6 +14,7 @@ struct dw_hdmi_audio_data { - - struct dw_hdmi_i2s_audio_data { - struct dw_hdmi *hdmi; -+ u8 *eld; - - void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); - u8 (*read)(struct dw_hdmi *hdmi, int offset); -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index b8ece9c1ba2c..1d15cf9b6821 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -10,6 +10,7 @@ - #include - - #include -+#include - - #include - -@@ -121,6 +122,15 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) - dw_hdmi_audio_disable(hdmi); - } - -+static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf, -+ size_t len) -+{ -+ struct dw_hdmi_i2s_audio_data *audio = data; -+ -+ memcpy(buf, audio->eld, min_t(size_t, MAX_ELD_BYTES, len)); -+ return 0; -+} -+ - static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - struct device_node *endpoint) - { -@@ -144,6 +154,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, - static struct hdmi_codec_ops dw_hdmi_i2s_ops = { - .hw_params = dw_hdmi_i2s_hw_params, - .audio_shutdown = dw_hdmi_i2s_audio_shutdown, -+ .get_eld = dw_hdmi_i2s_get_eld, - .get_dai_id = dw_hdmi_i2s_get_dai_id, - }; - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index bed4bb017afd..8df69c9dbfad 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2797,6 +2797,7 @@ __dw_hdmi_probe(struct platform_device *pdev, - struct dw_hdmi_i2s_audio_data audio; - - audio.hdmi = hdmi; -+ audio.eld = hdmi->connector.eld; - audio.write = hdmi_writeb; - audio.read = hdmi_readb; - hdmi->enable_audio = dw_hdmi_i2s_audio_enable; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-drm-bridge-Add-the-necessary-bits-to-suppor.patch b/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-drm-bridge-Add-the-necessary-bits-to-suppor.patch new file mode 100644 index 0000000000..6a20c95bf5 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-drm-bridge-Add-the-necessary-bits-to-suppor.patch @@ -0,0 +1,614 @@ +From 8d7c68f6f0e96b078bdeb81189ba0e8419a03dc8 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Mon, 6 Jan 2020 15:34:09 +0100 +Subject: [PATCH 084/146] FROMLIST: drm/bridge: Add the necessary bits to + support bus format negotiation + +drm_bridge_state is extended to describe the input and output bus +configurations. These bus configurations are exposed through the +drm_bus_cfg struct which encodes the configuration of a physical +bus between two components in an output pipeline, usually between +two bridges, an encoder and a bridge, or a bridge and a connector. + +The bus configuration is stored in drm_bridge_state separately for +the input and output buses, as seen from the point of view of each +bridge. The bus configuration of a bridge output is usually identical +to the configuration of the next bridge's input, but may differ if +the signals are modified between the two bridges, for instance by an +inverter on the board. The input and output configurations of a +bridge may differ if the bridge modifies the signals internally, +for instance by performing format conversion, or*modifying signals +polarities. + +Bus format negotiation is automated by the core, drivers just have +to implement the ->atomic_get_{output,input}_bus_fmts() hooks if they +want to take part to this negotiation. Negotiation happens in reverse +order, starting from the last element of the chain (the one directly +connected to the display) up to the first element of the chain (the one +connected to the encoder). +During this negotiation all supported formats are tested until we find +one that works, meaning that the formats array should be in decreasing +preference order (assuming the driver has a preference order). + +Note that the bus format negotiation works even if some elements in the +chain don't implement the ->atomic_get_{output,input}_bus_fmts() hooks. +In that case, the core advertises only MEDIA_BUS_FMT_FIXED and lets +the previous bridge element decide what to do (most of the time, bridge +drivers will pick a default bus format or extract this piece of +information from somewhere else, like a FW property). + +v10: +* Add changelog to the commit message + +v9: +* No changes + +v8: +* Fix a test in drm_atomic_bridge_chain_select_bus_fmts() (Reported by + Jonas) + +v7: +* Adapt the code to deal with the fact that not all bridges in the + chain have a bridge state + +v5 -> v6: +* No changes + +v4: +* Enhance the doc +* Fix typos +* Rename some parameters/fields +* Reword the commit message + +v3: +* Fix the commit message (Reported by Laurent) +* Document the fact that bus formats should not be directly modified by + drivers (Suggested by Laurent) +* Document the fact that format order matters (Suggested by Laurent) +* Propagate bus flags by default +* Document the fact that drivers can tweak bus flags if needed +* Let ->atomic_get_{output,input}_bus_fmts() allocate the bus format + array (Suggested by Laurent) +* Add a drm_atomic_helper_bridge_propagate_bus_fmt() +* Mandate that bridge drivers return accurate input_fmts even if they + are known to be the first element in the bridge chain + +v2: +* Rework things to support more complex use cases + +Signed-off-by: Boris Brezillon +Signed-off-by: Neil Armstrong +[narmstrong: fixed doc in include/drm/drm_bridge.h:69 fmt->format] +Reviewed by: Jernej Skrabec +Tested-by: Jonas Karlman +--- + drivers/gpu/drm/drm_atomic_helper.c | 41 +++++ + drivers/gpu/drm/drm_bridge.c | 253 +++++++++++++++++++++++++++- + include/drm/drm_atomic.h | 42 +++++ + include/drm/drm_atomic_helper.h | 8 + + include/drm/drm_bridge.h | 82 +++++++++ + 5 files changed, 425 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c +index afe14f72a824..ea1926b5bb80 100644 +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -3528,3 +3528,44 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, + return ret; + } + EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); ++ ++/** ++ * drm_atomic_helper_bridge_propagate_bus_fmt() - Propagate output format to ++ * the input end of a bridge ++ * @bridge: bridge control structure ++ * @bridge_state: new bridge state ++ * @crtc_state: new CRTC state ++ * @conn_state: new connector state ++ * @output_fmt: tested output bus format ++ * @num_input_fmts: will contain the size of the returned array ++ * ++ * This helper is a pluggable implementation of the ++ * &drm_bridge_funcs.atomic_get_input_bus_fmts operation for bridges that don't ++ * modify the bus configuration between their input and their output. It ++ * returns an array of input formats with a single element set to @output_fmt. ++ * ++ * RETURNS: ++ * a valid format array of size @num_input_fmts, or NULL if the allocation ++ * failed ++ */ ++u32 * ++drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ u32 *input_fmts; ++ ++ input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL); ++ if (!input_fmts) { ++ *num_input_fmts = 0; ++ return NULL; ++ } ++ ++ *num_input_fmts = 1; ++ input_fmts[0] = output_fmt; ++ return input_fmts; ++} ++EXPORT_SYMBOL(drm_atomic_helper_bridge_propagate_bus_fmt); +diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c +index c8beb1385771..68ab933ee430 100644 +--- a/drivers/gpu/drm/drm_bridge.c ++++ b/drivers/gpu/drm/drm_bridge.c +@@ -628,13 +628,247 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, + return 0; + } + ++static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, ++ struct drm_bridge *cur_bridge, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 out_bus_fmt) ++{ ++ struct drm_bridge_state *cur_state; ++ unsigned int num_in_bus_fmts, i; ++ struct drm_bridge *prev_bridge; ++ u32 *in_bus_fmts; ++ int ret; ++ ++ prev_bridge = drm_bridge_get_prev_bridge(cur_bridge); ++ cur_state = drm_atomic_get_new_bridge_state(crtc_state->state, ++ cur_bridge); ++ ++ /* ++ * If bus format negotiation is not supported by this bridge, let's ++ * pass MEDIA_BUS_FMT_FIXED to the previous bridge in the chain and ++ * hope that it can handle this situation gracefully (by providing ++ * appropriate default values). ++ */ ++ if (!cur_bridge->funcs->atomic_get_input_bus_fmts) { ++ if (cur_bridge != first_bridge) { ++ ret = select_bus_fmt_recursive(first_bridge, ++ prev_bridge, crtc_state, ++ conn_state, ++ MEDIA_BUS_FMT_FIXED); ++ if (ret) ++ return ret; ++ } ++ ++ /* ++ * Driver does not implement the atomic state hooks, but that's ++ * fine, as long as it does not access the bridge state. ++ */ ++ if (cur_state) { ++ cur_state->input_bus_cfg.format = MEDIA_BUS_FMT_FIXED; ++ cur_state->output_bus_cfg.format = out_bus_fmt; ++ } ++ ++ return 0; ++ } ++ ++ /* ++ * If the driver implements ->atomic_get_input_bus_fmts() it ++ * should also implement the atomic state hooks. ++ */ ++ if (WARN_ON(!cur_state)) ++ return -EINVAL; ++ ++ in_bus_fmts = cur_bridge->funcs->atomic_get_input_bus_fmts(cur_bridge, ++ cur_state, ++ crtc_state, ++ conn_state, ++ out_bus_fmt, ++ &num_in_bus_fmts); ++ if (!num_in_bus_fmts) ++ return -ENOTSUPP; ++ else if (!in_bus_fmts) ++ return -ENOMEM; ++ ++ if (first_bridge == cur_bridge) { ++ cur_state->input_bus_cfg.format = in_bus_fmts[0]; ++ cur_state->output_bus_cfg.format = out_bus_fmt; ++ kfree(in_bus_fmts); ++ return 0; ++ } ++ ++ for (i = 0; i < num_in_bus_fmts; i++) { ++ ret = select_bus_fmt_recursive(first_bridge, prev_bridge, ++ crtc_state, conn_state, ++ in_bus_fmts[i]); ++ if (ret != -ENOTSUPP) ++ break; ++ } ++ ++ if (!ret) { ++ cur_state->input_bus_cfg.format = in_bus_fmts[i]; ++ cur_state->output_bus_cfg.format = out_bus_fmt; ++ } ++ ++ kfree(in_bus_fmts); ++ return ret; ++} ++ ++/* ++ * This function is called by &drm_atomic_bridge_chain_check() just before ++ * calling &drm_bridge_funcs.atomic_check() on all elements of the chain. ++ * It performs bus format negotiation between bridge elements. The negotiation ++ * happens in reverse order, starting from the last element in the chain up to ++ * @bridge. ++ * ++ * Negotiation starts by retrieving supported output bus formats on the last ++ * bridge element and testing them one by one. The test is recursive, meaning ++ * that for each tested output format, the whole chain will be walked backward, ++ * and each element will have to choose an input bus format that can be ++ * transcoded to the requested output format. When a bridge element does not ++ * support transcoding into a specific output format -ENOTSUPP is returned and ++ * the next bridge element will have to try a different format. If none of the ++ * combinations worked, -ENOTSUPP is returned and the atomic modeset will fail. ++ * ++ * This implementation is relying on ++ * &drm_bridge_funcs.atomic_get_output_bus_fmts() and ++ * &drm_bridge_funcs.atomic_get_input_bus_fmts() to gather supported ++ * input/output formats. ++ * ++ * When &drm_bridge_funcs.atomic_get_output_bus_fmts() is not implemented by ++ * the last element of the chain, &drm_atomic_bridge_chain_select_bus_fmts() ++ * tries a single format: &drm_connector.display_info.bus_formats[0] if ++ * available, MEDIA_BUS_FMT_FIXED otherwise. ++ * ++ * When &drm_bridge_funcs.atomic_get_input_bus_fmts() is not implemented, ++ * &drm_atomic_bridge_chain_select_bus_fmts() skips the negotiation on the ++ * bridge element that lacks this hook and asks the previous element in the ++ * chain to try MEDIA_BUS_FMT_FIXED. It's up to bridge drivers to decide what ++ * to do in that case (fail if they want to enforce bus format negotiation, or ++ * provide a reasonable default if they need to support pipelines where not ++ * all elements support bus format negotiation). ++ */ ++static int ++drm_atomic_bridge_chain_select_bus_fmts(struct drm_bridge *bridge, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct drm_connector *conn = conn_state->connector; ++ struct drm_encoder *encoder = bridge->encoder; ++ struct drm_bridge_state *last_bridge_state; ++ unsigned int i, num_out_bus_fmts; ++ struct drm_bridge *last_bridge; ++ u32 *out_bus_fmts; ++ int ret = 0; ++ ++ last_bridge = list_last_entry(&encoder->bridge_chain, ++ struct drm_bridge, chain_node); ++ last_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, ++ last_bridge); ++ ++ if (last_bridge->funcs->atomic_get_output_bus_fmts) { ++ const struct drm_bridge_funcs *funcs = last_bridge->funcs; ++ ++ /* ++ * If the driver implements ->atomic_get_output_bus_fmts() it ++ * should also implement the atomic state hooks. ++ */ ++ if (WARN_ON(!last_bridge_state)) ++ return -EINVAL; ++ ++ out_bus_fmts = funcs->atomic_get_output_bus_fmts(last_bridge, ++ last_bridge_state, ++ crtc_state, ++ conn_state, ++ &num_out_bus_fmts); ++ if (!num_out_bus_fmts) ++ return -ENOTSUPP; ++ else if (!out_bus_fmts) ++ return -ENOMEM; ++ } else { ++ num_out_bus_fmts = 1; ++ out_bus_fmts = kmalloc(sizeof(*out_bus_fmts), GFP_KERNEL); ++ if (!out_bus_fmts) ++ return -ENOMEM; ++ ++ if (conn->display_info.num_bus_formats && ++ conn->display_info.bus_formats) ++ out_bus_fmts[0] = conn->display_info.bus_formats[0]; ++ else ++ out_bus_fmts[0] = MEDIA_BUS_FMT_FIXED; ++ } ++ ++ for (i = 0; i < num_out_bus_fmts; i++) { ++ ret = select_bus_fmt_recursive(bridge, last_bridge, crtc_state, ++ conn_state, out_bus_fmts[i]); ++ if (ret != -ENOTSUPP) ++ break; ++ } ++ ++ kfree(out_bus_fmts); ++ ++ return ret; ++} ++ ++static void ++drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge, ++ struct drm_connector *conn, ++ struct drm_atomic_state *state) ++{ ++ struct drm_bridge_state *bridge_state, *next_bridge_state; ++ struct drm_bridge *next_bridge; ++ u32 output_flags = 0; ++ ++ bridge_state = drm_atomic_get_new_bridge_state(state, bridge); ++ ++ /* No bridge state attached to this bridge => nothing to propagate. */ ++ if (!bridge_state) ++ return; ++ ++ next_bridge = drm_bridge_get_next_bridge(bridge); ++ ++ /* ++ * Let's try to apply the most common case here, that is, propagate ++ * display_info flags for the last bridge, and propagate the input ++ * flags of the next bridge element to the output end of the current ++ * bridge when the bridge is not the last one. ++ * There are exceptions to this rule, like when signal inversion is ++ * happening at the board level, but that's something drivers can deal ++ * with from their &drm_bridge_funcs.atomic_check() implementation by ++ * simply overriding the flags value we've set here. ++ */ ++ if (!next_bridge) { ++ output_flags = conn->display_info.bus_flags; ++ } else { ++ next_bridge_state = drm_atomic_get_new_bridge_state(state, ++ next_bridge); ++ /* ++ * No bridge state attached to the next bridge, just leave the ++ * flags to 0. ++ */ ++ if (next_bridge_state) ++ output_flags = next_bridge_state->input_bus_cfg.flags; ++ } ++ ++ bridge_state->output_bus_cfg.flags = output_flags; ++ ++ /* ++ * Propage the output flags to the input end of the bridge. Again, it's ++ * not necessarily what all bridges want, but that's what most of them ++ * do, and by doing that by default we avoid forcing drivers to ++ * duplicate the "dummy propagation" logic. ++ */ ++ bridge_state->input_bus_cfg.flags = output_flags; ++} ++ + /** + * drm_atomic_bridge_chain_check() - Do an atomic check on the bridge chain + * @bridge: bridge control structure + * @crtc_state: new CRTC state + * @conn_state: new connector state + * +- * Calls &drm_bridge_funcs.atomic_check() (falls back on ++ * First trigger a bus format negotiation before calling ++ * &drm_bridge_funcs.atomic_check() (falls back on + * &drm_bridge_funcs.mode_fixup()) op for all the bridges in the encoder chain, + * starting from the last bridge to the first. These are called before calling + * &drm_encoder_helper_funcs.atomic_check() +@@ -646,16 +880,33 @@ int drm_atomic_bridge_chain_check(struct drm_bridge *bridge, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) + { ++ struct drm_connector *conn = conn_state->connector; + struct drm_encoder *encoder; + struct drm_bridge *iter; ++ int ret; + + if (!bridge) + return 0; + ++ ret = drm_atomic_bridge_chain_select_bus_fmts(bridge, crtc_state, ++ conn_state); ++ if (ret) ++ return ret; ++ + encoder = bridge->encoder; + list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { + int ret; + ++ /* ++ * Bus flags are propagated by default. If a bridge needs to ++ * tweak the input bus flags for any reason, it should happen ++ * in its &drm_bridge_funcs.atomic_check() implementation such ++ * that preceding bridges in the chain can propagate the new ++ * bus flags. ++ */ ++ drm_atomic_bridge_propagate_bus_flags(iter, conn, ++ crtc_state->state); ++ + ret = drm_atomic_bridge_check(iter, crtc_state, conn_state); + if (ret) + return ret; +diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h +index 82a888769b3d..52d65a055491 100644 +--- a/include/drm/drm_atomic.h ++++ b/include/drm/drm_atomic.h +@@ -995,6 +995,38 @@ drm_atomic_crtc_effectively_active(const struct drm_crtc_state *state) + return state->active || state->self_refresh_active; + } + ++/** ++ * struct drm_bus_cfg - bus configuration ++ * ++ * This structure stores the configuration of a physical bus between two ++ * components in an output pipeline, usually between two bridges, an encoder ++ * and a bridge, or a bridge and a connector. ++ * ++ * The bus configuration is stored in &drm_bridge_state separately for the ++ * input and output buses, as seen from the point of view of each bridge. The ++ * bus configuration of a bridge output is usually identical to the ++ * configuration of the next bridge's input, but may differ if the signals are ++ * modified between the two bridges, for instance by an inverter on the board. ++ * The input and output configurations of a bridge may differ if the bridge ++ * modifies the signals internally, for instance by performing format ++ * conversion, or modifying signals polarities. ++ */ ++struct drm_bus_cfg { ++ /** ++ * @format: format used on this bus (one of the MEDIA_BUS_FMT_* format) ++ * ++ * This field should not be directly modified by drivers ++ * (&drm_atomic_bridge_chain_select_bus_fmts() takes care of the bus ++ * format negotiation). ++ */ ++ u32 format; ++ ++ /** ++ * @flags: DRM_BUS_* flags used on this bus ++ */ ++ u32 flags; ++}; ++ + /** + * struct drm_bridge_state - Atomic bridge state object + */ +@@ -1008,6 +1040,16 @@ struct drm_bridge_state { + * @bridge: the bridge this state refers to + */ + struct drm_bridge *bridge; ++ ++ /** ++ * @input_bus_cfg: input bus configuration ++ */ ++ struct drm_bus_cfg input_bus_cfg; ++ ++ /** ++ * @output_bus_cfg: input bus configuration ++ */ ++ struct drm_bus_cfg output_bus_cfg; + }; + + static inline struct drm_bridge_state * +diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h +index 9db3cac48f4f..b268180c97eb 100644 +--- a/include/drm/drm_atomic_helper.h ++++ b/include/drm/drm_atomic_helper.h +@@ -224,4 +224,12 @@ drm_atomic_plane_disabling(struct drm_plane_state *old_plane_state, + return old_plane_state->crtc && !new_plane_state->crtc; + } + ++u32 * ++drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts); ++ + #endif /* DRM_ATOMIC_HELPER_H_ */ +diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h +index ff4df6eb2689..45626ecf20f8 100644 +--- a/include/drm/drm_bridge.h ++++ b/include/drm/drm_bridge.h +@@ -370,6 +370,72 @@ struct drm_bridge_funcs { + void (*atomic_destroy_state)(struct drm_bridge *bridge, + struct drm_bridge_state *state); + ++ /** ++ * @atomic_get_output_bus_fmts: ++ * ++ * Return the supported bus formats on the output end of a bridge. ++ * The returned array must be allocated with kmalloc() and will be ++ * freed by the caller. If the allocation fails, NULL should be ++ * returned. num_output_fmts must be set to the returned array size. ++ * Formats listed in the returned array should be listed in decreasing ++ * preference order (the core will try all formats until it finds one ++ * that works). ++ * ++ * This method is only called on the last element of the bridge chain ++ * as part of the bus format negotiation process that happens in ++ * &drm_atomic_bridge_chain_select_bus_fmts(). ++ * This method is optional. When not implemented, the core will ++ * fall back to &drm_connector.display_info.bus_formats[0] if ++ * &drm_connector.display_info.num_bus_formats > 0, ++ * or to MEDIA_BUS_FMT_FIXED otherwise. ++ */ ++ u32 *(*atomic_get_output_bus_fmts)(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ unsigned int *num_output_fmts); ++ ++ /** ++ * @atomic_get_input_bus_fmts: ++ * ++ * Return the supported bus formats on the input end of a bridge for ++ * a specific output bus format. ++ * ++ * The returned array must be allocated with kmalloc() and will be ++ * freed by the caller. If the allocation fails, NULL should be ++ * returned. num_output_fmts must be set to the returned array size. ++ * Formats listed in the returned array should be listed in decreasing ++ * preference order (the core will try all formats until it finds one ++ * that works). When the format is not supported NULL should be ++ * returned and *num_output_fmts should be set to 0. ++ * ++ * This method is called on all elements of the bridge chain as part of ++ * the bus format negotiation process that happens in ++ * &drm_atomic_bridge_chain_select_bus_fmts(). ++ * This method is optional. When not implemented, the core will bypass ++ * bus format negotiation on this element of the bridge without ++ * failing, and the previous element in the chain will be passed ++ * MEDIA_BUS_FMT_FIXED as its output bus format. ++ * ++ * Bridge drivers that need to support being linked to bridges that are ++ * not supporting bus format negotiation should handle the ++ * output_fmt == MEDIA_BUS_FMT_FIXED case appropriately, by selecting a ++ * sensible default value or extracting this information from somewhere ++ * else (FW property, &drm_display_mode, &drm_display_info, ...) ++ * ++ * Note: Even if input format selection on the first bridge has no ++ * impact on the negotiation process (bus format negotiation stops once ++ * we reach the first element of the chain), drivers are expected to ++ * return accurate input formats as the input format may be used to ++ * configure the CRTC output appropriately. ++ */ ++ u32 *(*atomic_get_input_bus_fmts)(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts); ++ + /** + * @atomic_check: + * +@@ -384,6 +450,14 @@ struct drm_bridge_funcs { + * called when &drm_bridge_funcs.atomic_check() is implemented, so only + * one of them should be provided. + * ++ * If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or ++ * &drm_bridge_state.output_bus_cfg.flags it should should happen in ++ * this function. By default the &drm_bridge_state.output_bus_cfg.flags ++ * field is set to the next bridge ++ * &drm_bridge_state.input_bus_cfg.flags value or ++ * &drm_connector.display_info.bus_flags if the bridge is the last ++ * element in the chain. ++ * + * RETURNS: + * zero if the check passed, a negative error code otherwise. + */ +@@ -578,6 +652,14 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, + void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, + struct drm_atomic_state *state); + ++u32 * ++drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts); ++ + #ifdef CONFIG_DRM_PANEL_BRIDGE + struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel); + struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-dt-bindings-clock-meson-add-resets-to-the-a.patch b/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-dt-bindings-clock-meson-add-resets-to-the-a.patch deleted file mode 100644 index da992948bd..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-dt-bindings-clock-meson-add-resets-to-the-a.patch +++ /dev/null @@ -1,76 +0,0 @@ -From b18bdfbe3c9f71e07f6f5cbc88194c4e9ab87952 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:32:52 +0200 -Subject: [PATCH 084/187] FROMLIST: dt-bindings: clock: meson: add resets to - the audio clock controller - -Add the documentation and bindings for the resets provided by the g12a -audio clock controller - -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - .../bindings/clock/amlogic,axg-audio-clkc.txt | 1 + - .../reset/amlogic,meson-g12a-audio-reset.h | 38 +++++++++++++++++++ - 2 files changed, 39 insertions(+) - create mode 100644 include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h - -diff --git a/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt b/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt -index 0f777749f4f1..b3957d10d241 100644 ---- a/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt -+++ b/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt -@@ -22,6 +22,7 @@ Required Properties: - components. - - resets : phandle of the internal reset line - - #clock-cells : should be 1. -+- #reset-cells : should be 1 on the g12a (and following) soc family - - Each clock is assigned an identifier and client nodes can use this identifier - to specify the clock which they consume. All available clocks are defined as -diff --git a/include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h b/include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h -new file mode 100644 -index 000000000000..14b78dabed0e ---- /dev/null -+++ b/include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h -@@ -0,0 +1,38 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+/* -+ * Copyright (c) 2019 BayLibre, SAS. -+ * Author: Jerome Brunet -+ * -+ */ -+ -+#ifndef _DT_BINDINGS_AMLOGIC_MESON_G12A_AUDIO_RESET_H -+#define _DT_BINDINGS_AMLOGIC_MESON_G12A_AUDIO_RESET_H -+ -+#define AUD_RESET_PDM 0 -+#define AUD_RESET_TDMIN_A 1 -+#define AUD_RESET_TDMIN_B 2 -+#define AUD_RESET_TDMIN_C 3 -+#define AUD_RESET_TDMIN_LB 4 -+#define AUD_RESET_LOOPBACK 5 -+#define AUD_RESET_TODDR_A 6 -+#define AUD_RESET_TODDR_B 7 -+#define AUD_RESET_TODDR_C 8 -+#define AUD_RESET_FRDDR_A 9 -+#define AUD_RESET_FRDDR_B 10 -+#define AUD_RESET_FRDDR_C 11 -+#define AUD_RESET_TDMOUT_A 12 -+#define AUD_RESET_TDMOUT_B 13 -+#define AUD_RESET_TDMOUT_C 14 -+#define AUD_RESET_SPDIFOUT 15 -+#define AUD_RESET_SPDIFOUT_B 16 -+#define AUD_RESET_SPDIFIN 17 -+#define AUD_RESET_EQDRC 18 -+#define AUD_RESET_RESAMPLE 19 -+#define AUD_RESET_DDRARB 20 -+#define AUD_RESET_POWDET 21 -+#define AUD_RESET_TORAM 22 -+#define AUD_RESET_TOACODEC 23 -+#define AUD_RESET_TOHDMITX 24 -+#define AUD_RESET_CLKTREE 25 -+ -+#endif --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-clk-meson-axg-audio-add-g12a-reset-support.patch b/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-clk-meson-axg-audio-add-g12a-reset-support.patch deleted file mode 100644 index 838c73ae00..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-clk-meson-axg-audio-add-g12a-reset-support.patch +++ /dev/null @@ -1,186 +0,0 @@ -From ac0a918b1d5c5cb68f340e5b2d7b84df10d7fd58 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 12 Aug 2019 14:32:53 +0200 -Subject: [PATCH 085/187] FROMLIST: clk: meson: axg-audio: add g12a reset - support - -On the g12a, the register space dedicated to the audio clock also -provides some resets. Let the clock controller register a reset -provider as well for this SoC family. - -the axg SoC family does not appear to provide this feature. - -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - drivers/clk/meson/axg-audio.c | 107 +++++++++++++++++++++++++++++++++- - drivers/clk/meson/axg-audio.h | 1 + - 2 files changed, 106 insertions(+), 2 deletions(-) - -diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c -index 741df7e955ca..6be9df1efce5 100644 ---- a/drivers/clk/meson/axg-audio.c -+++ b/drivers/clk/meson/axg-audio.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - - #include "axg-audio.h" -@@ -918,6 +919,84 @@ static int devm_clk_get_enable(struct device *dev, char *id) - return 0; - } - -+struct axg_audio_reset_data { -+ struct reset_controller_dev rstc; -+ struct regmap *map; -+ unsigned int offset; -+}; -+ -+static void axg_audio_reset_reg_and_bit(struct axg_audio_reset_data *rst, -+ unsigned long id, -+ unsigned int *reg, -+ unsigned int *bit) -+{ -+ unsigned int stride = regmap_get_reg_stride(rst->map); -+ -+ *reg = (id / (stride * BITS_PER_BYTE)) * stride; -+ *reg += rst->offset; -+ *bit = id % (stride * BITS_PER_BYTE); -+} -+ -+static int axg_audio_reset_update(struct reset_controller_dev *rcdev, -+ unsigned long id, bool assert) -+{ -+ struct axg_audio_reset_data *rst = -+ container_of(rcdev, struct axg_audio_reset_data, rstc); -+ unsigned int offset, bit; -+ -+ axg_audio_reset_reg_and_bit(rst, id, &offset, &bit); -+ -+ regmap_update_bits(rst->map, offset, BIT(bit), -+ assert ? BIT(bit) : 0); -+ -+ return 0; -+} -+ -+static int axg_audio_reset_status(struct reset_controller_dev *rcdev, -+ unsigned long id) -+{ -+ struct axg_audio_reset_data *rst = -+ container_of(rcdev, struct axg_audio_reset_data, rstc); -+ unsigned int val, offset, bit; -+ -+ axg_audio_reset_reg_and_bit(rst, id, &offset, &bit); -+ -+ regmap_read(rst->map, offset, &val); -+ -+ return !!(val & BIT(bit)); -+} -+ -+static int axg_audio_reset_assert(struct reset_controller_dev *rcdev, -+ unsigned long id) -+{ -+ return axg_audio_reset_update(rcdev, id, true); -+} -+ -+static int axg_audio_reset_deassert(struct reset_controller_dev *rcdev, -+ unsigned long id) -+{ -+ return axg_audio_reset_update(rcdev, id, false); -+} -+ -+static int axg_audio_reset_toggle(struct reset_controller_dev *rcdev, -+ unsigned long id) -+{ -+ int ret; -+ -+ ret = axg_audio_reset_assert(rcdev, id); -+ if (ret) -+ return ret; -+ -+ return axg_audio_reset_deassert(rcdev, id); -+} -+ -+static const struct reset_control_ops axg_audio_rstc_ops = { -+ .assert = axg_audio_reset_assert, -+ .deassert = axg_audio_reset_deassert, -+ .reset = axg_audio_reset_toggle, -+ .status = axg_audio_reset_status, -+}; -+ - static const struct regmap_config axg_audio_regmap_cfg = { - .reg_bits = 32, - .val_bits = 32, -@@ -927,12 +1006,15 @@ static const struct regmap_config axg_audio_regmap_cfg = { - - struct audioclk_data { - struct clk_hw_onecell_data *hw_onecell_data; -+ unsigned int reset_offset; -+ unsigned int reset_num; - }; - - static int axg_audio_clkc_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; - const struct audioclk_data *data; -+ struct axg_audio_reset_data *rst; - struct regmap *map; - struct resource *res; - void __iomem *regs; -@@ -984,8 +1066,27 @@ static int axg_audio_clkc_probe(struct platform_device *pdev) - } - } - -- return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, -- data->hw_onecell_data); -+ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, -+ data->hw_onecell_data); -+ if (ret) -+ return ret; -+ -+ /* Stop here if there is no reset */ -+ if (!data->reset_num) -+ return 0; -+ -+ rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL); -+ if (!rst) -+ return -ENOMEM; -+ -+ rst->map = map; -+ rst->offset = data->reset_offset; -+ rst->rstc.nr_resets = data->reset_num; -+ rst->rstc.ops = &axg_audio_rstc_ops; -+ rst->rstc.of_node = dev->of_node; -+ rst->rstc.owner = THIS_MODULE; -+ -+ return devm_reset_controller_register(dev, &rst->rstc); - } - - static const struct audioclk_data axg_audioclk_data = { -@@ -994,6 +1095,8 @@ static const struct audioclk_data axg_audioclk_data = { - - static const struct audioclk_data g12a_audioclk_data = { - .hw_onecell_data = &g12a_audio_hw_onecell_data, -+ .reset_offset = AUDIO_SW_RESET, -+ .reset_num = 26, - }; - - static const struct of_device_id clkc_match_table[] = { -diff --git a/drivers/clk/meson/axg-audio.h b/drivers/clk/meson/axg-audio.h -index 5d972d55d6c7..c00e28b2e1a9 100644 ---- a/drivers/clk/meson/axg-audio.h -+++ b/drivers/clk/meson/axg-audio.h -@@ -22,6 +22,7 @@ - #define AUDIO_MCLK_F_CTRL 0x018 - #define AUDIO_MST_PAD_CTRL0 0x01c - #define AUDIO_MST_PAD_CTRL1 0x020 -+#define AUDIO_SW_RESET 0x024 - #define AUDIO_MST_A_SCLK_CTRL0 0x040 - #define AUDIO_MST_A_SCLK_CTRL1 0x044 - #define AUDIO_MST_B_SCLK_CTRL0 0x048 --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-drm-imx-pd-Use-bus-format-flags-provided-by.patch b/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-drm-imx-pd-Use-bus-format-flags-provided-by.patch new file mode 100644 index 0000000000..fbaa577586 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-drm-imx-pd-Use-bus-format-flags-provided-by.patch @@ -0,0 +1,304 @@ +From 0f965c7cf688112d82449247551056f8c19e8d12 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Wed, 7 Aug 2019 17:46:37 +0200 +Subject: [PATCH 085/146] FROMLIST: drm/imx: pd: Use bus format/flags provided + by the bridge when available + +Now that bridges can expose the bus format/flags they expect, we can +use those instead of the relying on the display_info provided by the +connector (which is only valid if the encoder is directly connected +to bridge element driving the panel/display). + +We also explicitly expose the bus formats supported by our encoder by +filling encoder->output_bus_caps with proper info. + +v10: +* Add changelog to the commit message +* Use kmalloc() instead of kcalloc() +* Add a dev_warn() when unsupported flags are requested + +v8 -> v9: +* No changes + +v7: +* Add an imx_pd_format_supported() helper (suggested by Philipp) +* Simplify imx_pd_bridge_atomic_get_output_bus_fmts() (suggested by Philipp) +* Simplify imx_pd_bridge_atomic_get_input_bus_fmts() +* Explicitly set the duplicate/destro_state() and reset() hooks + +v4 -> v6: +* Patch was not part of the series + +v3 (all suggested by Philipp): +* Adjust to match core changes +* Propagate output format to input format +* Pick a default value when output_fmt = _FIXED +* Add missing BGR888 and GBR888 fmts to imx_pd_bus_fmts[] + +v2: +* Adjust things to match the new bus-format negotiation infra + +Signed-off-by: Boris Brezillon +--- + drivers/gpu/drm/imx/parallel-display.c | 177 +++++++++++++++++++++---- + 1 file changed, 152 insertions(+), 25 deletions(-) + +diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c +index 3dca424059f7..dc05506b6d4b 100644 +--- a/drivers/gpu/drm/imx/parallel-display.c ++++ b/drivers/gpu/drm/imx/parallel-display.c +@@ -24,6 +24,7 @@ + struct imx_parallel_display { + struct drm_connector connector; + struct drm_encoder encoder; ++ struct drm_bridge bridge; + struct device *dev; + void *edid; + int edid_len; +@@ -31,7 +32,7 @@ struct imx_parallel_display { + u32 bus_flags; + struct drm_display_mode mode; + struct drm_panel *panel; +- struct drm_bridge *bridge; ++ struct drm_bridge *next_bridge; + }; + + static inline struct imx_parallel_display *con_to_imxpd(struct drm_connector *c) +@@ -44,6 +45,11 @@ static inline struct imx_parallel_display *enc_to_imxpd(struct drm_encoder *e) + return container_of(e, struct imx_parallel_display, encoder); + } + ++static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b) ++{ ++ return container_of(b, struct imx_parallel_display, bridge); ++} ++ + static int imx_pd_connector_get_modes(struct drm_connector *connector) + { + struct imx_parallel_display *imxpd = con_to_imxpd(connector); +@@ -89,37 +95,149 @@ static struct drm_encoder *imx_pd_connector_best_encoder( + return &imxpd->encoder; + } + +-static void imx_pd_encoder_enable(struct drm_encoder *encoder) ++static void imx_pd_bridge_enable(struct drm_bridge *bridge) + { +- struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); ++ struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); + + drm_panel_prepare(imxpd->panel); + drm_panel_enable(imxpd->panel); + } + +-static void imx_pd_encoder_disable(struct drm_encoder *encoder) ++static void imx_pd_bridge_disable(struct drm_bridge *bridge) + { +- struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); ++ struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); + + drm_panel_disable(imxpd->panel); + drm_panel_unprepare(imxpd->panel); + } + +-static int imx_pd_encoder_atomic_check(struct drm_encoder *encoder, +- struct drm_crtc_state *crtc_state, +- struct drm_connector_state *conn_state) ++static const u32 imx_pd_bus_fmts[] = { ++ MEDIA_BUS_FMT_RGB888_1X24, ++ MEDIA_BUS_FMT_BGR888_1X24, ++ MEDIA_BUS_FMT_GBR888_1X24, ++ MEDIA_BUS_FMT_RGB666_1X18, ++ MEDIA_BUS_FMT_RGB666_1X24_CPADHI, ++ MEDIA_BUS_FMT_RGB565_1X16, ++}; ++ ++static u32 * ++imx_pd_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ unsigned int *num_output_fmts) + { +- struct imx_crtc_state *imx_crtc_state = to_imx_crtc_state(crtc_state); + struct drm_display_info *di = &conn_state->connector->display_info; +- struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); ++ struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); ++ u32 *output_fmts; + +- if (!imxpd->bus_format && di->num_bus_formats) { +- imx_crtc_state->bus_flags = di->bus_flags; +- imx_crtc_state->bus_format = di->bus_formats[0]; +- } else { +- imx_crtc_state->bus_flags = imxpd->bus_flags; +- imx_crtc_state->bus_format = imxpd->bus_format; ++ if (!imxpd->bus_format && !di->num_bus_formats) { ++ *num_output_fmts = ARRAY_SIZE(imx_pd_bus_fmts); ++ return kmemdup(imx_pd_bus_fmts, sizeof(imx_pd_bus_fmts), ++ GFP_KERNEL); ++ } ++ ++ *num_output_fmts = 1; ++ output_fmts = kmalloc(sizeof(*output_fmts), GFP_KERNEL); ++ if (!output_fmts) ++ return NULL; ++ ++ if (!imxpd->bus_format && di->num_bus_formats) ++ output_fmts[0] = di->bus_formats[0]; ++ else ++ output_fmts[0] = imxpd->bus_format; ++ ++ return output_fmts; ++} ++ ++static bool imx_pd_format_supported(u32 output_fmt) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(imx_pd_bus_fmts); i++) { ++ if (imx_pd_bus_fmts[i] == output_fmt) ++ return true; ++ } ++ ++ return false; ++} ++ ++static u32 * ++imx_pd_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); ++ u32 *input_fmts; ++ ++ /* ++ * If the next bridge does not support bus format negotiation, let's ++ * use the static bus format definition (imxpd->bus_format) if it's ++ * specified, RGB888 when it's not. ++ */ ++ if (output_fmt == MEDIA_BUS_FMT_FIXED) ++ output_fmt = imxpd->bus_format ? : MEDIA_BUS_FMT_RGB888_1X24; ++ ++ /* Now make sure the requested output format is supported. */ ++ if ((imxpd->bus_format && imxpd->bus_format != output_fmt) || ++ !imx_pd_format_supported(output_fmt)) { ++ *num_input_fmts = 0; ++ return NULL; ++ } ++ ++ *num_input_fmts = 1; ++ input_fmts = kcalloc(*num_input_fmts, sizeof(*input_fmts), ++ GFP_KERNEL); ++ if (!input_fmts) ++ return NULL; ++ ++ input_fmts[0] = output_fmt; ++ return input_fmts; ++} ++ ++static int imx_pd_bridge_atomic_check(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct imx_crtc_state *imx_crtc_state = to_imx_crtc_state(crtc_state); ++ struct drm_display_info *di = &conn_state->connector->display_info; ++ struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); ++ struct drm_bridge_state *next_bridge_state = NULL; ++ struct drm_bridge *next_bridge; ++ u32 bus_flags, bus_fmt; ++ ++ next_bridge = drm_bridge_get_next_bridge(bridge); ++ if (next_bridge) ++ next_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, ++ next_bridge); ++ ++ if (next_bridge_state) ++ bus_flags = next_bridge_state->input_bus_cfg.flags; ++ else if (!imxpd->bus_format && di->num_bus_formats) ++ bus_flags = di->bus_flags; ++ else ++ bus_flags = imxpd->bus_flags; ++ ++ bus_fmt = bridge_state->input_bus_cfg.format; ++ if (!imx_pd_format_supported(bus_fmt)) ++ return -EINVAL; ++ ++ if (bus_flags & ++ ~(DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_DE_HIGH | ++ DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | ++ DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)) { ++ dev_warn(imxpd->dev, "invalid bus_flags (%x)\n", bus_flags); ++ return -EINVAL; + } ++ ++ bridge_state->output_bus_cfg.flags = bus_flags; ++ bridge_state->input_bus_cfg.flags = bus_flags; ++ imx_crtc_state->bus_flags = bus_flags; ++ imx_crtc_state->bus_format = bridge_state->input_bus_cfg.format; + imx_crtc_state->di_hsync_pin = 2; + imx_crtc_state->di_vsync_pin = 3; + +@@ -143,10 +261,15 @@ static const struct drm_encoder_funcs imx_pd_encoder_funcs = { + .destroy = imx_drm_encoder_destroy, + }; + +-static const struct drm_encoder_helper_funcs imx_pd_encoder_helper_funcs = { +- .enable = imx_pd_encoder_enable, +- .disable = imx_pd_encoder_disable, +- .atomic_check = imx_pd_encoder_atomic_check, ++static const struct drm_bridge_funcs imx_pd_bridge_funcs = { ++ .enable = imx_pd_bridge_enable, ++ .disable = imx_pd_bridge_disable, ++ .atomic_reset = drm_atomic_helper_bridge_reset, ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_check = imx_pd_bridge_atomic_check, ++ .atomic_get_input_bus_fmts = imx_pd_bridge_atomic_get_input_bus_fmts, ++ .atomic_get_output_bus_fmts = imx_pd_bridge_atomic_get_output_bus_fmts, + }; + + static int imx_pd_register(struct drm_device *drm, +@@ -166,11 +289,13 @@ static int imx_pd_register(struct drm_device *drm, + */ + imxpd->connector.dpms = DRM_MODE_DPMS_OFF; + +- drm_encoder_helper_add(encoder, &imx_pd_encoder_helper_funcs); + drm_encoder_init(drm, encoder, &imx_pd_encoder_funcs, + DRM_MODE_ENCODER_NONE, NULL); + +- if (!imxpd->bridge) { ++ imxpd->bridge.funcs = &imx_pd_bridge_funcs; ++ drm_bridge_attach(encoder, &imxpd->bridge, NULL); ++ ++ if (!imxpd->next_bridge) { + drm_connector_helper_add(&imxpd->connector, + &imx_pd_connector_helper_funcs); + drm_connector_init(drm, &imxpd->connector, +@@ -181,8 +306,9 @@ static int imx_pd_register(struct drm_device *drm, + if (imxpd->panel) + drm_panel_attach(imxpd->panel, &imxpd->connector); + +- if (imxpd->bridge) { +- ret = drm_bridge_attach(encoder, imxpd->bridge, NULL); ++ if (imxpd->next_bridge) { ++ ret = drm_bridge_attach(encoder, imxpd->next_bridge, ++ &imxpd->bridge); + if (ret < 0) { + dev_err(imxpd->dev, "failed to attach bridge: %d\n", + ret); +@@ -227,7 +353,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) + imxpd->bus_format = bus_format; + + /* port@1 is the output port */ +- ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge); ++ ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, ++ &imxpd->next_bridge); + if (ret && ret != -ENODEV) + return ret; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0086-FROMLIST-drm-bridge-lvds-codec-Implement-basic-bus-f.patch b/packages/linux/patches/amlogic/amlogic-0086-FROMLIST-drm-bridge-lvds-codec-Implement-basic-bus-f.patch new file mode 100644 index 0000000000..7b0ead35e0 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0086-FROMLIST-drm-bridge-lvds-codec-Implement-basic-bus-f.patch @@ -0,0 +1,159 @@ +From 9d32ba0831e5ca96e8575dc2b3f07d8cc0daf215 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Wed, 7 Aug 2019 17:50:10 +0200 +Subject: [PATCH 086/146] FROMLIST: drm/bridge: lvds-codec: Implement basic bus + format negotiation + +Some DPI -> LVDS encoders might support several input bus width. Add a +DT property to describe the bus width used on a specific design. + +v10: +* Add changelog to the commit message + +v8 -> v9: +* No changes + +v7: +* Fix a use-after-release problem +* Get rid of the data-mapping parsing +* Use kmalloc instead of kcalloc. + +v4 -> v6: +* Not part of the series + +v3: +* Use bus-width for the rgb24/rgb18 distinction +* Adjust code to match core changes +* Get rid of of_get_data_mapping() +* Don't implement ->atomic_check() (the core now takes care of bus + flags propagation) + +v2: +* Make the bus-format negotiation logic more generic + +Signed-off-by: Boris Brezillon +--- + drivers/gpu/drm/bridge/lvds-codec.c | 64 ++++++++++++++++++++++++++--- + 1 file changed, 58 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c +index 5f04cc11227e..f4fd8472c335 100644 +--- a/drivers/gpu/drm/bridge/lvds-codec.c ++++ b/drivers/gpu/drm/bridge/lvds-codec.c +@@ -11,6 +11,7 @@ + #include + #include + ++#include + #include + #include + +@@ -19,6 +20,7 @@ struct lvds_codec { + struct drm_bridge *panel_bridge; + struct gpio_desc *powerdown_gpio; + u32 connector_type; ++ u32 input_fmt; + }; + + static int lvds_codec_attach(struct drm_bridge *bridge) +@@ -48,18 +50,47 @@ static void lvds_codec_disable(struct drm_bridge *bridge) + gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 1); + } + ++static u32 * ++lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ struct lvds_codec *lvds_codec = container_of(bridge, ++ struct lvds_codec, bridge); ++ u32 *input_fmts; ++ ++ input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); ++ if (!input_fmts) { ++ *num_input_fmts = 0; ++ return NULL; ++ } ++ ++ *num_input_fmts = 1; ++ input_fmts[0] = lvds_codec->input_fmt; ++ return input_fmts; ++} ++ + static struct drm_bridge_funcs funcs = { + .attach = lvds_codec_attach, + .enable = lvds_codec_enable, + .disable = lvds_codec_disable, ++ .atomic_reset = drm_atomic_helper_bridge_reset, ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_get_input_bus_fmts = lvds_codec_atomic_get_input_bus_fmts, + }; + + static int lvds_codec_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +- struct device_node *panel_node; ++ struct device_node *np; + struct drm_panel *panel; + struct lvds_codec *lvds_codec; ++ u32 input_bus_width; ++ int err; + + lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL); + if (!lvds_codec) +@@ -69,22 +100,43 @@ static int lvds_codec_probe(struct platform_device *pdev) + lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown", + GPIOD_OUT_HIGH); + if (IS_ERR(lvds_codec->powerdown_gpio)) { +- int err = PTR_ERR(lvds_codec->powerdown_gpio); ++ err = PTR_ERR(lvds_codec->powerdown_gpio); + + if (err != -EPROBE_DEFER) + dev_err(dev, "powerdown GPIO failure: %d\n", err); + return err; + } + ++ np = of_graph_get_port_by_id(dev->of_node, 0); ++ if (!np) { ++ dev_dbg(dev, "port 0 not found\n"); ++ return -ENXIO; ++ } ++ ++ err = of_property_read_u32(np, "bus-width", &input_bus_width); ++ of_node_put(np); ++ ++ if (err) { ++ lvds_codec->input_fmt = MEDIA_BUS_FMT_FIXED; ++ } else if (input_bus_width == 18) { ++ lvds_codec->input_fmt = MEDIA_BUS_FMT_RGB666_1X18; ++ } else if (input_bus_width == 24) { ++ lvds_codec->input_fmt = MEDIA_BUS_FMT_RGB888_1X24; ++ } else { ++ dev_dbg(dev, "unsupported bus-width value %u on port 0\n", ++ input_bus_width); ++ return -ENOTSUPP; ++ } ++ + /* Locate the panel DT node. */ +- panel_node = of_graph_get_remote_node(dev->of_node, 1, 0); +- if (!panel_node) { ++ np = of_graph_get_remote_node(dev->of_node, 1, 0); ++ if (!np) { + dev_dbg(dev, "panel DT node not found\n"); + return -ENXIO; + } + +- panel = of_drm_find_panel(panel_node); +- of_node_put(panel_node); ++ panel = of_drm_find_panel(np); ++ of_node_put(np); + if (IS_ERR(panel)) { + dev_dbg(dev, "panel not found, deferring probe\n"); + return PTR_ERR(panel); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0087-FROMLIST-dt-bindings-display-bridge-lvds-codec-Add-n.patch b/packages/linux/patches/amlogic/amlogic-0087-FROMLIST-dt-bindings-display-bridge-lvds-codec-Add-n.patch new file mode 100644 index 0000000000..8ddc4a6239 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0087-FROMLIST-dt-bindings-display-bridge-lvds-codec-Add-n.patch @@ -0,0 +1,53 @@ +From f7ade7485c33634f315354ec9c9fe44e9bc1a764 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Tue, 22 Oct 2019 16:15:50 +0200 +Subject: [PATCH 087/146] FROMLIST: dt-bindings: display: bridge: lvds-codec: + Add new bus-width prop + +Add the bus-width property to describe the input bus format. + +v10: +* Add changelog to the commit message +* Add Rob's R-b + +v8 -> v9: +* No changes + +v7: +* Rebase on top of lvds-codec changes +* Drop the data-mapping property + +v4 -> v6: +* Not part of the series + +v3: +* New patch + +Signed-off-by: Boris Brezillon +Reviewed-by: Rob Herring +--- + .../devicetree/bindings/display/bridge/lvds-codec.yaml | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml +index 8f373029f5d2..7c4e42f4de61 100644 +--- a/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml ++++ b/Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml +@@ -55,6 +55,14 @@ properties: + description: | + For LVDS encoders, port 0 is the parallel input + For LVDS decoders, port 0 is the LVDS input ++ properties: ++ bus-width: ++ allOf: ++ - $ref: /schemas/types.yaml#/definitions/uint32 ++ - enum: [18, 24] ++ - default: 24 ++ description: ++ Number of data lines used to transmit the RGB data. + + port@1: + type: object +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-drm-bridge-panel-Propage-bus-format-flags.patch b/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-drm-bridge-panel-Propage-bus-format-flags.patch new file mode 100644 index 0000000000..73abaecd32 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-drm-bridge-panel-Propage-bus-format-flags.patch @@ -0,0 +1,52 @@ +From cc8eb0c850087b5f24b3dddb6ffe97204639057f Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Fri, 9 Aug 2019 21:41:29 +0200 +Subject: [PATCH 088/146] FROMLIST: drm/bridge: panel: Propage bus format/flags + +So that the previous bridge element in the chain knows which input +format the panel bridge expects. + +v10: +* Add changelog to the commit message + +v8 -> v9: +* No changes + +v7: +* Set atomic state hooks explicitly + +v4 -> v6: +* Not part of the series + +v3: +* Adjust things to match the new bus-format negotiation approach +* Use drm_atomic_helper_bridge_propagate_bus_fmt +* Don't implement ->atomic_check() (the core now takes care of bus + flags propagation) + +v2: +* Adjust things to match the new bus-format negotiation approach + +Signed-off-by: Boris Brezillon +--- + drivers/gpu/drm/bridge/panel.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c +index f66777e24968..dcc72bd7df30 100644 +--- a/drivers/gpu/drm/bridge/panel.c ++++ b/drivers/gpu/drm/bridge/panel.c +@@ -127,6 +127,10 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { + .enable = panel_bridge_enable, + .disable = panel_bridge_disable, + .post_disable = panel_bridge_post_disable, ++ .atomic_reset = drm_atomic_helper_bridge_reset, ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_get_input_bus_fmts = drm_atomic_helper_bridge_propagate_bus_fmt, + }; + + /** +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-firmware-meson_sm-Mark-chip-struct-as-stati.patch b/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-firmware-meson_sm-Mark-chip-struct-as-stati.patch deleted file mode 100644 index 8ec79a2830..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-firmware-meson_sm-Mark-chip-struct-as-stati.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ac3f5c161fa615556c1bded44f91108ed01b180e Mon Sep 17 00:00:00 2001 -From: Carlo Caione -Date: Sat, 10 Aug 2019 13:40:40 +0000 -Subject: [PATCH 088/187] FROMLIST: firmware: meson_sm: Mark chip struct as - static const - -No need to be a global struct. - -Reviewed-by: Jerome Brunet -Signed-off-by: Carlo Caione ---- - drivers/firmware/meson/meson_sm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c -index 8d908a8e0d20..772ca6726e7b 100644 ---- a/drivers/firmware/meson/meson_sm.c -+++ b/drivers/firmware/meson/meson_sm.c -@@ -35,7 +35,7 @@ struct meson_sm_chip { - struct meson_sm_cmd cmd[]; - }; - --struct meson_sm_chip gxbb_chip = { -+static const struct meson_sm_chip gxbb_chip = { - .shmem_size = SZ_4K, - .cmd_shmem_in_base = 0x82000020, - .cmd_shmem_out_base = 0x82000021, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-drm-panel-simple-Fix-the-lt089ac29000-bus_f.patch b/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-drm-panel-simple-Fix-the-lt089ac29000-bus_f.patch new file mode 100644 index 0000000000..599f658537 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-drm-panel-simple-Fix-the-lt089ac29000-bus_f.patch @@ -0,0 +1,40 @@ +From ee4a3484cef1cde1f1188c30f4bd39aeb7ceff35 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Wed, 22 Jan 2020 10:32:06 +0100 +Subject: [PATCH 089/146] FROMLIST: drm/panel: simple: Fix the lt089ac29000 + bus_format + +The lt089ac29000 panel is an LVDS panel, not a DPI one. Fix the +definition to reflect this fact. + +v10: +* Add changelog to the commit message + +v8 -> v9: +* No changes + +v7: +* New patch + +Signed-off-by: Boris Brezillon +Suggested-by: Laurent Pinchart +--- + drivers/gpu/drm/panel/panel-simple.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c +index e14c14ac62b5..17d3d8791da5 100644 +--- a/drivers/gpu/drm/panel/panel-simple.c ++++ b/drivers/gpu/drm/panel/panel-simple.c +@@ -3023,7 +3023,7 @@ static const struct panel_desc toshiba_lt089ac29000 = { + .width = 194, + .height = 116, + }, +- .bus_format = MEDIA_BUS_FMT_RGB888_1X24, ++ .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA, + .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, + .connector_type = DRM_MODE_CONNECTOR_LVDS, + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-nvmem-meson-efuse-bindings-Add-secure-monit.patch b/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-nvmem-meson-efuse-bindings-Add-secure-monit.patch deleted file mode 100644 index 3c843be746..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-nvmem-meson-efuse-bindings-Add-secure-monit.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 79e7f3f261da58b3beb8704233ea27707edd2144 Mon Sep 17 00:00:00 2001 -From: Carlo Caione -Date: Sat, 10 Aug 2019 13:42:08 +0000 -Subject: [PATCH 089/187] FROMLIST: nvmem: meson-efuse: bindings: Add - secure-monitor phandle - -Add a new property to link the nvmem driver to the secure-monitor. The -nvmem driver needs to access the secure-monitor to be able to access the -fuses. - -Signed-off-by: Carlo Caione ---- - Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt b/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt -index 2e0723ab3384..f7b3ed74db54 100644 ---- a/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt -+++ b/Documentation/devicetree/bindings/nvmem/amlogic-efuse.txt -@@ -4,6 +4,7 @@ Required properties: - - compatible: should be "amlogic,meson-gxbb-efuse" - - clocks: phandle to the efuse peripheral clock provided by the - clock controller. -+- secure-monitor: phandle to the secure-monitor node - - = Data cells = - Are child nodes of eFuse, bindings of which as described in -@@ -16,6 +17,7 @@ Example: - clocks = <&clkc CLKID_EFUSE>; - #address-cells = <1>; - #size-cells = <1>; -+ secure-monitor = <&sm>; - - sn: sn@14 { - reg = <0x14 0x10>; -@@ -30,6 +32,10 @@ Example: - }; - }; - -+ sm: secure-monitor { -+ compatible = "amlogic,meson-gxbb-sm"; -+ }; -+ - = Data consumers = - Are device nodes which consume nvmem data cells. - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-ARM-dts-imx-imx51-zii-rdu1-Fix-the-display-.patch b/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-ARM-dts-imx-imx51-zii-rdu1-Fix-the-display-.patch new file mode 100644 index 0000000000..b511e5a1b0 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-ARM-dts-imx-imx51-zii-rdu1-Fix-the-display-.patch @@ -0,0 +1,64 @@ +From ee156fec2cbc7610e71566d711031e6a52432b6d Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Wed, 7 Aug 2019 18:01:59 +0200 +Subject: [PATCH 090/146] FROMLIST: ARM: dts: imx: imx51-zii-rdu1: Fix the + display pipeline definition + +The current definition does not represent the exact display pipeline we +have on the board: the LVDS panel is actually connected through a +parallel -> LVDS bridge. Let's fix that so the driver can select the +proper bus format on the CRTC end. + +Signed-off-by: Boris Brezillon +--- +v2 -> v10: +* No changes +--- + arch/arm/boot/dts/imx51-zii-rdu1.dts | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/imx51-zii-rdu1.dts b/arch/arm/boot/dts/imx51-zii-rdu1.dts +index 3596060f52e7..3fb84ea7f993 100644 +--- a/arch/arm/boot/dts/imx51-zii-rdu1.dts ++++ b/arch/arm/boot/dts/imx51-zii-rdu1.dts +@@ -95,6 +95,28 @@ + reg = <1>; + + display_out: endpoint { ++ remote-endpoint = <&lvds_encoder_in>; ++ }; ++ }; ++ }; ++ ++ lvds-encoder { ++ compatible = "lvds-encoder"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ bus-width = <24>; ++ lvds_encoder_in: endpoint { ++ remote-endpoint = <&display_out>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ data-mapping = "jeida-24"; ++ lvds_encoder_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; +@@ -110,7 +132,7 @@ + + port { + panel_in: endpoint { +- remote-endpoint = <&display_out>; ++ remote-endpoint = <&lvds_encoder_out>; + }; + }; + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-arm64-dts-meson-Link-nvmem-and-secure-monit.patch b/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-arm64-dts-meson-Link-nvmem-and-secure-monit.patch deleted file mode 100644 index 17c87925ea..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-arm64-dts-meson-Link-nvmem-and-secure-monit.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2c8dcab8cc1d7e45358ccccec79716e00f6572f7 Mon Sep 17 00:00:00 2001 -From: Carlo Caione -Date: Sat, 10 Aug 2019 13:45:41 +0000 -Subject: [PATCH 090/187] FROMLIST: arm64: dts: meson: Link nvmem and - secure-monitor nodes - -The former is going to use the latter to retrieve the efuses data. - -Signed-off-by: Carlo Caione ---- - arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 1 + - arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 + - arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi -index 12bf959c17a7..15a7b7998dd4 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi -@@ -117,6 +117,7 @@ - #address-cells = <1>; - #size-cells = <1>; - read-only; -+ secure-monitor = <&sm>; - }; - - psci { -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index 71fd725dee77..da0dc80b44cb 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -57,6 +57,7 @@ - #address-cells = <1>; - #size-cells = <1>; - read-only; -+ secure-monitor = <&sm>; - }; - - psci { -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -index e62aad5bf867..209f20bea4a1 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -161,6 +161,7 @@ - #address-cells = <1>; - #size-cells = <1>; - read-only; -+ secure-monitor = <&sm>; - - sn: sn@14 { - reg = <0x14 0x10>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-drm-bridge-dw-hdmi-set-mtmdsclock-for-deep-.patch b/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-drm-bridge-dw-hdmi-set-mtmdsclock-for-deep-.patch new file mode 100644 index 0000000000..85f8140acf --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-drm-bridge-dw-hdmi-set-mtmdsclock-for-deep-.patch @@ -0,0 +1,48 @@ +From 8a53a0031c3cc251bd9f2ef59497b7838b8f0f3b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 15 Dec 2019 17:02:24 +0000 +Subject: [PATCH 091/146] FROMLIST: drm/bridge: dw-hdmi: set mtmdsclock for + deep color + +Configure the correct mtmdsclock for deep colors to prepare support +for 10, 12 & 16bit output. + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 67fca439bbfb..9e0927d22db6 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1818,9 +1818,26 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, + + dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock); + ++ if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) { ++ switch (hdmi_bus_fmt_color_depth( ++ hdmi->hdmi_data.enc_out_bus_format)) { ++ case 16: ++ vmode->mtmdsclock = (u64)vmode->mpixelclock * 2; ++ break; ++ case 12: ++ vmode->mtmdsclock = (u64)vmode->mpixelclock * 3 / 2; ++ break; ++ case 10: ++ vmode->mtmdsclock = (u64)vmode->mpixelclock * 5 / 4; ++ break; ++ } ++ } ++ + if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) + vmode->mtmdsclock /= 2; + ++ dev_dbg(hdmi->dev, "final tmdsclk = %d\n", vmode->mtmdsclock); ++ + /* Set up HDMI_FC_INVIDCONF */ + inv_val = (hdmi->hdmi_data.hdcp_enable || + (dw_hdmi_support_scdc(hdmi) && +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-firmware-meson_sm-Rework-driver-as-a-proper.patch b/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-firmware-meson_sm-Rework-driver-as-a-proper.patch deleted file mode 100644 index 0079c1d27e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-firmware-meson_sm-Rework-driver-as-a-proper.patch +++ /dev/null @@ -1,347 +0,0 @@ -From f7e4a684e308009b1557c934cf28dc3c375f4ddd Mon Sep 17 00:00:00 2001 -From: Carlo Caione -Date: Sat, 10 Aug 2019 13:46:54 +0000 -Subject: [PATCH 091/187] FROMLIST: firmware: meson_sm: Rework driver as a - proper platform driver - -The secure monitor driver is currently a frankenstein driver which is -registered as a platform driver but its functionality goes through a -global struct accessed by the consumer drivers using exported helper -functions. - -Try to tidy up the driver moving the firmware struct into the driver -data and make the consumer drivers referencing the secure-monitor using -a new property in the DT. - -Currently only the nvmem driver is using this API so we can fix it in -the same commit. - -Reviewed-by: Jerome Brunet -Signed-off-by: Carlo Caione ---- - drivers/firmware/meson/meson_sm.c | 94 +++++++++++++++++-------- - drivers/nvmem/meson-efuse.c | 24 ++++++- - include/linux/firmware/meson/meson_sm.h | 15 ++-- - 3 files changed, 94 insertions(+), 39 deletions(-) - -diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c -index 772ca6726e7b..2e36a2aa274c 100644 ---- a/drivers/firmware/meson/meson_sm.c -+++ b/drivers/firmware/meson/meson_sm.c -@@ -54,8 +54,6 @@ struct meson_sm_firmware { - void __iomem *sm_shmem_out_base; - }; - --static struct meson_sm_firmware fw; -- - static u32 meson_sm_get_cmd(const struct meson_sm_chip *chip, - unsigned int cmd_index) - { -@@ -90,6 +88,7 @@ static void __iomem *meson_sm_map_shmem(u32 cmd_shmem, unsigned int size) - /** - * meson_sm_call - generic SMC32 call to the secure-monitor - * -+ * @fw: Pointer to secure-monitor firmware - * @cmd_index: Index of the SMC32 function ID - * @ret: Returned value - * @arg0: SMC32 Argument 0 -@@ -100,15 +99,15 @@ static void __iomem *meson_sm_map_shmem(u32 cmd_shmem, unsigned int size) - * - * Return: 0 on success, a negative value on error - */ --int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, -- u32 arg1, u32 arg2, u32 arg3, u32 arg4) -+int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index, -+ u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) - { - u32 cmd, lret; - -- if (!fw.chip) -+ if (!fw->chip) - return -ENOENT; - -- cmd = meson_sm_get_cmd(fw.chip, cmd_index); -+ cmd = meson_sm_get_cmd(fw->chip, cmd_index); - if (!cmd) - return -EINVAL; - -@@ -124,6 +123,7 @@ EXPORT_SYMBOL(meson_sm_call); - /** - * meson_sm_call_read - retrieve data from secure-monitor - * -+ * @fw: Pointer to secure-monitor firmware - * @buffer: Buffer to store the retrieved data - * @bsize: Size of the buffer - * @cmd_index: Index of the SMC32 function ID -@@ -137,22 +137,23 @@ EXPORT_SYMBOL(meson_sm_call); - * When 0 is returned there is no guarantee about the amount of - * data read and bsize bytes are copied in buffer. - */ --int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index, -- u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) -+int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer, -+ unsigned int bsize, unsigned int cmd_index, u32 arg0, -+ u32 arg1, u32 arg2, u32 arg3, u32 arg4) - { - u32 size; - int ret; - -- if (!fw.chip) -+ if (!fw->chip) - return -ENOENT; - -- if (!fw.chip->cmd_shmem_out_base) -+ if (!fw->chip->cmd_shmem_out_base) - return -EINVAL; - -- if (bsize > fw.chip->shmem_size) -+ if (bsize > fw->chip->shmem_size) - return -EINVAL; - -- if (meson_sm_call(cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0) -+ if (meson_sm_call(fw, cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0) - return -EINVAL; - - if (size > bsize) -@@ -164,7 +165,7 @@ int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index, - size = bsize; - - if (buffer) -- memcpy(buffer, fw.sm_shmem_out_base, size); -+ memcpy(buffer, fw->sm_shmem_out_base, size); - - return ret; - } -@@ -173,6 +174,7 @@ EXPORT_SYMBOL(meson_sm_call_read); - /** - * meson_sm_call_write - send data to secure-monitor - * -+ * @fw: Pointer to secure-monitor firmware - * @buffer: Buffer containing data to send - * @size: Size of the data to send - * @cmd_index: Index of the SMC32 function ID -@@ -184,23 +186,24 @@ EXPORT_SYMBOL(meson_sm_call_read); - * - * Return: size of sent data on success, a negative value on error - */ --int meson_sm_call_write(void *buffer, unsigned int size, unsigned int cmd_index, -- u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) -+int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer, -+ unsigned int size, unsigned int cmd_index, u32 arg0, -+ u32 arg1, u32 arg2, u32 arg3, u32 arg4) - { - u32 written; - -- if (!fw.chip) -+ if (!fw->chip) - return -ENOENT; - -- if (size > fw.chip->shmem_size) -+ if (size > fw->chip->shmem_size) - return -EINVAL; - -- if (!fw.chip->cmd_shmem_in_base) -+ if (!fw->chip->cmd_shmem_in_base) - return -EINVAL; - -- memcpy(fw.sm_shmem_in_base, buffer, size); -+ memcpy(fw->sm_shmem_in_base, buffer, size); - -- if (meson_sm_call(cmd_index, &written, arg0, arg1, arg2, arg3, arg4) < 0) -+ if (meson_sm_call(fw, cmd_index, &written, arg0, arg1, arg2, arg3, arg4) < 0) - return -EINVAL; - - if (!written) -@@ -210,6 +213,24 @@ int meson_sm_call_write(void *buffer, unsigned int size, unsigned int cmd_index, - } - EXPORT_SYMBOL(meson_sm_call_write); - -+/** -+ * meson_sm_get - get pointer to meson_sm_firmware structure. -+ * -+ * @sm_node: Pointer to the secure-monitor Device Tree node. -+ * -+ * Return: NULL is the secure-monitor device is not ready. -+ */ -+struct meson_sm_firmware *meson_sm_get(struct device_node *sm_node) -+{ -+ struct platform_device *pdev = of_find_device_by_node(sm_node); -+ -+ if (!pdev) -+ return NULL; -+ -+ return platform_get_drvdata(pdev); -+} -+EXPORT_SYMBOL_GPL(meson_sm_get); -+ - #define SM_CHIP_ID_LENGTH 119 - #define SM_CHIP_ID_OFFSET 4 - #define SM_CHIP_ID_SIZE 12 -@@ -217,14 +238,18 @@ EXPORT_SYMBOL(meson_sm_call_write); - static ssize_t serial_show(struct device *dev, struct device_attribute *attr, - char *buf) - { -+ struct platform_device *pdev = to_platform_device(dev); -+ struct meson_sm_firmware *fw; - uint8_t *id_buf; - int ret; - -+ fw = platform_get_drvdata(pdev); -+ - id_buf = kmalloc(SM_CHIP_ID_LENGTH, GFP_KERNEL); - if (!id_buf) - return -ENOMEM; - -- ret = meson_sm_call_read(id_buf, SM_CHIP_ID_LENGTH, SM_GET_CHIP_ID, -+ ret = meson_sm_call_read(fw, id_buf, SM_CHIP_ID_LENGTH, SM_GET_CHIP_ID, - 0, 0, 0, 0, 0); - if (ret < 0) { - kfree(id_buf); -@@ -268,25 +293,34 @@ static const struct of_device_id meson_sm_ids[] = { - - static int __init meson_sm_probe(struct platform_device *pdev) - { -+ struct device *dev = &pdev->dev; - const struct meson_sm_chip *chip; -+ struct meson_sm_firmware *fw; -+ -+ fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL); -+ if (!fw) -+ return -ENOMEM; - -- chip = of_match_device(meson_sm_ids, &pdev->dev)->data; -+ chip = of_match_device(meson_sm_ids, dev)->data; - - if (chip->cmd_shmem_in_base) { -- fw.sm_shmem_in_base = meson_sm_map_shmem(chip->cmd_shmem_in_base, -- chip->shmem_size); -- if (WARN_ON(!fw.sm_shmem_in_base)) -+ fw->sm_shmem_in_base = meson_sm_map_shmem(chip->cmd_shmem_in_base, -+ chip->shmem_size); -+ if (WARN_ON(!fw->sm_shmem_in_base)) - goto out; - } - - if (chip->cmd_shmem_out_base) { -- fw.sm_shmem_out_base = meson_sm_map_shmem(chip->cmd_shmem_out_base, -- chip->shmem_size); -- if (WARN_ON(!fw.sm_shmem_out_base)) -+ fw->sm_shmem_out_base = meson_sm_map_shmem(chip->cmd_shmem_out_base, -+ chip->shmem_size); -+ if (WARN_ON(!fw->sm_shmem_out_base)) - goto out_in_base; - } - -- fw.chip = chip; -+ fw->chip = chip; -+ -+ platform_set_drvdata(pdev, fw); -+ - pr_info("secure-monitor enabled\n"); - - if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group)) -@@ -295,7 +329,7 @@ static int __init meson_sm_probe(struct platform_device *pdev) - return 0; - - out_in_base: -- iounmap(fw.sm_shmem_in_base); -+ iounmap(fw->sm_shmem_in_base); - out: - return -EINVAL; - } -diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c -index 39bd76306033..d6b533497ce1 100644 ---- a/drivers/nvmem/meson-efuse.c -+++ b/drivers/nvmem/meson-efuse.c -@@ -17,14 +17,18 @@ - static int meson_efuse_read(void *context, unsigned int offset, - void *val, size_t bytes) - { -- return meson_sm_call_read((u8 *)val, bytes, SM_EFUSE_READ, offset, -+ struct meson_sm_firmware *fw = context; -+ -+ return meson_sm_call_read(fw, (u8 *)val, bytes, SM_EFUSE_READ, offset, - bytes, 0, 0, 0); - } - - static int meson_efuse_write(void *context, unsigned int offset, - void *val, size_t bytes) - { -- return meson_sm_call_write((u8 *)val, bytes, SM_EFUSE_WRITE, offset, -+ struct meson_sm_firmware *fw = context; -+ -+ return meson_sm_call_write(fw, (u8 *)val, bytes, SM_EFUSE_WRITE, offset, - bytes, 0, 0, 0); - } - -@@ -37,12 +41,25 @@ MODULE_DEVICE_TABLE(of, meson_efuse_match); - static int meson_efuse_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; -+ struct meson_sm_firmware *fw; -+ struct device_node *sm_np; - struct nvmem_device *nvmem; - struct nvmem_config *econfig; - struct clk *clk; - unsigned int size; - int ret; - -+ sm_np = of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0); -+ if (!sm_np) { -+ dev_err(&pdev->dev, "no secure-monitor node\n"); -+ return -ENODEV; -+ } -+ -+ fw = meson_sm_get(sm_np); -+ of_node_put(sm_np); -+ if (!fw) -+ return -EPROBE_DEFER; -+ - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); -@@ -65,7 +82,7 @@ static int meson_efuse_probe(struct platform_device *pdev) - return ret; - } - -- if (meson_sm_call(SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) { -+ if (meson_sm_call(fw, SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) { - dev_err(dev, "failed to get max user"); - return -EINVAL; - } -@@ -81,6 +98,7 @@ static int meson_efuse_probe(struct platform_device *pdev) - econfig->reg_read = meson_efuse_read; - econfig->reg_write = meson_efuse_write; - econfig->size = size; -+ econfig->priv = fw; - - nvmem = devm_nvmem_register(&pdev->dev, econfig); - -diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h -index 7613bf7c9442..6669e2a1d5fd 100644 ---- a/include/linux/firmware/meson/meson_sm.h -+++ b/include/linux/firmware/meson/meson_sm.h -@@ -16,11 +16,14 @@ enum { - - struct meson_sm_firmware; - --int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, u32 arg1, -- u32 arg2, u32 arg3, u32 arg4); --int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index, -- u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); --int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index, -- u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); -+int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index, -+ u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); -+int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer, -+ unsigned int b_size, unsigned int cmd_index, u32 arg0, -+ u32 arg1, u32 arg2, u32 arg3, u32 arg4); -+int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer, -+ unsigned int bsize, unsigned int cmd_index, u32 arg0, -+ u32 arg1, u32 arg2, u32 arg3, u32 arg4); -+struct meson_sm_firmware *meson_sm_get(struct device_node *firmware_node); - - #endif /* _MESON_SM_FW_H_ */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-arm64-dts-meson-g12a-audio-clock-controller.patch b/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-arm64-dts-meson-g12a-audio-clock-controller.patch deleted file mode 100644 index 4794239278..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-arm64-dts-meson-g12a-audio-clock-controller.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 607c7f84e6ab64990e04e299627dda08df95503c Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Tue, 20 Aug 2019 15:02:29 +0000 -Subject: [PATCH 092/187] FROMLIST: arm64: dts: meson: g12a: audio clock - controller provides resets - -The clock controller dedicated to audio clocks also provides reset lines -on the g12 SoC family - -Signed-off-by: Jerome Brunet ---- - arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index da0dc80b44cb..f90d681c28bd 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -1455,6 +1455,7 @@ - compatible = "amlogic,g12a-audio-clkc"; - reg = <0x0 0x0 0x0 0xb4>; - #clock-cells = <1>; -+ #reset-cells = <1>; - - clocks = <&clkc CLKID_AUDIO>, - <&clkc CLKID_MPLL0>, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-drm-bridge-dw-hdmi-add-max-bpc-connector-pr.patch b/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-drm-bridge-dw-hdmi-add-max-bpc-connector-pr.patch new file mode 100644 index 0000000000..25b5404e77 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-drm-bridge-dw-hdmi-add-max-bpc-connector-pr.patch @@ -0,0 +1,32 @@ +From f3c6742cb0ac7a7b97a3b5a3896207ca8d6b5d5f Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 15 Dec 2019 17:02:24 +0000 +Subject: [PATCH 092/146] FROMLIST: drm/bridge: dw-hdmi: add max bpc connector + property + +Add the max_bpc property to the dw-hdmi connector to prepare support +for 10, 12 & 16bit output support. + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 9e0927d22db6..051001f77dd4 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -2406,6 +2406,10 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) + DRM_MODE_CONNECTOR_HDMIA, + hdmi->ddc); + ++ drm_atomic_helper_connector_reset(connector); ++ ++ drm_connector_attach_max_bpc_property(connector, 8, 16); ++ + if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) + drm_object_attach_property(&connector->base, + connector->dev->mode_config.hdr_output_metadata_property, 0); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-arm64-dts-meson-g12a-add-reset-to-tdm-forma.patch b/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-arm64-dts-meson-g12a-add-reset-to-tdm-forma.patch deleted file mode 100644 index 9e4e852bff..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-arm64-dts-meson-g12a-add-reset-to-tdm-forma.patch +++ /dev/null @@ -1,85 +0,0 @@ -From fb5b730445701ceedbfa2339519bd878506b6f06 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Tue, 20 Aug 2019 15:07:17 +0000 -Subject: [PATCH 093/187] FROMLIST: arm64: dts: meson: g12a: add reset to tdm - formatters - -Add the reset to the TDM formatters of the g12a. This helps -with channel mapping when a playback/capture uses more than 1 lane. - -Signed-off-by: Jerome Brunet ---- - arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index f90d681c28bd..2fa4b43f2dad 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - #include - - / { -@@ -1564,6 +1565,7 @@ - "amlogic,axg-tdmin"; - reg = <0x0 0x300 0x0 0x40>; - sound-name-prefix = "TDMIN_A"; -+ resets = <&clkc_audio AUD_RESET_TDMIN_A>; - clocks = <&clkc_audio AUD_CLKID_TDMIN_A>, - <&clkc_audio AUD_CLKID_TDMIN_A_SCLK>, - <&clkc_audio AUD_CLKID_TDMIN_A_SCLK_SEL>, -@@ -1579,6 +1581,7 @@ - "amlogic,axg-tdmin"; - reg = <0x0 0x340 0x0 0x40>; - sound-name-prefix = "TDMIN_B"; -+ resets = <&clkc_audio AUD_RESET_TDMIN_B>; - clocks = <&clkc_audio AUD_CLKID_TDMIN_B>, - <&clkc_audio AUD_CLKID_TDMIN_B_SCLK>, - <&clkc_audio AUD_CLKID_TDMIN_B_SCLK_SEL>, -@@ -1594,6 +1597,7 @@ - "amlogic,axg-tdmin"; - reg = <0x0 0x380 0x0 0x40>; - sound-name-prefix = "TDMIN_C"; -+ resets = <&clkc_audio AUD_RESET_TDMIN_C>; - clocks = <&clkc_audio AUD_CLKID_TDMIN_C>, - <&clkc_audio AUD_CLKID_TDMIN_C_SCLK>, - <&clkc_audio AUD_CLKID_TDMIN_C_SCLK_SEL>, -@@ -1609,6 +1613,7 @@ - "amlogic,axg-tdmin"; - reg = <0x0 0x3c0 0x0 0x40>; - sound-name-prefix = "TDMIN_LB"; -+ resets = <&clkc_audio AUD_RESET_TDMIN_LB>; - clocks = <&clkc_audio AUD_CLKID_TDMIN_LB>, - <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK>, - <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK_SEL>, -@@ -1648,6 +1653,7 @@ - compatible = "amlogic,g12a-tdmout"; - reg = <0x0 0x500 0x0 0x40>; - sound-name-prefix = "TDMOUT_A"; -+ resets = <&clkc_audio AUD_RESET_TDMOUT_A>; - clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>, - <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>, - <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>, -@@ -1662,6 +1668,7 @@ - compatible = "amlogic,g12a-tdmout"; - reg = <0x0 0x540 0x0 0x40>; - sound-name-prefix = "TDMOUT_B"; -+ resets = <&clkc_audio AUD_RESET_TDMOUT_B>; - clocks = <&clkc_audio AUD_CLKID_TDMOUT_B>, - <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK>, - <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK_SEL>, -@@ -1676,6 +1683,7 @@ - compatible = "amlogic,g12a-tdmout"; - reg = <0x0 0x580 0x0 0x40>; - sound-name-prefix = "TDMOUT_C"; -+ resets = <&clkc_audio AUD_RESET_TDMOUT_C>; - clocks = <&clkc_audio AUD_CLKID_TDMOUT_C>, - <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK>, - <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK_SEL>, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-drm-bridge-dw-hdmi-Plug-atomic-state-hooks-.patch b/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-drm-bridge-dw-hdmi-Plug-atomic-state-hooks-.patch new file mode 100644 index 0000000000..473b29e0ef --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-drm-bridge-dw-hdmi-Plug-atomic-state-hooks-.patch @@ -0,0 +1,28 @@ +From a58a3dacbd0015efc05c07021be26ba902e772c2 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 22 Jan 2020 17:00:41 +0100 +Subject: [PATCH 093/146] FROMLIST: drm/bridge: dw-hdmi: Plug atomic state + hooks to the default implementation + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 051001f77dd4..fec4a4bcd1fe 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -2494,6 +2494,9 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) + } + + static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_reset = drm_atomic_helper_bridge_reset, + .attach = dw_hdmi_bridge_attach, + .detach = dw_hdmi_bridge_detach, + .enable = dw_hdmi_bridge_enable, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-ASoC-meson-axg-tdm-formatter-free-reset-on-.patch b/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-ASoC-meson-axg-tdm-formatter-free-reset-on-.patch deleted file mode 100644 index ae347be26f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-ASoC-meson-axg-tdm-formatter-free-reset-on-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b2a646f3deb28ca0f6c7cdd67c1731730ff28a55 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Tue, 20 Aug 2019 15:09:58 +0000 -Subject: [PATCH 094/187] FROMLIST: ASoC: meson: axg-tdm-formatter: free reset - on device removal - -Use the devm variant to get the formatter reset so it is properly freed -on device removal - -Fixes: 751bd5db5260 ("ASoC: meson: axg-tdm-formatter: add reset") -Signed-off-by: Jerome Brunet ---- - sound/soc/meson/axg-tdm-formatter.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c -index 2e498201139f..1a0bf9d3836d 100644 ---- a/sound/soc/meson/axg-tdm-formatter.c -+++ b/sound/soc/meson/axg-tdm-formatter.c -@@ -327,7 +327,7 @@ int axg_tdm_formatter_probe(struct platform_device *pdev) - } - - /* Formatter dedicated reset line */ -- formatter->reset = reset_control_get_optional_exclusive(dev, NULL); -+ formatter->reset = devm_reset_control_get_optional_exclusive(dev, NULL); - if (IS_ERR(formatter->reset)) { - ret = PTR_ERR(formatter->reset); - if (ret != -EPROBE_DEFER) --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-drm-bridge-synopsys-dw-hdmi-add-bus-format-.patch b/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-drm-bridge-synopsys-dw-hdmi-add-bus-format-.patch new file mode 100644 index 0000000000..c957d82855 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-drm-bridge-synopsys-dw-hdmi-add-bus-format-.patch @@ -0,0 +1,332 @@ +From bf88a7d2e98e1d6874d0206430f210c20f5a8f69 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Tue, 13 Aug 2019 15:30:25 +0200 +Subject: [PATCH 094/146] FROMLIST: drm/bridge: synopsys: dw-hdmi: add bus + format negociation + +Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negociate +the possible output and input formats for the current mode and monitor, +and use the negotiated formats in a basic atomic_check callback. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 272 +++++++++++++++++++++- + 1 file changed, 268 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index fec4a4bcd1fe..15048ad694bc 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -2095,11 +2095,10 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0; + hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; + +- /* TOFIX: Get input format from plat data or fallback to RGB888 */ + if (hdmi->plat_data->input_bus_format) + hdmi->hdmi_data.enc_in_bus_format = + hdmi->plat_data->input_bus_format; +- else ++ else if (hdmi->hdmi_data.enc_in_bus_format == MEDIA_BUS_FMT_FIXED) + hdmi->hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_RGB888_1X24; + + /* TOFIX: Get input encoding from plat data or fallback to none */ +@@ -2109,8 +2108,8 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + else + hdmi->hdmi_data.enc_in_encoding = V4L2_YCBCR_ENC_DEFAULT; + +- /* TOFIX: Default to RGB888 output format */ +- hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; ++ if (hdmi->hdmi_data.enc_out_bus_format == MEDIA_BUS_FMT_FIXED) ++ hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; + + hdmi->hdmi_data.pix_repet_factor = 0; + hdmi->hdmi_data.hdcp_enable = 0; +@@ -2388,6 +2387,267 @@ static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = + .atomic_check = dw_hdmi_connector_atomic_check, + }; + ++/* ++ * Possible output formats : ++ * - MEDIA_BUS_FMT_UYYVYY16_0_5X48, ++ * - MEDIA_BUS_FMT_UYYVYY12_0_5X36, ++ * - MEDIA_BUS_FMT_UYYVYY10_0_5X30, ++ * - MEDIA_BUS_FMT_UYYVYY8_0_5X24, ++ * - MEDIA_BUS_FMT_YUV16_1X48, ++ * - MEDIA_BUS_FMT_RGB161616_1X48, ++ * - MEDIA_BUS_FMT_UYVY12_1X24, ++ * - MEDIA_BUS_FMT_YUV12_1X36, ++ * - MEDIA_BUS_FMT_RGB121212_1X36, ++ * - MEDIA_BUS_FMT_UYVY10_1X20, ++ * - MEDIA_BUS_FMT_YUV10_1X30, ++ * - MEDIA_BUS_FMT_RGB101010_1X30, ++ * - MEDIA_BUS_FMT_UYVY8_1X16, ++ * - MEDIA_BUS_FMT_YUV8_1X24, ++ * - MEDIA_BUS_FMT_RGB888_1X24, ++ */ ++ ++/* Can return a maximum of 12 possible output formats for a mode/connector */ ++#define MAX_OUTPUT_SEL_FORMATS 12 ++ ++static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ unsigned int *num_output_fmts) ++{ ++ struct drm_connector *conn = conn_state->connector; ++ struct drm_display_info *info = &conn->display_info; ++ struct drm_display_mode *mode = &crtc_state->mode; ++ u8 max_bpc = conn_state->max_requested_bpc; ++ bool is_hdmi2_sink = info->hdmi.scdc.supported || ++ (info->color_formats & DRM_COLOR_FORMAT_YCRCB420); ++ u32 *output_fmts; ++ int i = 0; ++ ++ *num_output_fmts = 0; ++ ++ output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts), ++ GFP_KERNEL); ++ if (!output_fmts) ++ return NULL; ++ ++ /* ++ * If the current mode enforces 4:2:0, force the output but format ++ * to 4:2:0 and do not add the YUV422/444/RGB formats ++ */ ++ if (conn->ycbcr_420_allowed && ++ (drm_mode_is_420_only(info, mode) || ++ (is_hdmi2_sink && drm_mode_is_420_also(info, mode)))) { ++ ++ /* Order bus formats from 16bit to 8bit if supported */ ++ if (max_bpc >= 16 && info->bpc == 16 && ++ (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48)) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY16_0_5X48; ++ ++ if (max_bpc >= 12 && info->bpc >= 12 && ++ (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_36)) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY12_0_5X36; ++ ++ if (max_bpc >= 10 && info->bpc >= 10 && ++ (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_30)) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY10_0_5X30; ++ ++ /* Default 8bit fallback */ ++ output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY8_0_5X24; ++ ++ *num_output_fmts = i; ++ ++ return output_fmts; ++ } ++ ++ /* ++ * Order bus formats from 16bit to 8bit and from YUV422 to RGB ++ * if supported. In any case the default RGB888 format is added ++ */ ++ ++ if (max_bpc >= 16 && info->bpc == 16) { ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; ++ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ } ++ ++ if (max_bpc >= 12 && info->bpc >= 12) { ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ } ++ ++ if (max_bpc >= 10 && info->bpc >= 10) { ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ } ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ ++ /* Default 8bit RGB fallback */ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ ++ *num_output_fmts = i; ++ ++ return output_fmts; ++} ++ ++/* ++ * Possible input formats : ++ * - MEDIA_BUS_FMT_RGB888_1X24 ++ * - MEDIA_BUS_FMT_YUV8_1X24 ++ * - MEDIA_BUS_FMT_UYVY8_1X16 ++ * - MEDIA_BUS_FMT_UYYVYY8_0_5X24 ++ * - MEDIA_BUS_FMT_RGB101010_1X30 ++ * - MEDIA_BUS_FMT_YUV10_1X30 ++ * - MEDIA_BUS_FMT_UYVY10_1X20 ++ * - MEDIA_BUS_FMT_UYYVYY10_0_5X30 ++ * - MEDIA_BUS_FMT_RGB121212_1X36 ++ * - MEDIA_BUS_FMT_YUV12_1X36 ++ * - MEDIA_BUS_FMT_UYVY12_1X24 ++ * - MEDIA_BUS_FMT_UYYVYY12_0_5X36 ++ * - MEDIA_BUS_FMT_RGB161616_1X48 ++ * - MEDIA_BUS_FMT_YUV16_1X48 ++ * - MEDIA_BUS_FMT_UYYVYY16_0_5X48 ++ */ ++ ++/* Can return a maximum of 4 possible input formats for an output format */ ++#define MAX_INPUT_SEL_FORMATS 4 ++ ++static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ u32 *input_fmts; ++ int i = 0; ++ ++ *num_input_fmts = 0; ++ ++ input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), ++ GFP_KERNEL); ++ if (!input_fmts) ++ return NULL; ++ ++ switch (output_fmt) { ++ /* 8bit */ ++ case MEDIA_BUS_FMT_RGB888_1X24: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ break; ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ break; ++ case MEDIA_BUS_FMT_UYVY8_1X16: ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ break; ++ ++ /* 10bit */ ++ case MEDIA_BUS_FMT_RGB101010_1X30: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ break; ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ break; ++ case MEDIA_BUS_FMT_UYVY10_1X20: ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ break; ++ ++ /* 12bit */ ++ case MEDIA_BUS_FMT_RGB121212_1X36: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ break; ++ case MEDIA_BUS_FMT_YUV12_1X36: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ break; ++ case MEDIA_BUS_FMT_UYVY12_1X24: ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ break; ++ ++ /* 16bit */ ++ case MEDIA_BUS_FMT_RGB161616_1X48: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; ++ break; ++ case MEDIA_BUS_FMT_YUV16_1X48: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ break; ++ ++ /* 420 */ ++ case MEDIA_BUS_FMT_UYYVYY8_0_5X24: ++ case MEDIA_BUS_FMT_UYYVYY10_0_5X30: ++ case MEDIA_BUS_FMT_UYYVYY12_0_5X36: ++ case MEDIA_BUS_FMT_UYYVYY16_0_5X48: ++ input_fmts[i++] = output_fmt; ++ break; ++ } ++ ++ *num_input_fmts = i; ++ ++ if (*num_input_fmts == 0) { ++ kfree(input_fmts); ++ input_fmts = NULL; ++ } ++ ++ return input_fmts; ++} ++ ++static int dw_hdmi_bridge_atomic_check(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct dw_hdmi *hdmi = bridge->driver_private; ++ ++ dev_dbg(hdmi->dev, "selected output format %x\n", ++ bridge_state->output_bus_cfg.format); ++ ++ hdmi->hdmi_data.enc_out_bus_format = ++ bridge_state->output_bus_cfg.format; ++ ++ dev_dbg(hdmi->dev, "selected input format %x\n", ++ bridge_state->input_bus_cfg.format); ++ ++ hdmi->hdmi_data.enc_in_bus_format = ++ bridge_state->input_bus_cfg.format; ++ ++ return 0; ++} ++ + static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) + { + struct dw_hdmi *hdmi = bridge->driver_private; +@@ -2499,6 +2759,9 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { + .atomic_reset = drm_atomic_helper_bridge_reset, + .attach = dw_hdmi_bridge_attach, + .detach = dw_hdmi_bridge_detach, ++ .atomic_check = dw_hdmi_bridge_atomic_check, ++ .atomic_get_output_bus_fmts = dw_hdmi_bridge_atomic_get_output_bus_fmts, ++ .atomic_get_input_bus_fmts = dw_hdmi_bridge_atomic_get_input_bus_fmts, + .enable = dw_hdmi_bridge_enable, + .disable = dw_hdmi_bridge_disable, + .mode_set = dw_hdmi_bridge_mode_set, +@@ -2963,6 +3226,7 @@ __dw_hdmi_probe(struct platform_device *pdev, + + hdmi->bridge.driver_private = hdmi; + hdmi->bridge.funcs = &dw_hdmi_bridge_funcs; ++ + #ifdef CONFIG_OF + hdmi->bridge.of_node = pdev->dev.of_node; + #endif +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-ASoC-meson-g12a-tohdmitx-require-regmap-mmi.patch b/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-ASoC-meson-g12a-tohdmitx-require-regmap-mmi.patch deleted file mode 100644 index fa7f486224..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-ASoC-meson-g12a-tohdmitx-require-regmap-mmi.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 768f2f832dd06d875eed640994d1badf3db8863a Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Tue, 20 Aug 2019 15:12:11 +0000 -Subject: [PATCH 095/187] FROMLIST: ASoC: meson: g12a-tohdmitx: require regmap - mmio - -The tohdmitx glue uses regmap MMIO so it should require it. - -Fixes: c8609f3870f7 ("ASoC: meson: add g12a tohdmitx control") -Signed-off-by: Jerome Brunet ---- - sound/soc/meson/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig -index 63b38c123103..2e3676147cea 100644 ---- a/sound/soc/meson/Kconfig -+++ b/sound/soc/meson/Kconfig -@@ -87,6 +87,7 @@ config SND_MESON_AXG_PDM - - config SND_MESON_G12A_TOHDMITX - tristate "Amlogic G12A To HDMI TX Control Support" -+ select REGMAP_MMIO - imply SND_SOC_HDMI_CODEC - help - Select Y or M to add support for HDMI audio on the g12a SoC --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch b/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch new file mode 100644 index 0000000000..c732bfc7b7 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch @@ -0,0 +1,49 @@ +From 40136cc8c157433e269734d8ae45c77dbddb8272 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 14 Nov 2018 17:39:46 +0100 +Subject: [PATCH 095/146] FROMLIST: drm/bridge: synopsys: dw-hdmi: allow + ycbcr420 modes for >= 0x200a + +Now the DW-HDMI Controller supports the HDMI2.0 modes, enable support +for these modes in the connector if the platform supports them. +We limit these modes to DW-HDMI IP version >= 0x200a which +are designed to support HDMI2.0 display modes. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++ + include/drm/bridge/dw_hdmi.h | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 15048ad694bc..4b35ea1427df 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -3231,6 +3231,12 @@ __dw_hdmi_probe(struct platform_device *pdev, + hdmi->bridge.of_node = pdev->dev.of_node; + #endif + ++ if (hdmi->version >= 0x200a) ++ hdmi->connector.ycbcr_420_allowed = ++ hdmi->plat_data->ycbcr_420_allowed; ++ else ++ hdmi->connector.ycbcr_420_allowed = false; ++ + memset(&pdevinfo, 0, sizeof(pdevinfo)); + pdevinfo.parent = dev; + pdevinfo.id = PLATFORM_DEVID_AUTO; +diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h +index 9d4d5cc47969..0b34a12c4a1c 100644 +--- a/include/drm/bridge/dw_hdmi.h ++++ b/include/drm/bridge/dw_hdmi.h +@@ -129,6 +129,7 @@ struct dw_hdmi_plat_data { + unsigned long input_bus_format; + unsigned long input_bus_encoding; + bool use_drm_infoframe; ++ bool ycbcr_420_allowed; + + /* Vendor PHY support */ + const struct dw_hdmi_phy_ops *phy_ops; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-vclk-use-the-correct-G12A-frac-ma.patch b/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-vclk-use-the-correct-G12A-frac-ma.patch deleted file mode 100644 index e9bd32030e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-vclk-use-the-correct-G12A-frac-ma.patch +++ /dev/null @@ -1,47 +0,0 @@ -From b6870bad47afa43c86b9fb81251b32d692251fe0 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Wed, 28 Aug 2019 13:29:48 +0000 -Subject: [PATCH 096/187] FROMLIST: drm/meson: vclk: use the correct G12A frac - max value - -When calculating the HDMI PLL settings for a DMT mode PHY frequency, -use the correct max fractional PLL value for G12A VPU. - -With this fix, we can finally setup the 1024x768-60 mode. - -Fixes: 202b9808f8ed ("drm/meson: Add G12A Video Clock setup") -Signed-off-by: Neil Armstrong ---- -Fixed typo in commit log, 1024x76 => 1024x768 ---- - drivers/gpu/drm/meson/meson_vclk.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c -index be6e152fc75a..08c4f82c820d 100644 ---- a/drivers/gpu/drm/meson/meson_vclk.c -+++ b/drivers/gpu/drm/meson/meson_vclk.c -@@ -637,13 +637,18 @@ static bool meson_hdmi_pll_validate_params(struct meson_drm *priv, - if (frac >= HDMI_FRAC_MAX_GXBB) - return false; - } else if (meson_vpu_is_compatible(priv, "amlogic,meson-gxm-vpu") || -- meson_vpu_is_compatible(priv, "amlogic,meson-gxl-vpu") || -- meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) { -+ meson_vpu_is_compatible(priv, "amlogic,meson-gxl-vpu")) { - /* Empiric supported min/max dividers */ - if (m < 106 || m > 247) - return false; - if (frac >= HDMI_FRAC_MAX_GXL) - return false; -+ } else if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) { -+ /* Empiric supported min/max dividers */ -+ if (m < 106 || m > 247) -+ return false; -+ if (frac >= HDMI_FRAC_MAX_G12A) -+ return false; - } - - return true; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-venc-make-drm_display_mode-const.patch b/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-venc-make-drm_display_mode-const.patch new file mode 100644 index 0000000000..7c24e381b7 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-venc-make-drm_display_mode-const.patch @@ -0,0 +1,44 @@ +From 54b70a1b18ffd3cbc66023fbf4d240e702e9f689 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Tue, 13 Aug 2019 15:52:26 +0200 +Subject: [PATCH 096/146] FROMLIST: drm/meson: venc: make drm_display_mode + const + +Before switching to bridge funcs, make sure drm_display_mode is passed +as const to the venc functions. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_venc.c | 2 +- + drivers/gpu/drm/meson/meson_venc.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index 4efd7864d5bf..a9ab78970bfe 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -946,7 +946,7 @@ bool meson_venc_hdmi_venc_repeat(int vic) + EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat); + + void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, +- struct drm_display_mode *mode) ++ const struct drm_display_mode *mode) + { + union meson_hdmi_venc_mode *vmode = NULL; + union meson_hdmi_venc_mode vmode_dmt; +diff --git a/drivers/gpu/drm/meson/meson_venc.h b/drivers/gpu/drm/meson/meson_venc.h +index 576768bdd08d..1abdcbdf51c0 100644 +--- a/drivers/gpu/drm/meson/meson_venc.h ++++ b/drivers/gpu/drm/meson/meson_venc.h +@@ -60,7 +60,7 @@ extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc; + void meson_venci_cvbs_mode_set(struct meson_drm *priv, + struct meson_cvbs_enci_mode *mode); + void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, +- struct drm_display_mode *mode); ++ const struct drm_display_mode *mode); + unsigned int meson_venci_get_field(struct meson_drm *priv); + + void meson_venc_enable_vsync(struct meson_drm *priv); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0097-FROMLIST-drm-meson-meson_dw_hdmi-add-bridge-and-swit.patch b/packages/linux/patches/amlogic/amlogic-0097-FROMLIST-drm-meson-meson_dw_hdmi-add-bridge-and-swit.patch new file mode 100644 index 0000000000..cbb2de1bf5 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0097-FROMLIST-drm-meson-meson_dw_hdmi-add-bridge-and-swit.patch @@ -0,0 +1,230 @@ +From fbf27a4e5d8aa254ec9c17a2556276cc4f1d519b Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Tue, 13 Aug 2019 15:30:25 +0200 +Subject: [PATCH 097/146] FROMLIST: drm/meson: meson_dw_hdmi: add bridge and + switch to drm_bridge_funcs + +Switch the dw-hdmi driver to drm_bridge_funcs by implementing a new local +bridge, connecting it to the dw-hdmi bridge, then implement the +atomic_get_input_bus_fmts/atomic_get_output_bus_fmts. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_dw_hdmi.c | 105 +++++++++++++++++++++----- + 1 file changed, 85 insertions(+), 20 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c +index 3bb7ffe5fc39..4b3809626f7e 100644 +--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c +@@ -16,6 +16,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -135,6 +136,7 @@ struct meson_dw_hdmi_data { + + struct meson_dw_hdmi { + struct drm_encoder encoder; ++ struct drm_bridge bridge; + struct dw_hdmi_plat_data dw_plat_data; + struct meson_drm *priv; + struct device *dev; +@@ -151,6 +153,8 @@ struct meson_dw_hdmi { + }; + #define encoder_to_meson_dw_hdmi(x) \ + container_of(x, struct meson_dw_hdmi, encoder) ++#define bridge_to_meson_dw_hdmi(x) \ ++ container_of(x, struct meson_dw_hdmi, bridge) + + static inline int dw_hdmi_is_compatible(struct meson_dw_hdmi *dw_hdmi, + const char *compat) +@@ -368,7 +372,7 @@ static inline void meson_dw_hdmi_phy_reset(struct meson_dw_hdmi *dw_hdmi) + } + + static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, +- struct drm_display_mode *mode) ++ const struct drm_display_mode *mode) + { + struct meson_drm *priv = dw_hdmi->priv; + int vic = drm_match_cea_mode(mode); +@@ -663,6 +667,10 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + + /* Encoder */ + ++static const u32 meson_dw_hdmi_out_bus_fmts[] = { ++ MEDIA_BUS_FMT_YUV8_1X24, ++}; ++ + static void meson_venc_hdmi_encoder_destroy(struct drm_encoder *encoder) + { + drm_encoder_cleanup(encoder); +@@ -672,16 +680,63 @@ static const struct drm_encoder_funcs meson_venc_hdmi_encoder_funcs = { + .destroy = meson_venc_hdmi_encoder_destroy, + }; + +-static int meson_venc_hdmi_encoder_atomic_check(struct drm_encoder *encoder, ++static u32 * ++meson_venc_hdmi_encoder_get_out_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ unsigned int *num_output_fmts) ++{ ++ u32 *output_fmts; ++ ++ *num_output_fmts = ARRAY_SIZE(meson_dw_hdmi_out_bus_fmts); ++ output_fmts = kcalloc(*num_output_fmts, sizeof(*output_fmts), ++ GFP_KERNEL); ++ if (!output_fmts) ++ return NULL; ++ ++ memcpy(output_fmts, meson_dw_hdmi_out_bus_fmts, *num_output_fmts); ++ ++ return output_fmts; ++} ++ ++static u32 * ++meson_venc_hdmi_encoder_get_inp_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ u32 *input_fmts = NULL; ++ ++ if (output_fmt == meson_dw_hdmi_out_bus_fmts[0]) { ++ *num_input_fmts = 1; ++ input_fmts = kcalloc(*num_input_fmts, ++ sizeof(*input_fmts), ++ GFP_KERNEL); ++ if (!input_fmts) ++ return NULL; ++ ++ input_fmts[0] = output_fmt; ++ } else { ++ *num_input_fmts = 0; ++ } ++ ++ return input_fmts; ++} ++ ++static int meson_venc_hdmi_encoder_atomic_check(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) + { + return 0; + } + +-static void meson_venc_hdmi_encoder_disable(struct drm_encoder *encoder) ++static void meson_venc_hdmi_encoder_disable(struct drm_bridge *bridge) + { +- struct meson_dw_hdmi *dw_hdmi = encoder_to_meson_dw_hdmi(encoder); ++ struct meson_dw_hdmi *dw_hdmi = bridge_to_meson_dw_hdmi(bridge); + struct meson_drm *priv = dw_hdmi->priv; + + DRM_DEBUG_DRIVER("\n"); +@@ -693,9 +748,9 @@ static void meson_venc_hdmi_encoder_disable(struct drm_encoder *encoder) + writel_relaxed(0, priv->io_base + _REG(ENCP_VIDEO_EN)); + } + +-static void meson_venc_hdmi_encoder_enable(struct drm_encoder *encoder) ++static void meson_venc_hdmi_encoder_enable(struct drm_bridge *bridge) + { +- struct meson_dw_hdmi *dw_hdmi = encoder_to_meson_dw_hdmi(encoder); ++ struct meson_dw_hdmi *dw_hdmi = bridge_to_meson_dw_hdmi(bridge); + struct meson_drm *priv = dw_hdmi->priv; + + DRM_DEBUG_DRIVER("%s\n", priv->venc.hdmi_use_enci ? "VENCI" : "VENCP"); +@@ -706,11 +761,11 @@ static void meson_venc_hdmi_encoder_enable(struct drm_encoder *encoder) + writel_relaxed(1, priv->io_base + _REG(ENCP_VIDEO_EN)); + } + +-static void meson_venc_hdmi_encoder_mode_set(struct drm_encoder *encoder, +- struct drm_display_mode *mode, +- struct drm_display_mode *adjusted_mode) ++static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge, ++ const struct drm_display_mode *mode, ++ const struct drm_display_mode *adjusted_mode) + { +- struct meson_dw_hdmi *dw_hdmi = encoder_to_meson_dw_hdmi(encoder); ++ struct meson_dw_hdmi *dw_hdmi = bridge_to_meson_dw_hdmi(bridge); + struct meson_drm *priv = dw_hdmi->priv; + int vic = drm_match_cea_mode(mode); + +@@ -726,12 +781,16 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_encoder *encoder, + writel_relaxed(0, priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); + } + +-static const struct drm_encoder_helper_funcs +- meson_venc_hdmi_encoder_helper_funcs = { +- .atomic_check = meson_venc_hdmi_encoder_atomic_check, +- .disable = meson_venc_hdmi_encoder_disable, +- .enable = meson_venc_hdmi_encoder_enable, +- .mode_set = meson_venc_hdmi_encoder_mode_set, ++static const struct drm_bridge_funcs meson_venc_hdmi_encoder_bridge_funcs = { ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_get_output_bus_fmts = meson_venc_hdmi_encoder_get_out_bus_fmts, ++ .atomic_get_input_bus_fmts = meson_venc_hdmi_encoder_get_inp_bus_fmts, ++ .atomic_reset = drm_atomic_helper_bridge_reset, ++ .atomic_check = meson_venc_hdmi_encoder_atomic_check, ++ .enable = meson_venc_hdmi_encoder_enable, ++ .disable = meson_venc_hdmi_encoder_disable, ++ .mode_set = meson_venc_hdmi_encoder_mode_set, + }; + + /* DW HDMI Regmap */ +@@ -852,6 +911,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, + struct drm_device *drm = data; + struct meson_drm *priv = drm->dev_private; + struct dw_hdmi_plat_data *dw_plat_data; ++ struct drm_bridge *next_bridge; + struct drm_encoder *encoder; + struct resource *res; + int irq; +@@ -953,8 +1013,6 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, + + /* Encoder */ + +- drm_encoder_helper_add(encoder, &meson_venc_hdmi_encoder_helper_funcs); +- + ret = drm_encoder_init(drm, encoder, &meson_venc_hdmi_encoder_funcs, + DRM_MODE_ENCODER_TMDS, "meson_hdmi"); + if (ret) { +@@ -962,6 +1020,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, + return ret; + } + ++ meson_dw_hdmi->bridge.funcs = &meson_venc_hdmi_encoder_bridge_funcs; ++ drm_bridge_attach(encoder, &meson_dw_hdmi->bridge, NULL); ++ + encoder->possible_crtcs = BIT(0); + + DRM_DEBUG_DRIVER("encoder initialized\n"); +@@ -984,11 +1045,15 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, + + platform_set_drvdata(pdev, meson_dw_hdmi); + +- meson_dw_hdmi->hdmi = dw_hdmi_bind(pdev, encoder, +- &meson_dw_hdmi->dw_plat_data); ++ meson_dw_hdmi->hdmi = dw_hdmi_probe(pdev, ++ &meson_dw_hdmi->dw_plat_data); + if (IS_ERR(meson_dw_hdmi->hdmi)) + return PTR_ERR(meson_dw_hdmi->hdmi); + ++ next_bridge = of_drm_find_bridge(pdev->dev.of_node); ++ if (next_bridge) ++ drm_bridge_attach(encoder, next_bridge, &meson_dw_hdmi->bridge); ++ + DRM_DEBUG_DRIVER("HDMI controller initialized\n"); + + return 0; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0097-TEMP-drm-panfrost-add-support-for-custom-soft-reset-.patch b/packages/linux/patches/amlogic/amlogic-0097-TEMP-drm-panfrost-add-support-for-custom-soft-reset-.patch deleted file mode 100644 index 433de4b38d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0097-TEMP-drm-panfrost-add-support-for-custom-soft-reset-.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 963ed4a7a3c4da22255ede5dadac9ccad120f409 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Thu, 14 Mar 2019 09:37:38 +0100 -Subject: [PATCH 097/187] TEMP: drm/panfrost: add support for custom soft-reset - on Amlogic GXM - -(cherry picked from commit 2e5230c1bf9cf01f035da72291cc460cb3b37096) ---- - drivers/gpu/drm/panfrost/panfrost_gpu.c | 13 ++++++++++++- - drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ - 2 files changed, 16 insertions(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c -index 20ab333fc925..2e1c6955efac 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_gpu.c -+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c -@@ -7,7 +7,9 @@ - #include - #include - #include -+#include - #include -+#include - #include - #include - -@@ -59,7 +61,16 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) - - gpu_write(pfdev, GPU_INT_MASK, 0); - gpu_write(pfdev, GPU_INT_CLEAR, GPU_IRQ_RESET_COMPLETED); -- gpu_write(pfdev, GPU_CMD, GPU_CMD_SOFT_RESET); -+ -+ if (of_device_is_compatible(pfdev->dev->of_node, "amlogic,meson-gxm-mali")) { -+ reset_control_assert(pfdev->rstc); -+ udelay(10); -+ reset_control_deassert(pfdev->rstc); -+ -+ gpu_write(pfdev, GPU_PWR_KEY, 0x2968A819); -+ gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16)); -+ } else -+ gpu_write(pfdev, GPU_CMD, GPU_CMD_SOFT_RESET); - - ret = readl_relaxed_poll_timeout(pfdev->iomem + GPU_INT_RAWSTAT, - val, val & GPU_IRQ_RESET_COMPLETED, 100, 10000); -diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h -index ea38ac60581c..7a0cfa629760 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_regs.h -+++ b/drivers/gpu/drm/panfrost/panfrost_regs.h -@@ -69,6 +69,10 @@ - #define GPU_PRFCNT_TILER_EN 0x74 - #define GPU_PRFCNT_MMU_L2_EN 0x7c - -+#define GPU_PWR_KEY 0x050 /* (WO) Power manager key register */ -+#define GPU_PWR_OVERRIDE0 0x054 /* (RW) Power manager override settings */ -+#define GPU_PWR_OVERRIDE1 0x058 /* (RW) Power manager override settings */ -+ - #define GPU_THREAD_MAX_THREADS 0x0A0 /* (RO) Maximum number of threads per core */ - #define GPU_THREAD_MAX_WORKGROUP_SIZE 0x0A4 /* (RO) Maximum workgroup size */ - #define GPU_THREAD_MAX_BARRIER_SIZE 0x0A8 /* (RO) Maximum threads waiting at a barrier */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0098-FROMLIST-drm-meson-dw-hdmi-stop-enforcing-input_bus_.patch b/packages/linux/patches/amlogic/amlogic-0098-FROMLIST-drm-meson-dw-hdmi-stop-enforcing-input_bus_.patch new file mode 100644 index 0000000000..78569acf07 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0098-FROMLIST-drm-meson-dw-hdmi-stop-enforcing-input_bus_.patch @@ -0,0 +1,30 @@ +From fbffdc84fa2b464b209a6944e0ab32c8bb496ae7 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Tue, 13 Aug 2019 16:21:27 +0200 +Subject: [PATCH 098/146] FROMLIST: drm/meson: dw-hdmi: stop enforcing + input_bus_format + +To allow using formats from negotiation, stop enforcing input_bus_format +in the private dw-plat-data struct. + +Signed-off-by: Neil Armstrong +Reviewed-by: Boris Brezillon +--- + drivers/gpu/drm/meson/meson_dw_hdmi.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c +index 4b3809626f7e..686c47106a18 100644 +--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c +@@ -1035,7 +1035,6 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, + dw_plat_data->phy_ops = &meson_dw_hdmi_phy_ops; + dw_plat_data->phy_name = "meson_dw_hdmi_phy"; + dw_plat_data->phy_data = meson_dw_hdmi; +- dw_plat_data->input_bus_format = MEDIA_BUS_FMT_YUV8_1X24; + dw_plat_data->input_bus_encoding = V4L2_YCBCR_ENC_709; + + if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") || +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0098-TEMP-drm-panfrost-kernel-driver-fix-1-2.patch b/packages/linux/patches/amlogic/amlogic-0098-TEMP-drm-panfrost-kernel-driver-fix-1-2.patch deleted file mode 100644 index 84d815718b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0098-TEMP-drm-panfrost-kernel-driver-fix-1-2.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d5bbe01b7a7afa208bb6ef39659b31b94a5d2ed9 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Fri, 12 Jul 2019 21:20:38 +0000 -Subject: [PATCH 098/187] TEMP: drm/panfrost: kernel driver fix 1/2 - -https://lkml.org/lkml/2019/5/29/786 - -Signed-off-by: Christian Hewitt ---- - drivers/iommu/io-pgtable-arm.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c -index 161a7d56264d..c1048e741c66 100644 ---- a/drivers/iommu/io-pgtable-arm.c -+++ b/drivers/iommu/io-pgtable-arm.c -@@ -1022,7 +1022,9 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) - iop = arm_64_lpae_alloc_pgtable_s1(cfg, cookie); - if (iop) { - u64 mair, ttbr; -+ struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(&iop->ops); - -+ data->levels = 4; - /* Copy values as union fields overlap */ - mair = cfg->arm_lpae_s1_cfg.mair[0]; - ttbr = cfg->arm_lpae_s1_cfg.ttbr[0]; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0099-FROMLIST-drm-meson-venc-add-support-for-YUV420-setup.patch b/packages/linux/patches/amlogic/amlogic-0099-FROMLIST-drm-meson-venc-add-support-for-YUV420-setup.patch new file mode 100644 index 0000000000..4cf0797ed0 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0099-FROMLIST-drm-meson-venc-add-support-for-YUV420-setup.patch @@ -0,0 +1,85 @@ +From 1473862349ce78372db09e20c9154654ff1196f9 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 14 Aug 2019 10:48:21 +0200 +Subject: [PATCH 099/146] FROMLIST: drm/meson: venc: add support for YUV420 + setup + +This patch adds encoding support for the YUV420 output from the +Amlogic Meson SoCs Video Processing Unit to the HDMI Controller. + +The YUV420 is obtained by generating a YUV444 pixel stream like +the classic HDMI display modes, but then the Video Encoder output +can be configured to down-sample the YUV444 pixel stream to a YUV420 +stream. + +In addition if pixel stream down-sampling, the Y Cb Cr components must +also be mapped differently to align with the HDMI2.0 specifications. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++- + drivers/gpu/drm/meson/meson_venc.c | 8 +++++--- + drivers/gpu/drm/meson/meson_venc.h | 2 ++ + 3 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c +index 686c47106a18..f5d46d082534 100644 +--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c +@@ -772,7 +772,8 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge, + DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic); + + /* VENC + VENC-DVI Mode setup */ +- meson_venc_hdmi_mode_set(priv, vic, mode); ++ meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, false, ++ VPU_HDMI_OUTPUT_CBYCR); + + /* VCLK Set clock */ + dw_hdmi_set_vclk(dw_hdmi, mode); +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index a9ab78970bfe..f93c725b6f02 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -946,6 +946,8 @@ bool meson_venc_hdmi_venc_repeat(int vic) + EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat); + + void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, ++ unsigned int ycrcb_map, ++ bool yuv420_mode, + const struct drm_display_mode *mode) + { + union meson_hdmi_venc_mode *vmode = NULL; +@@ -1528,14 +1530,14 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + if (mode->flags & DRM_MODE_FLAG_PVSYNC) + reg |= VPU_HDMI_INV_VSYNC; + +- /* Output data format: CbYCr */ +- reg |= VPU_HDMI_OUTPUT_CBYCR; ++ /* Output data format */ ++ reg |= ycrcb_map; + + /* + * Write rate to the async FIFO between VENC and HDMI. + * One write every 2 wr_clk. + */ +- if (venc_repeat) ++ if (venc_repeat || yuv420_mode) + reg |= VPU_HDMI_WR_RATE(2); + + /* +diff --git a/drivers/gpu/drm/meson/meson_venc.h b/drivers/gpu/drm/meson/meson_venc.h +index 1abdcbdf51c0..9138255ffc9e 100644 +--- a/drivers/gpu/drm/meson/meson_venc.h ++++ b/drivers/gpu/drm/meson/meson_venc.h +@@ -60,6 +60,8 @@ extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc; + void meson_venci_cvbs_mode_set(struct meson_drm *priv, + struct meson_cvbs_enci_mode *mode); + void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, ++ unsigned int ycrcb_map, ++ bool yuv420_mode, + const struct drm_display_mode *mode); + unsigned int meson_venci_get_field(struct meson_drm *priv); + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0099-TEMP-drm-panfrost-kernel-driver-fix-2-2.patch b/packages/linux/patches/amlogic/amlogic-0099-TEMP-drm-panfrost-kernel-driver-fix-2-2.patch deleted file mode 100644 index d89e27bf82..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0099-TEMP-drm-panfrost-kernel-driver-fix-2-2.patch +++ /dev/null @@ -1,28 +0,0 @@ -From cbe199dc1f6006cbfefe9e3197c79a638abd01a1 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Fri, 12 Jul 2019 21:36:32 +0000 -Subject: [PATCH 099/187] TEMP: drm/panfrost: kernel driver fix 2/2 - -https://patchwork.kernel.org/patch/10954241/ - -Signed-off-by: Christian Hewitt ---- - drivers/iommu/io-pgtable-arm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c -index c1048e741c66..a69b9b5d0f0f 100644 ---- a/drivers/iommu/io-pgtable-arm.c -+++ b/drivers/iommu/io-pgtable-arm.c -@@ -1015,7 +1015,7 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) - { - struct io_pgtable *iop; - -- if (cfg->ias != 48 || cfg->oas > 40) -+ if (cfg->ias > 48 || cfg->oas > 40) - return NULL; - - cfg->pgsize_bitmap &= (SZ_4K | SZ_2M | SZ_1G); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0100-FROMLIST-drm-meson-vclk-add-support-for-YUV420-setup.patch b/packages/linux/patches/amlogic/amlogic-0100-FROMLIST-drm-meson-vclk-add-support-for-YUV420-setup.patch new file mode 100644 index 0000000000..a4f54bdcbf --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0100-FROMLIST-drm-meson-vclk-add-support-for-YUV420-setup.patch @@ -0,0 +1,363 @@ +From 355bab871c74d2c2b3cf233292506cf3cf8fcfac Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 14 Aug 2019 10:52:52 +0200 +Subject: [PATCH 100/146] FROMLIST: drm/meson: vclk: add support for YUV420 + setup + +This patch adds clocking support for the YUV420 output from the +Amlogic Meson SoCs Video Processing Unit to the HDMI Controller. + +The YUV420 is obtained by generating a YUV444 pixel stream like +the classic HDMI display modes, but then the Video Encoder output +can be configured to down-sample the YUV444 pixel stream to a YUV420 +stream. + +This mode needs a different clock generation scheme since the TMDS PHY +clock must match the 10x ratio with the YUV420 pixel clock, but +the video encoder must run at 2x the pixel clock. + +This patch adds the TMDS PHY clock value in all the video clock setup +in order to better support these specific uses cases and switch +to the Common Clock framework for clocks handling in the future. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_dw_hdmi.c | 24 ++++--- + drivers/gpu/drm/meson/meson_vclk.c | 93 +++++++++++++++++++------ + drivers/gpu/drm/meson/meson_vclk.h | 7 +- + drivers/gpu/drm/meson/meson_venc_cvbs.c | 6 +- + 4 files changed, 95 insertions(+), 35 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c +index f5d46d082534..94f206bf795d 100644 +--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c +@@ -376,15 +376,19 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, + { + struct meson_drm *priv = dw_hdmi->priv; + int vic = drm_match_cea_mode(mode); ++ unsigned int phy_freq; + unsigned int vclk_freq; + unsigned int venc_freq; + unsigned int hdmi_freq; + + vclk_freq = mode->clock; + ++ /* TMDS clock is pixel_clock * 10 */ ++ phy_freq = vclk_freq * 10; ++ + if (!vic) { +- meson_vclk_setup(priv, MESON_VCLK_TARGET_DMT, vclk_freq, +- vclk_freq, vclk_freq, false); ++ meson_vclk_setup(priv, MESON_VCLK_TARGET_DMT, phy_freq, ++ vclk_freq, vclk_freq, vclk_freq, false); + return; + } + +@@ -402,11 +406,11 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + venc_freq /= 2; + +- DRM_DEBUG_DRIVER("vclk:%d venc=%d hdmi=%d enci=%d\n", +- vclk_freq, venc_freq, hdmi_freq, ++ DRM_DEBUG_DRIVER("vclk:%d phy=%d venc=%d hdmi=%d enci=%d\n", ++ phy_freq, vclk_freq, venc_freq, hdmi_freq, + priv->venc.hdmi_use_enci); + +- meson_vclk_setup(priv, MESON_VCLK_TARGET_HDMI, vclk_freq, ++ meson_vclk_setup(priv, MESON_VCLK_TARGET_HDMI, phy_freq, vclk_freq, + venc_freq, hdmi_freq, priv->venc.hdmi_use_enci); + } + +@@ -617,6 +621,7 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + const struct drm_display_mode *mode) + { + struct meson_drm *priv = connector->dev->dev_private; ++ unsigned int phy_freq; + unsigned int vclk_freq; + unsigned int venc_freq; + unsigned int hdmi_freq; +@@ -643,6 +648,9 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + + vclk_freq = mode->clock; + ++ /* TMDS clock is pixel_clock * 10 */ ++ phy_freq = vclk_freq * 10; ++ + /* 480i/576i needs global pixel doubling */ + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + vclk_freq *= 2; +@@ -659,10 +667,10 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + venc_freq /= 2; + +- dev_dbg(connector->dev->dev, "%s: vclk:%d venc=%d hdmi=%d\n", __func__, +- vclk_freq, venc_freq, hdmi_freq); ++ dev_dbg(connector->dev->dev, "%s: vclk:%d phy=%d venc=%d hdmi=%d\n", ++ __func__, phy_freq, vclk_freq, venc_freq, hdmi_freq); + +- return meson_vclk_vic_supported_freq(vclk_freq); ++ return meson_vclk_vic_supported_freq(phy_freq, vclk_freq); + } + + /* Encoder */ +diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c +index f690793ae2d5..fdf26dac9fa8 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.c ++++ b/drivers/gpu/drm/meson/meson_vclk.c +@@ -354,12 +354,17 @@ enum { + /* 2970 /1 /1 /1 /5 /2 => /1 /1 */ + MESON_VCLK_HDMI_297000, + /* 5940 /1 /1 /2 /5 /1 => /1 /1 */ +- MESON_VCLK_HDMI_594000 ++ MESON_VCLK_HDMI_594000, ++/* 2970 /1 /1 /1 /5 /1 => /1 /2 */ ++ MESON_VCLK_HDMI_594000_YUV420, + }; + + struct meson_vclk_params { ++ unsigned int pll_freq; ++ unsigned int phy_freq; ++ unsigned int vclk_freq; ++ unsigned int venc_freq; + unsigned int pixel_freq; +- unsigned int pll_base_freq; + unsigned int pll_od1; + unsigned int pll_od2; + unsigned int pll_od3; +@@ -367,8 +372,11 @@ struct meson_vclk_params { + unsigned int vclk_div; + } params[] = { + [MESON_VCLK_HDMI_ENCI_54000] = { ++ .pll_freq = 4320000, ++ .phy_freq = 270000, ++ .vclk_freq = 54000, ++ .venc_freq = 54000, + .pixel_freq = 54000, +- .pll_base_freq = 4320000, + .pll_od1 = 4, + .pll_od2 = 4, + .pll_od3 = 1, +@@ -376,8 +384,11 @@ struct meson_vclk_params { + .vclk_div = 1, + }, + [MESON_VCLK_HDMI_DDR_54000] = { +- .pixel_freq = 54000, +- .pll_base_freq = 4320000, ++ .pll_freq = 4320000, ++ .phy_freq = 270000, ++ .vclk_freq = 54000, ++ .venc_freq = 54000, ++ .pixel_freq = 27000, + .pll_od1 = 4, + .pll_od2 = 4, + .pll_od3 = 1, +@@ -385,8 +396,11 @@ struct meson_vclk_params { + .vclk_div = 1, + }, + [MESON_VCLK_HDMI_DDR_148500] = { +- .pixel_freq = 148500, +- .pll_base_freq = 2970000, ++ .pll_freq = 2970000, ++ .phy_freq = 742500, ++ .vclk_freq = 148500, ++ .venc_freq = 148500, ++ .pixel_freq = 74250, + .pll_od1 = 4, + .pll_od2 = 1, + .pll_od3 = 1, +@@ -394,8 +408,11 @@ struct meson_vclk_params { + .vclk_div = 1, + }, + [MESON_VCLK_HDMI_74250] = { ++ .pll_freq = 2970000, ++ .phy_freq = 742500, ++ .vclk_freq = 74250, ++ .venc_freq = 74250, + .pixel_freq = 74250, +- .pll_base_freq = 2970000, + .pll_od1 = 2, + .pll_od2 = 2, + .pll_od3 = 2, +@@ -403,8 +420,11 @@ struct meson_vclk_params { + .vclk_div = 1, + }, + [MESON_VCLK_HDMI_148500] = { ++ .pll_freq = 2970000, ++ .phy_freq = 1485000, ++ .vclk_freq = 148500, ++ .venc_freq = 148500, + .pixel_freq = 148500, +- .pll_base_freq = 2970000, + .pll_od1 = 1, + .pll_od2 = 2, + .pll_od3 = 2, +@@ -412,8 +432,11 @@ struct meson_vclk_params { + .vclk_div = 1, + }, + [MESON_VCLK_HDMI_297000] = { ++ .pll_freq = 5940000, ++ .phy_freq = 2970000, ++ .venc_freq = 297000, ++ .vclk_freq = 297000, + .pixel_freq = 297000, +- .pll_base_freq = 5940000, + .pll_od1 = 2, + .pll_od2 = 1, + .pll_od3 = 1, +@@ -421,14 +444,29 @@ struct meson_vclk_params { + .vclk_div = 2, + }, + [MESON_VCLK_HDMI_594000] = { ++ .pll_freq = 5940000, ++ .phy_freq = 5940000, ++ .venc_freq = 594000, ++ .vclk_freq = 594000, + .pixel_freq = 594000, +- .pll_base_freq = 5940000, + .pll_od1 = 1, + .pll_od2 = 1, + .pll_od3 = 2, + .vid_pll_div = VID_PLL_DIV_5, + .vclk_div = 1, + }, ++ [MESON_VCLK_HDMI_594000_YUV420] = { ++ .pll_freq = 5940000, ++ .phy_freq = 2970000, ++ .venc_freq = 594000, ++ .vclk_freq = 594000, ++ .pixel_freq = 297000, ++ .pll_od1 = 2, ++ .pll_od2 = 1, ++ .pll_od3 = 1, ++ .vid_pll_div = VID_PLL_DIV_5, ++ .vclk_div = 1, ++ }, + { /* sentinel */ }, + }; + +@@ -701,6 +739,7 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv, + unsigned int od, m, frac, od1, od2, od3; + + if (meson_hdmi_pll_find_params(priv, pll_freq, &m, &frac, &od)) { ++ /* OD2 goes to the PHY, and needs to be *10, so keep OD3=1 */ + od3 = 1; + if (od < 4) { + od1 = 2; +@@ -723,21 +762,28 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv, + } + + enum drm_mode_status +-meson_vclk_vic_supported_freq(unsigned int freq) ++meson_vclk_vic_supported_freq(unsigned int phy_freq, ++ unsigned int vclk_freq) + { + int i; + +- DRM_DEBUG_DRIVER("freq = %d\n", freq); ++ DRM_DEBUG_DRIVER("phy_freq = %d vclk_freq = %d\n", ++ phy_freq, vclk_freq); + + for (i = 0 ; params[i].pixel_freq ; ++i) { + DRM_DEBUG_DRIVER("i = %d pixel_freq = %d alt = %d\n", + i, params[i].pixel_freq, + FREQ_1000_1001(params[i].pixel_freq)); ++ DRM_DEBUG_DRIVER("i = %d phy_freq = %d alt = %d\n", ++ i, params[i].phy_freq, ++ FREQ_1000_1001(params[i].phy_freq/10)*10); + /* Match strict frequency */ +- if (freq == params[i].pixel_freq) ++ if (phy_freq == params[i].phy_freq && ++ vclk_freq == params[i].vclk_freq) + return MODE_OK; + /* Match 1000/1001 variant */ +- if (freq == FREQ_1000_1001(params[i].pixel_freq)) ++ if (phy_freq == (FREQ_1000_1001(params[i].phy_freq/10)*10) && ++ vclk_freq == FREQ_1000_1001(params[i].vclk_freq)) + return MODE_OK; + } + +@@ -965,8 +1011,9 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq, + } + + void meson_vclk_setup(struct meson_drm *priv, unsigned int target, +- unsigned int vclk_freq, unsigned int venc_freq, +- unsigned int dac_freq, bool hdmi_use_enci) ++ unsigned int phy_freq, unsigned int vclk_freq, ++ unsigned int venc_freq, unsigned int dac_freq, ++ bool hdmi_use_enci) + { + bool vic_alternate_clock = false; + unsigned int freq; +@@ -986,7 +1033,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + * - venc_div = 1 + * - encp encoder + */ +- meson_vclk_set(priv, vclk_freq * 10, 0, 0, 0, ++ meson_vclk_set(priv, phy_freq, 0, 0, 0, + VID_PLL_DIV_5, 2, 1, 1, false, false); + return; + } +@@ -1008,9 +1055,11 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + } + + for (freq = 0 ; params[freq].pixel_freq ; ++freq) { +- if (vclk_freq == params[freq].pixel_freq || +- vclk_freq == FREQ_1000_1001(params[freq].pixel_freq)) { +- if (vclk_freq != params[freq].pixel_freq) ++ if ((phy_freq == params[freq].phy_freq || ++ phy_freq == FREQ_1000_1001(params[freq].phy_freq/10)*10) && ++ (vclk_freq == params[freq].vclk_freq || ++ vclk_freq == FREQ_1000_1001(params[freq].vclk_freq))) { ++ if (vclk_freq != params[freq].vclk_freq) + vic_alternate_clock = true; + else + vic_alternate_clock = false; +@@ -1039,7 +1088,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + return; + } + +- meson_vclk_set(priv, params[freq].pll_base_freq, ++ meson_vclk_set(priv, params[freq].pll_freq, + params[freq].pll_od1, params[freq].pll_od2, + params[freq].pll_od3, params[freq].vid_pll_div, + params[freq].vclk_div, hdmi_tx_div, venc_div, +diff --git a/drivers/gpu/drm/meson/meson_vclk.h b/drivers/gpu/drm/meson/meson_vclk.h +index b62125540aef..aed0ab2efa71 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.h ++++ b/drivers/gpu/drm/meson/meson_vclk.h +@@ -25,10 +25,11 @@ enum { + enum drm_mode_status + meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned int freq); + enum drm_mode_status +-meson_vclk_vic_supported_freq(unsigned int freq); ++meson_vclk_vic_supported_freq(unsigned int phy_freq, unsigned int vclk_freq); + + void meson_vclk_setup(struct meson_drm *priv, unsigned int target, +- unsigned int vclk_freq, unsigned int venc_freq, +- unsigned int dac_freq, bool hdmi_use_enci); ++ unsigned int phy_freq, unsigned int vclk_freq, ++ unsigned int venc_freq, unsigned int dac_freq, ++ bool hdmi_use_enci); + + #endif /* __MESON_VCLK_H */ +diff --git a/drivers/gpu/drm/meson/meson_venc_cvbs.c b/drivers/gpu/drm/meson/meson_venc_cvbs.c +index 1bd6b6d15ffb..541f9eb2a135 100644 +--- a/drivers/gpu/drm/meson/meson_venc_cvbs.c ++++ b/drivers/gpu/drm/meson/meson_venc_cvbs.c +@@ -213,8 +213,10 @@ static void meson_venc_cvbs_encoder_mode_set(struct drm_encoder *encoder, + meson_venci_cvbs_mode_set(priv, meson_mode->enci); + + /* Setup 27MHz vclk2 for ENCI and VDAC */ +- meson_vclk_setup(priv, MESON_VCLK_TARGET_CVBS, MESON_VCLK_CVBS, +- MESON_VCLK_CVBS, MESON_VCLK_CVBS, true); ++ meson_vclk_setup(priv, MESON_VCLK_TARGET_CVBS, ++ MESON_VCLK_CVBS, MESON_VCLK_CVBS, ++ MESON_VCLK_CVBS, MESON_VCLK_CVBS, ++ true); + } + } + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0100-TEMP-ARM64-defconfig-enable-CEC-support.patch b/packages/linux/patches/amlogic/amlogic-0100-TEMP-ARM64-defconfig-enable-CEC-support.patch deleted file mode 100644 index b0da716cc1..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0100-TEMP-ARM64-defconfig-enable-CEC-support.patch +++ /dev/null @@ -1,47 +0,0 @@ -From aabb4aac6df9e3b5db445f87ae01d48efd1015de Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Mon, 13 Nov 2017 12:09:40 +0100 -Subject: [PATCH 100/187] TEMP: ARM64: defconfig: enable CEC support - -Turn on CONFIG_CEC_SUPPORT and CONFIG_CEC_PLATFORM_DRIVERS -Turn on CONFIG_VIDEO_MESON_AO_CEC as module -Turn on CONFIG_DRM_DW_HDMI_CEC as module - -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - arch/arm64/configs/defconfig | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig -index 0e58ef02880c..1053815f20cc 100644 ---- a/arch/arm64/configs/defconfig -+++ b/arch/arm64/configs/defconfig -@@ -493,6 +493,7 @@ CONFIG_MEDIA_SUPPORT=m - CONFIG_MEDIA_CAMERA_SUPPORT=y - CONFIG_MEDIA_ANALOG_TV_SUPPORT=y - CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_CEC_SUPPORT=y - CONFIG_MEDIA_CONTROLLER=y - CONFIG_VIDEO_V4L2_SUBDEV_API=y - # CONFIG_DVB_NET is not set -@@ -506,6 +507,8 @@ CONFIG_VIDEO_SAMSUNG_S5P_MFC=m - CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m - CONFIG_VIDEO_RENESAS_FCP=m - CONFIG_VIDEO_RENESAS_VSP1=m -+CONFIG_CEC_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_MESON_AO_CEC=m - CONFIG_DRM=m - CONFIG_DRM_I2C_NXP_TDA998X=m - CONFIG_DRM_NOUVEAU=m -@@ -530,6 +533,7 @@ CONFIG_DRM_TEGRA=m - CONFIG_DRM_PANEL_SIMPLE=m - CONFIG_DRM_SII902X=m - CONFIG_DRM_I2C_ADV7511=m -+CONFIG_DRM_DW_HDMI_CEC=m - CONFIG_DRM_VC4=m - CONFIG_DRM_HISI_HIBMC=m - CONFIG_DRM_HISI_KIRIN=m --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch b/packages/linux/patches/amlogic/amlogic-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch new file mode 100644 index 0000000000..ff82e15d0a --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch @@ -0,0 +1,240 @@ +From 225a0abd39d8620ceb98f1fa920b849cb916185c Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 15 Nov 2018 16:41:23 +0100 +Subject: [PATCH 101/146] FROMLIST: drm/meson: Add YUV420 output support + +This patch adds support for the YUV420 output from the Amlogic Meson SoCs +Video Processing Unit to the HDMI Controller. + +The YUV420 is obtained by generating a YUV444 pixel stream like +the classic HDMI display modes, but then the Video Encoder output +can be configured to down-sample the YUV444 pixel stream to a YUV420 +stream. +In addition if pixel stream down-sampling, the Y Cb Cr components must +also be mapped differently to align with the HDMI2.0 specifications. + +This mode needs a different clock generation scheme since the TMDS PHY +clock must match the 10x ration with the YUV420 pixel clock, but +the video encoder must run at 2x the pixel clock. + +This patch enables the bridge bus format negociation, and handles +the YUV420 case if selected by the negociation. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_dw_hdmi.c | 91 ++++++++++++++++++++------- + 1 file changed, 70 insertions(+), 21 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c +index 94f206bf795d..5962afbfc8ab 100644 +--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c +@@ -150,6 +150,7 @@ struct meson_dw_hdmi { + struct regulator *hdmi_supply; + u32 irq_stat; + struct dw_hdmi *hdmi; ++ unsigned long output_bus_fmt; + }; + #define encoder_to_meson_dw_hdmi(x) \ + container_of(x, struct meson_dw_hdmi, encoder) +@@ -301,6 +302,10 @@ static void meson_hdmi_phy_setup_mode(struct meson_dw_hdmi *dw_hdmi, + struct meson_drm *priv = dw_hdmi->priv; + unsigned int pixel_clock = mode->clock; + ++ /* For 420, pixel clock is half unlike venc clock */ ++ if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) ++ pixel_clock /= 2; ++ + if (dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") || + dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxm-dw-hdmi")) { + if (pixel_clock >= 371250) { +@@ -383,6 +388,10 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, + + vclk_freq = mode->clock; + ++ /* For 420, pixel clock is half unlike venc clock */ ++ if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) ++ vclk_freq /= 2; ++ + /* TMDS clock is pixel_clock * 10 */ + phy_freq = vclk_freq * 10; + +@@ -392,13 +401,16 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi, + return; + } + ++ /* 480i/576i needs global pixel doubling */ + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + vclk_freq *= 2; + + venc_freq = vclk_freq; + hdmi_freq = vclk_freq; + +- if (meson_venc_hdmi_venc_repeat(vic)) ++ /* VENC double pixels for 1080i, 720p and YUV420 modes */ ++ if (meson_venc_hdmi_venc_repeat(vic) || ++ dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) + venc_freq *= 2; + + vclk_freq = max(venc_freq, hdmi_freq); +@@ -445,8 +457,9 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, + /* Enable normal output to PHY */ + dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12)); + +- /* TMDS pattern setup (TOFIX Handle the YUV420 case) */ +- if (mode->clock > 340000) { ++ /* TMDS pattern setup */ ++ if (mode->clock > 340000 && ++ dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_YUV8_1X24) { + dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, + 0); + dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23, +@@ -621,6 +634,7 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + const struct drm_display_mode *mode) + { + struct meson_drm *priv = connector->dev->dev_private; ++ bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported; + unsigned int phy_freq; + unsigned int vclk_freq; + unsigned int venc_freq; +@@ -630,9 +644,11 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + + DRM_DEBUG_DRIVER("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); + +- /* If sink max TMDS clock, we reject the mode */ ++ /* If sink does not support 540MHz, reject the non-420 HDMI2 modes */ + if (connector->display_info.max_tmds_clock && +- mode->clock > connector->display_info.max_tmds_clock) ++ mode->clock > connector->display_info.max_tmds_clock && ++ !drm_mode_is_420_only(&connector->display_info, mode) && ++ !drm_mode_is_420_also(&connector->display_info, mode)) + return MODE_BAD; + + /* Check against non-VIC supported modes */ +@@ -648,6 +664,12 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + + vclk_freq = mode->clock; + ++ /* For 420, pixel clock is half unlike venc clock */ ++ if (drm_mode_is_420_only(&connector->display_info, mode) || ++ (!is_hdmi2_sink && ++ drm_mode_is_420_also(&connector->display_info, mode))) ++ vclk_freq /= 2; ++ + /* TMDS clock is pixel_clock * 10 */ + phy_freq = vclk_freq * 10; + +@@ -658,8 +680,11 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + venc_freq = vclk_freq; + hdmi_freq = vclk_freq; + +- /* VENC double pixels for 1080i and 720p modes */ +- if (meson_venc_hdmi_venc_repeat(vic)) ++ /* VENC double pixels for 1080i, 720p and YUV420 modes */ ++ if (meson_venc_hdmi_venc_repeat(vic) || ++ drm_mode_is_420_only(&connector->display_info, mode) || ++ (!is_hdmi2_sink && ++ drm_mode_is_420_also(&connector->display_info, mode))) + venc_freq *= 2; + + vclk_freq = max(venc_freq, hdmi_freq); +@@ -677,6 +702,7 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + + static const u32 meson_dw_hdmi_out_bus_fmts[] = { + MEDIA_BUS_FMT_YUV8_1X24, ++ MEDIA_BUS_FMT_UYYVYY8_0_5X24, + }; + + static void meson_venc_hdmi_encoder_destroy(struct drm_encoder *encoder) +@@ -717,18 +743,23 @@ meson_venc_hdmi_encoder_get_inp_bus_fmts(struct drm_bridge *bridge, + unsigned int *num_input_fmts) + { + u32 *input_fmts = NULL; ++ int i; + +- if (output_fmt == meson_dw_hdmi_out_bus_fmts[0]) { +- *num_input_fmts = 1; +- input_fmts = kcalloc(*num_input_fmts, +- sizeof(*input_fmts), +- GFP_KERNEL); +- if (!input_fmts) +- return NULL; ++ *num_input_fmts = 0; + +- input_fmts[0] = output_fmt; +- } else { +- *num_input_fmts = 0; ++ for (i = 0 ; i < ARRAY_SIZE(meson_dw_hdmi_out_bus_fmts) ; ++i) { ++ if (output_fmt == meson_dw_hdmi_out_bus_fmts[i]) { ++ *num_input_fmts = 1; ++ input_fmts = kcalloc(*num_input_fmts, ++ sizeof(*input_fmts), ++ GFP_KERNEL); ++ if (!input_fmts) ++ return NULL; ++ ++ input_fmts[0] = output_fmt; ++ ++ break; ++ } + } + + return input_fmts; +@@ -739,6 +770,12 @@ static int meson_venc_hdmi_encoder_atomic_check(struct drm_bridge *bridge, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) + { ++ struct meson_dw_hdmi *dw_hdmi = bridge_to_meson_dw_hdmi(bridge); ++ ++ dw_hdmi->output_bus_fmt = bridge_state->output_bus_cfg.format; ++ ++ DRM_DEBUG_DRIVER("output_bus_fmt %lx\n", dw_hdmi->output_bus_fmt); ++ + return 0; + } + +@@ -776,18 +813,29 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge, + struct meson_dw_hdmi *dw_hdmi = bridge_to_meson_dw_hdmi(bridge); + struct meson_drm *priv = dw_hdmi->priv; + int vic = drm_match_cea_mode(mode); ++ unsigned int ycrcb_map = VPU_HDMI_OUTPUT_CBYCR; ++ bool yuv420_mode = false; + + DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic); + ++ if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) { ++ ycrcb_map = VPU_HDMI_OUTPUT_CRYCB; ++ yuv420_mode = true; ++ } ++ + /* VENC + VENC-DVI Mode setup */ +- meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, false, +- VPU_HDMI_OUTPUT_CBYCR); ++ meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, yuv420_mode, mode); + + /* VCLK Set clock */ + dw_hdmi_set_vclk(dw_hdmi, mode); + +- /* Setup YUV444 to HDMI-TX, no 10bit diphering */ +- writel_relaxed(0, priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); ++ if (dw_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) ++ /* Setup YUV420 to HDMI-TX, no 10bit diphering */ ++ writel_relaxed(2 | (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)); + } + + static const struct drm_bridge_funcs meson_venc_hdmi_encoder_bridge_funcs = { +@@ -1045,6 +1093,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, + dw_plat_data->phy_name = "meson_dw_hdmi_phy"; + dw_plat_data->phy_data = meson_dw_hdmi; + dw_plat_data->input_bus_encoding = V4L2_YCBCR_ENC_709; ++ dw_plat_data->ycbcr_420_allowed = true; + + if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") || + dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") || +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0101-TEMP-ASoC-meson-add-meson-audio-core-driver.patch b/packages/linux/patches/amlogic/amlogic-0101-TEMP-ASoC-meson-add-meson-audio-core-driver.patch deleted file mode 100644 index e67e21fa12..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0101-TEMP-ASoC-meson-add-meson-audio-core-driver.patch +++ /dev/null @@ -1,303 +0,0 @@ -From f1e8bfe90a2fe3d25e405a3835f28bed7a2d222f Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 30 Mar 2017 11:49:55 +0200 -Subject: [PATCH 101/187] TEMP: ASoC: meson: add meson audio core driver - -This patch adds support for the audio core driver for the Amlogic Meson SoC -family. The purpose of this driver is to properly reset the audio block and -provide register access for the different devices scattered in this address -space. This includes output and input DMAs, pcm, i2s and spdif dai, card -level routing, internal codec for the gxl variant - -For more information, please refer to the section 5 of the public datasheet -of the S905 (gxbb). This datasheet is available here: [0]. - -[0]: http://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdf - -Signed-off-by: Jerome Brunet ---- - sound/soc/Kconfig | 1 + - sound/soc/Makefile | 1 + - sound/soc/meson-gx/Kconfig | 11 ++ - sound/soc/meson-gx/Makefile | 3 + - sound/soc/meson-gx/audio-core.c | 180 ++++++++++++++++++++++++++++++++ - sound/soc/meson-gx/audio-core.h | 28 +++++ - 6 files changed, 224 insertions(+) - create mode 100644 sound/soc/meson-gx/Kconfig - create mode 100644 sound/soc/meson-gx/Makefile - create mode 100644 sound/soc/meson-gx/audio-core.c - create mode 100644 sound/soc/meson-gx/audio-core.h - -diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig -index dc86e4073001..0148a95fd1ce 100644 ---- a/sound/soc/Kconfig -+++ b/sound/soc/Kconfig -@@ -57,6 +57,7 @@ source "sound/soc/img/Kconfig" - source "sound/soc/intel/Kconfig" - source "sound/soc/mediatek/Kconfig" - source "sound/soc/meson/Kconfig" -+source "sound/soc/meson-gx/Kconfig" - source "sound/soc/mxs/Kconfig" - source "sound/soc/pxa/Kconfig" - source "sound/soc/qcom/Kconfig" -diff --git a/sound/soc/Makefile b/sound/soc/Makefile -index 919c3c027c62..9f1f4b0f45eb 100644 ---- a/sound/soc/Makefile -+++ b/sound/soc/Makefile -@@ -38,6 +38,7 @@ obj-$(CONFIG_SND_SOC) += img/ - obj-$(CONFIG_SND_SOC) += intel/ - obj-$(CONFIG_SND_SOC) += mediatek/ - obj-$(CONFIG_SND_SOC) += meson/ -+obj-$(CONFIG_SND_SOC) += meson-gx/ - obj-$(CONFIG_SND_SOC) += mxs/ - obj-$(CONFIG_SND_SOC) += nuc900/ - obj-$(CONFIG_SND_SOC) += kirkwood/ -diff --git a/sound/soc/meson-gx/Kconfig b/sound/soc/meson-gx/Kconfig -new file mode 100644 -index 000000000000..280e49e7c16f ---- /dev/null -+++ b/sound/soc/meson-gx/Kconfig -@@ -0,0 +1,11 @@ -+menuconfig SND_SOC_MESON_GX -+ tristate "ASoC WIP support for Amlogic GX SoCs" -+ depends on ARCH_MESON -+ select MFD_CORE -+ select REGMAP_MMIO -+ help -+ Say Y or M if you want to add support for codecs attached to -+ the Amlogic Meson SoCs Audio interfaces. You will also need to -+ select the audio interfaces to support below. This WIP drivers -+ are kept separated from the actual upstream amlogic ASoC driver -+ to minimize conflicts until support is submitted and merged -diff --git a/sound/soc/meson-gx/Makefile b/sound/soc/meson-gx/Makefile -new file mode 100644 -index 000000000000..6f124c31a85c ---- /dev/null -+++ b/sound/soc/meson-gx/Makefile -@@ -0,0 +1,3 @@ -+snd-soc-meson-audio-core-objs := audio-core.o -+ -+obj-$(CONFIG_SND_SOC_MESON_GX) += snd-soc-meson-audio-core.o -diff --git a/sound/soc/meson-gx/audio-core.c b/sound/soc/meson-gx/audio-core.c -new file mode 100644 -index 000000000000..68f7e0e58f5f ---- /dev/null -+++ b/sound/soc/meson-gx/audio-core.c -@@ -0,0 +1,180 @@ -+/* -+ * Copyright (C) 2017 BayLibre, SAS -+ * Author: Jerome Brunet -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "audio-core.h" -+ -+#define DRV_NAME "meson-gx-audio-core" -+ -+static const char * const acore_clock_names[] = { "aiu_top", -+ "aiu_glue", -+ "audin" }; -+ -+static int meson_acore_init_clocks(struct device *dev) -+{ -+ struct clk *clock; -+ int i, ret; -+ -+ for (i = 0; i < ARRAY_SIZE(acore_clock_names); i++) { -+ clock = devm_clk_get(dev, acore_clock_names[i]); -+ if (IS_ERR(clock)) { -+ if (PTR_ERR(clock) != -EPROBE_DEFER) -+ dev_err(dev, "Failed to get %s clock\n", -+ acore_clock_names[i]); -+ return PTR_ERR(clock); -+ } -+ -+ ret = clk_prepare_enable(clock); -+ if (ret) { -+ dev_err(dev, "Failed to enable %s clock\n", -+ acore_clock_names[i]); -+ return ret; -+ } -+ -+ ret = devm_add_action_or_reset(dev, -+ (void(*)(void *))clk_disable_unprepare, -+ clock); -+ if (ret) -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static const char * const acore_reset_names[] = { "aiu", -+ "audin" }; -+ -+static int meson_acore_init_resets(struct device *dev) -+{ -+ struct reset_control *reset; -+ int i, ret; -+ -+ for (i = 0; i < ARRAY_SIZE(acore_reset_names); i++) { -+ reset = devm_reset_control_get_exclusive(dev, -+ acore_reset_names[i]); -+ if (IS_ERR(reset)) { -+ if (PTR_ERR(reset) != -EPROBE_DEFER) -+ dev_err(dev, "Failed to get %s reset\n", -+ acore_reset_names[i]); -+ return PTR_ERR(reset); -+ } -+ -+ ret = reset_control_reset(reset); -+ if (ret) { -+ dev_err(dev, "Failed to pulse %s reset\n", -+ acore_reset_names[i]); -+ return ret; -+ } -+ } -+ -+ return 0; -+} -+ -+static const struct regmap_config meson_acore_regmap_config = { -+ .reg_bits = 32, -+ .val_bits = 32, -+ .reg_stride = 4, -+}; -+ -+static const struct mfd_cell meson_acore_devs[] = { -+ { -+ .name = "meson-aiu-i2s", -+ .of_compatible = "amlogic,meson-aiu-i2s", -+ }, -+ { -+ .name = "meson-aiu-spdif", -+ .of_compatible = "amlogic,meson-aiu-spdif", -+ }, -+}; -+ -+static int meson_acore_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct meson_audio_core_data *data; -+ struct resource *res; -+ void __iomem *regs; -+ int ret; -+ -+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ platform_set_drvdata(pdev, data); -+ -+ ret = meson_acore_init_clocks(dev); -+ if (ret) -+ return ret; -+ -+ ret = meson_acore_init_resets(dev); -+ if (ret) -+ return ret; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "aiu"); -+ regs = devm_ioremap_resource(dev, res); -+ if (IS_ERR(regs)) -+ return PTR_ERR(regs); -+ -+ data->aiu = devm_regmap_init_mmio(dev, regs, -+ &meson_acore_regmap_config); -+ if (IS_ERR(data->aiu)) { -+ dev_err(dev, "Couldn't create the AIU regmap\n"); -+ return PTR_ERR(data->aiu); -+ } -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "audin"); -+ regs = devm_ioremap_resource(dev, res); -+ if (IS_ERR(regs)) -+ return PTR_ERR(regs); -+ -+ data->audin = devm_regmap_init_mmio(dev, regs, -+ &meson_acore_regmap_config); -+ if (IS_ERR(data->audin)) { -+ dev_err(dev, "Couldn't create the AUDIN regmap\n"); -+ return PTR_ERR(data->audin); -+ } -+ -+ return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, meson_acore_devs, -+ ARRAY_SIZE(meson_acore_devs), NULL, 0, -+ NULL); -+} -+ -+static const struct of_device_id meson_acore_of_match[] = { -+ { .compatible = "amlogic,meson-gx-audio-core", }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, meson_acore_of_match); -+ -+static struct platform_driver meson_acore_pdrv = { -+ .probe = meson_acore_probe, -+ .driver = { -+ .name = DRV_NAME, -+ .of_match_table = meson_acore_of_match, -+ }, -+}; -+module_platform_driver(meson_acore_pdrv); -+ -+MODULE_DESCRIPTION("Meson Audio Core Driver"); -+MODULE_AUTHOR("Jerome Brunet "); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/meson-gx/audio-core.h b/sound/soc/meson-gx/audio-core.h -new file mode 100644 -index 000000000000..6e7a24cdc4a9 ---- /dev/null -+++ b/sound/soc/meson-gx/audio-core.h -@@ -0,0 +1,28 @@ -+/* -+ * Copyright (C) 2017 BayLibre, SAS -+ * Author: Jerome Brunet -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#ifndef _MESON_AUDIO_CORE_H_ -+#define _MESON_AUDIO_CORE_H_ -+ -+struct meson_audio_core_data { -+ struct regmap *aiu; -+ struct regmap *audin; -+}; -+ -+#endif /* _MESON_AUDIO_CORE_H_ */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0102-FROMLIST-drm-bridge-dw-hdmi-fix-AVI-frame-colorimetr.patch b/packages/linux/patches/amlogic/amlogic-0102-FROMLIST-drm-bridge-dw-hdmi-fix-AVI-frame-colorimetr.patch new file mode 100644 index 0000000000..5083ab3bc2 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0102-FROMLIST-drm-bridge-dw-hdmi-fix-AVI-frame-colorimetr.patch @@ -0,0 +1,77 @@ +From 523fe0901b9522abe6fc951d12dbb94e730ad3da Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Sun, 1 Mar 2020 16:45:34 +0000 +Subject: [PATCH 102/146] FROMLIST: drm/bridge: dw-hdmi: fix AVI frame + colorimetry + +CTA-861-F explicitly states that for RGB colorspace colorimetry should +be set to "none". Fix that. + +Fixes: def23aa7e982 ("drm: bridge: dw-hdmi: Switch to V4L bus format and encodings") +Signed-off-by: Jernej Skrabec +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 46 +++++++++++++---------- + 1 file changed, 26 insertions(+), 20 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 4b35ea1427df..2115b13676cb 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1624,28 +1624,34 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + frame.colorspace = HDMI_COLORSPACE_RGB; + + /* Set up colorimetry */ +- switch (hdmi->hdmi_data.enc_out_encoding) { +- case V4L2_YCBCR_ENC_601: +- if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) +- frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; +- else ++ if (!hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { ++ switch (hdmi->hdmi_data.enc_out_encoding) { ++ case V4L2_YCBCR_ENC_601: ++ if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) ++ frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; ++ else ++ frame.colorimetry = HDMI_COLORIMETRY_ITU_601; ++ frame.extended_colorimetry = ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; ++ break; ++ case V4L2_YCBCR_ENC_709: ++ if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) ++ frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; ++ else ++ frame.colorimetry = HDMI_COLORIMETRY_ITU_709; ++ frame.extended_colorimetry = ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; ++ break; ++ default: /* Carries no data */ + frame.colorimetry = HDMI_COLORIMETRY_ITU_601; ++ frame.extended_colorimetry = ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; ++ break; ++ } ++ } else { ++ frame.colorimetry = HDMI_COLORIMETRY_NONE; + frame.extended_colorimetry = +- HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; +- break; +- case V4L2_YCBCR_ENC_709: +- if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) +- frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; +- else +- frame.colorimetry = HDMI_COLORIMETRY_ITU_709; +- frame.extended_colorimetry = +- HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; +- break; +- default: /* Carries no data */ +- frame.colorimetry = HDMI_COLORIMETRY_ITU_601; +- frame.extended_colorimetry = +- HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; +- break; ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; + } + + frame.scan_mode = HDMI_SCAN_MODE_NONE; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0102-TEMP-ASoC-meson-add-register-definitions.patch b/packages/linux/patches/amlogic/amlogic-0102-TEMP-ASoC-meson-add-register-definitions.patch deleted file mode 100644 index 78e8da3a0e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0102-TEMP-ASoC-meson-add-register-definitions.patch +++ /dev/null @@ -1,360 +0,0 @@ -From 7521f9406f06a2d215752275df9d7e2cf913fe67 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 30 Mar 2017 12:00:10 +0200 -Subject: [PATCH 102/187] TEMP: ASoC: meson: add register definitions - -Add the register definition for the AIU and AUDIN blocks - -Signed-off-by: Jerome Brunet ---- - sound/soc/meson-gx/aiu-regs.h | 182 ++++++++++++++++++++++++++++++++ - sound/soc/meson-gx/audin-regs.h | 148 ++++++++++++++++++++++++++ - 2 files changed, 330 insertions(+) - create mode 100644 sound/soc/meson-gx/aiu-regs.h - create mode 100644 sound/soc/meson-gx/audin-regs.h - -diff --git a/sound/soc/meson-gx/aiu-regs.h b/sound/soc/meson-gx/aiu-regs.h -new file mode 100644 -index 000000000000..67391e64fe1c ---- /dev/null -+++ b/sound/soc/meson-gx/aiu-regs.h -@@ -0,0 +1,182 @@ -+/* -+ * Copyright (C) 2017 BayLibre, SAS -+ * Author: Jerome Brunet -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#ifndef _AIU_REGS_H_ -+#define _AIU_REGS_H_ -+ -+#define AIU_958_BPF 0x000 -+#define AIU_958_BRST 0x004 -+#define AIU_958_LENGTH 0x008 -+#define AIU_958_PADDSIZE 0x00C -+#define AIU_958_MISC 0x010 -+#define AIU_958_FORCE_LEFT 0x014 /* Unknown */ -+#define AIU_958_DISCARD_NUM 0x018 -+#define AIU_958_DCU_FF_CTRL 0x01C -+#define AIU_958_CHSTAT_L0 0x020 -+#define AIU_958_CHSTAT_L1 0x024 -+#define AIU_958_CTRL 0x028 -+#define AIU_958_RPT 0x02C -+#define AIU_I2S_MUTE_SWAP 0x030 -+#define AIU_I2S_SOURCE_DESC 0x034 -+#define AIU_I2S_MED_CTRL 0x038 -+#define AIU_I2S_MED_THRESH 0x03C -+#define AIU_I2S_DAC_CFG 0x040 -+#define AIU_I2S_SYNC 0x044 /* Unknown */ -+#define AIU_I2S_MISC 0x048 -+#define AIU_I2S_OUT_CFG 0x04C -+#define AIU_I2S_FF_CTRL 0x050 /* Unknown */ -+#define AIU_RST_SOFT 0x054 -+#define AIU_CLK_CTRL 0x058 -+#define AIU_MIX_ADCCFG 0x05C -+#define AIU_MIX_CTRL 0x060 -+#define AIU_CLK_CTRL_MORE 0x064 -+#define AIU_958_POP 0x068 -+#define AIU_MIX_GAIN 0x06C -+#define AIU_958_SYNWORD1 0x070 -+#define AIU_958_SYNWORD2 0x074 -+#define AIU_958_SYNWORD3 0x078 -+#define AIU_958_SYNWORD1_MASK 0x07C -+#define AIU_958_SYNWORD2_MASK 0x080 -+#define AIU_958_SYNWORD3_MASK 0x084 -+#define AIU_958_FFRDOUT_THD 0x088 -+#define AIU_958_LENGTH_PER_PAUSE 0x08C -+#define AIU_958_PAUSE_NUM 0x090 -+#define AIU_958_PAUSE_PAYLOAD 0x094 -+#define AIU_958_AUTO_PAUSE 0x098 -+#define AIU_958_PAUSE_PD_LENGTH 0x09C -+#define AIU_CODEC_DAC_LRCLK_CTRL 0x0A0 -+#define AIU_CODEC_ADC_LRCLK_CTRL 0x0A4 -+#define AIU_HDMI_CLK_DATA_CTRL 0x0A8 -+#define AIU_CODEC_CLK_DATA_CTRL 0x0AC -+#define AIU_ACODEC_CTRL 0x0B0 -+#define AIU_958_CHSTAT_R0 0x0C0 -+#define AIU_958_CHSTAT_R1 0x0C4 -+#define AIU_958_VALID_CTRL 0x0C8 -+#define AIU_AUDIO_AMP_REG0 0x0F0 /* Unknown */ -+#define AIU_AUDIO_AMP_REG1 0x0F4 /* Unknown */ -+#define AIU_AUDIO_AMP_REG2 0x0F8 /* Unknown */ -+#define AIU_AUDIO_AMP_REG3 0x0FC /* Unknown */ -+#define AIU_AIFIFO2_CTRL 0x100 -+#define AIU_AIFIFO2_STATUS 0x104 -+#define AIU_AIFIFO2_GBIT 0x108 -+#define AIU_AIFIFO2_CLB 0x10C -+#define AIU_CRC_CTRL 0x110 -+#define AIU_CRC_STATUS 0x114 -+#define AIU_CRC_SHIFT_REG 0x118 -+#define AIU_CRC_IREG 0x11C -+#define AIU_CRC_CAL_REG1 0x120 -+#define AIU_CRC_CAL_REG0 0x124 -+#define AIU_CRC_POLY_COEF1 0x128 -+#define AIU_CRC_POLY_COEF0 0x12C -+#define AIU_CRC_BIT_SIZE1 0x130 -+#define AIU_CRC_BIT_SIZE0 0x134 -+#define AIU_CRC_BIT_CNT1 0x138 -+#define AIU_CRC_BIT_CNT0 0x13C -+#define AIU_AMCLK_GATE_HI 0x140 -+#define AIU_AMCLK_GATE_LO 0x144 -+#define AIU_AMCLK_MSR 0x148 -+#define AIU_AUDAC_CTRL0 0x14C /* Unknown */ -+#define AIU_DELTA_SIGMA0 0x154 /* Unknown */ -+#define AIU_DELTA_SIGMA1 0x158 /* Unknown */ -+#define AIU_DELTA_SIGMA2 0x15C /* Unknown */ -+#define AIU_DELTA_SIGMA3 0x160 /* Unknown */ -+#define AIU_DELTA_SIGMA4 0x164 /* Unknown */ -+#define AIU_DELTA_SIGMA5 0x168 /* Unknown */ -+#define AIU_DELTA_SIGMA6 0x16C /* Unknown */ -+#define AIU_DELTA_SIGMA7 0x170 /* Unknown */ -+#define AIU_DELTA_SIGMA_LCNTS 0x174 /* Unknown */ -+#define AIU_DELTA_SIGMA_RCNTS 0x178 /* Unknown */ -+#define AIU_MEM_I2S_START_PTR 0x180 -+#define AIU_MEM_I2S_RD_PTR 0x184 -+#define AIU_MEM_I2S_END_PTR 0x188 -+#define AIU_MEM_I2S_MASKS 0x18C -+#define AIU_MEM_I2S_CONTROL 0x190 -+#define AIU_MEM_IEC958_START_PTR 0x194 -+#define AIU_MEM_IEC958_RD_PTR 0x198 -+#define AIU_MEM_IEC958_END_PTR 0x19C -+#define AIU_MEM_IEC958_MASKS 0x1A0 -+#define AIU_MEM_IEC958_CONTROL 0x1A4 -+#define AIU_MEM_AIFIFO2_START_PTR 0x1A8 -+#define AIU_MEM_AIFIFO2_CURR_PTR 0x1AC -+#define AIU_MEM_AIFIFO2_END_PTR 0x1B0 -+#define AIU_MEM_AIFIFO2_BYTES_AVAIL 0x1B4 -+#define AIU_MEM_AIFIFO2_CONTROL 0x1B8 -+#define AIU_MEM_AIFIFO2_MAN_WP 0x1BC -+#define AIU_MEM_AIFIFO2_MAN_RP 0x1C0 -+#define AIU_MEM_AIFIFO2_LEVEL 0x1C4 -+#define AIU_MEM_AIFIFO2_BUF_CNTL 0x1C8 -+#define AIU_MEM_I2S_MAN_WP 0x1CC -+#define AIU_MEM_I2S_MAN_RP 0x1D0 -+#define AIU_MEM_I2S_LEVEL 0x1D4 -+#define AIU_MEM_I2S_BUF_CNTL 0x1D8 -+#define AIU_MEM_I2S_BUF_WRAP_COUNT 0x1DC -+#define AIU_MEM_I2S_MEM_CTL 0x1E0 -+#define AIU_MEM_IEC958_MEM_CTL 0x1E4 -+#define AIU_MEM_IEC958_WRAP_COUNT 0x1E8 -+#define AIU_MEM_IEC958_IRQ_LEVEL 0x1EC -+#define AIU_MEM_IEC958_MAN_WP 0x1F0 -+#define AIU_MEM_IEC958_MAN_RP 0x1F4 -+#define AIU_MEM_IEC958_LEVEL 0x1F8 -+#define AIU_MEM_IEC958_BUF_CNTL 0x1FC -+#define AIU_AIFIFO_CTRL 0x200 -+#define AIU_AIFIFO_STATUS 0x204 -+#define AIU_AIFIFO_GBIT 0x208 -+#define AIU_AIFIFO_CLB 0x20C -+#define AIU_MEM_AIFIFO_START_PTR 0x210 -+#define AIU_MEM_AIFIFO_CURR_PTR 0x214 -+#define AIU_MEM_AIFIFO_END_PTR 0x218 -+#define AIU_MEM_AIFIFO_BYTES_AVAIL 0x21C -+#define AIU_MEM_AIFIFO_CONTROL 0x220 -+#define AIU_MEM_AIFIFO_MAN_WP 0x224 -+#define AIU_MEM_AIFIFO_MAN_RP 0x228 -+#define AIU_MEM_AIFIFO_LEVEL 0x22C -+#define AIU_MEM_AIFIFO_BUF_CNTL 0x230 -+#define AIU_MEM_AIFIFO_BUF_WRAP_COUNT 0x234 -+#define AIU_MEM_AIFIFO2_BUF_WRAP_COUNT 0x238 -+#define AIU_MEM_AIFIFO_MEM_CTL 0x23C -+#define AIFIFO_TIME_STAMP_CNTL 0x240 -+#define AIFIFO_TIME_STAMP_SYNC_0 0x244 -+#define AIFIFO_TIME_STAMP_SYNC_1 0x248 -+#define AIFIFO_TIME_STAMP_0 0x24C -+#define AIFIFO_TIME_STAMP_1 0x250 -+#define AIFIFO_TIME_STAMP_2 0x254 -+#define AIFIFO_TIME_STAMP_3 0x258 -+#define AIFIFO_TIME_STAMP_LENGTH 0x25C -+#define AIFIFO2_TIME_STAMP_CNTL 0x260 -+#define AIFIFO2_TIME_STAMP_SYNC_0 0x264 -+#define AIFIFO2_TIME_STAMP_SYNC_1 0x268 -+#define AIFIFO2_TIME_STAMP_0 0x26C -+#define AIFIFO2_TIME_STAMP_1 0x270 -+#define AIFIFO2_TIME_STAMP_2 0x274 -+#define AIFIFO2_TIME_STAMP_3 0x278 -+#define AIFIFO2_TIME_STAMP_LENGTH 0x27C -+#define IEC958_TIME_STAMP_CNTL 0x280 -+#define IEC958_TIME_STAMP_SYNC_0 0x284 -+#define IEC958_TIME_STAMP_SYNC_1 0x288 -+#define IEC958_TIME_STAMP_0 0x28C -+#define IEC958_TIME_STAMP_1 0x290 -+#define IEC958_TIME_STAMP_2 0x294 -+#define IEC958_TIME_STAMP_3 0x298 -+#define IEC958_TIME_STAMP_LENGTH 0x29C -+#define AIU_MEM_AIFIFO2_MEM_CTL 0x2A0 -+#define AIU_I2S_CBUS_DDR_CNTL 0x2A4 -+#define AIU_I2S_CBUS_DDR_WDATA 0x2A8 -+#define AIU_I2S_CBUS_DDR_ADDR 0x2AC -+ -+#endif /* _AIU_REGS_H_ */ -diff --git a/sound/soc/meson-gx/audin-regs.h b/sound/soc/meson-gx/audin-regs.h -new file mode 100644 -index 000000000000..f224610e80e7 ---- /dev/null -+++ b/sound/soc/meson-gx/audin-regs.h -@@ -0,0 +1,148 @@ -+/* -+ * Copyright (C) 2017 BayLibre, SAS -+ * Author: Jerome Brunet -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#ifndef _AUDIN_REGS_H_ -+#define _AUDIN_REGS_H_ -+ -+/* -+ * Note : -+ * Datasheet issue page 196 -+ * AUDIN_MUTE_VAL 0x35 => impossible: Already assigned to AUDIN_FIFO1_PTR -+ * AUDIN_FIFO1_PTR is more likely to be correct here since surrounding registers -+ * also deal with AUDIN_FIFO1 -+ * -+ * Clarification needed from Amlogic -+ */ -+ -+#define AUDIN_SPDIF_MODE 0x000 -+#define AUDIN_SPDIF_FS_CLK_RLTN 0x004 -+#define AUDIN_SPDIF_CHNL_STS_A 0x008 -+#define AUDIN_SPDIF_CHNL_STS_B 0x00C -+#define AUDIN_SPDIF_MISC 0x010 -+#define AUDIN_SPDIF_NPCM_PCPD 0x014 -+#define AUDIN_SPDIF_END 0x03C /* Unknown */ -+#define AUDIN_I2SIN_CTRL 0x040 -+#define AUDIN_SOURCE_SEL 0x044 -+#define AUDIN_DECODE_FORMAT 0x048 -+#define AUDIN_DECODE_CONTROL_STATUS 0x04C -+#define AUDIN_DECODE_CHANNEL_STATUS_A_0 0x050 -+#define AUDIN_DECODE_CHANNEL_STATUS_A_1 0x054 -+#define AUDIN_DECODE_CHANNEL_STATUS_A_2 0x058 -+#define AUDIN_DECODE_CHANNEL_STATUS_A_3 0x05C -+#define AUDIN_DECODE_CHANNEL_STATUS_A_4 0x060 -+#define AUDIN_DECODE_CHANNEL_STATUS_A_5 0x064 -+#define AUDIN_FIFO0_START 0x080 -+#define AUDIN_FIFO0_END 0x084 -+#define AUDIN_FIFO0_PTR 0x088 -+#define AUDIN_FIFO0_INTR 0x08C -+#define AUDIN_FIFO0_RDPTR 0x090 -+#define AUDIN_FIFO0_CTRL 0x094 -+#define AUDIN_FIFO0_CTRL1 0x098 -+#define AUDIN_FIFO0_LVL0 0x09C -+#define AUDIN_FIFO0_LVL1 0x0A0 -+#define AUDIN_FIFO0_LVL2 0x0A4 -+#define AUDIN_FIFO0_REQID 0x0C0 -+#define AUDIN_FIFO0_WRAP 0x0C4 -+#define AUDIN_FIFO1_START 0x0CC -+#define AUDIN_FIFO1_END 0x0D0 -+#define AUDIN_FIFO1_PTR 0x0D4 -+#define AUDIN_FIFO1_INTR 0x0D8 -+#define AUDIN_FIFO1_RDPTR 0x0DC -+#define AUDIN_FIFO1_CTRL 0x0E0 -+#define AUDIN_FIFO1_CTRL1 0x0E4 -+#define AUDIN_FIFO1_LVL0 0x100 -+#define AUDIN_FIFO1_LVL1 0x104 -+#define AUDIN_FIFO1_LVL2 0x108 -+#define AUDIN_FIFO1_REQID 0x10C -+#define AUDIN_FIFO1_WRAP 0x110 -+#define AUDIN_FIFO2_START 0x114 -+#define AUDIN_FIFO2_END 0x118 -+#define AUDIN_FIFO2_PTR 0x11C -+#define AUDIN_FIFO2_INTR 0x120 -+#define AUDIN_FIFO2_RDPTR 0x124 -+#define AUDIN_FIFO2_CTRL 0x128 -+#define AUDIN_FIFO2_CTRL1 0x12C -+#define AUDIN_FIFO2_LVL0 0x130 -+#define AUDIN_FIFO2_LVL1 0x134 -+#define AUDIN_FIFO2_LVL2 0x138 -+#define AUDIN_FIFO2_REQID 0x13C -+#define AUDIN_FIFO2_WRAP 0x140 -+#define AUDIN_INT_CTRL 0x144 -+#define AUDIN_FIFO_INT 0x148 -+#define PCMIN_CTRL0 0x180 -+#define PCMIN_CTRL1 0x184 -+#define PCMIN1_CTRL0 0x188 -+#define PCMIN1_CTRL1 0x18C -+#define PCMOUT_CTRL0 0x1C0 -+#define PCMOUT_CTRL1 0x1C4 -+#define PCMOUT_CTRL2 0x1C8 -+#define PCMOUT_CTRL3 0x1CC -+#define PCMOUT1_CTRL0 0x1D0 -+#define PCMOUT1_CTRL1 0x1D4 -+#define PCMOUT1_CTRL2 0x1D8 -+#define PCMOUT1_CTRL3 0x1DC -+#define AUDOUT_CTRL 0x200 -+#define AUDOUT_CTRL1 0x204 -+#define AUDOUT_BUF0_STA 0x208 -+#define AUDOUT_BUF0_EDA 0x20C -+#define AUDOUT_BUF0_WPTR 0x210 -+#define AUDOUT_BUF1_STA 0x214 -+#define AUDOUT_BUF1_EDA 0x218 -+#define AUDOUT_BUF1_WPTR 0x21C -+#define AUDOUT_FIFO_RPTR 0x220 -+#define AUDOUT_INTR_PTR 0x224 -+#define AUDOUT_FIFO_STS 0x228 -+#define AUDOUT1_CTRL 0x240 -+#define AUDOUT1_CTRL1 0x244 -+#define AUDOUT1_BUF0_STA 0x248 -+#define AUDOUT1_BUF0_EDA 0x24C -+#define AUDOUT1_BUF0_WPTR 0x250 -+#define AUDOUT1_BUF1_STA 0x254 -+#define AUDOUT1_BUF1_EDA 0x258 -+#define AUDOUT1_BUF1_WPTR 0x25C -+#define AUDOUT1_FIFO_RPTR 0x260 -+#define AUDOUT1_INTR_PTR 0x264 -+#define AUDOUT1_FIFO_STS 0x268 -+#define AUDIN_HDMI_MEAS_CTRL 0x280 -+#define AUDIN_HDMI_MEAS_CYCLES_M1 0x284 -+#define AUDIN_HDMI_MEAS_INTR_MASKN 0x288 -+#define AUDIN_HDMI_MEAS_INTR_STAT 0x28C -+#define AUDIN_HDMI_REF_CYCLES_STAT_0 0x290 -+#define AUDIN_HDMI_REF_CYCLES_STAT_1 0x294 -+#define AUDIN_HDMIRX_AFIFO_STAT 0x298 -+#define AUDIN_FIFO0_PIO_STS 0x2C0 -+#define AUDIN_FIFO0_PIO_RDL 0x2C4 -+#define AUDIN_FIFO0_PIO_RDH 0x2C8 -+#define AUDIN_FIFO1_PIO_STS 0x2CC -+#define AUDIN_FIFO1_PIO_RDL 0x2D0 -+#define AUDIN_FIFO1_PIO_RDH 0x2D4 -+#define AUDIN_FIFO2_PIO_STS 0x2D8 -+#define AUDIN_FIFO2_PIO_RDL 0x2DC -+#define AUDIN_FIFO2_PIO_RDH 0x2E0 -+#define AUDOUT_FIFO_PIO_STS 0x2E4 -+#define AUDOUT_FIFO_PIO_WRL 0x2E8 -+#define AUDOUT_FIFO_PIO_WRH 0x2EC -+#define AUDOUT1_FIFO_PIO_STS 0x2F0 /* Unknown */ -+#define AUDOUT1_FIFO_PIO_WRL 0x2F4 /* Unknown */ -+#define AUDOUT1_FIFO_PIO_WRH 0x2F8 /* Unknown */ -+#define AUD_RESAMPLE_CTRL0 0x2FC -+#define AUD_RESAMPLE_CTRL1 0x300 -+#define AUD_RESAMPLE_STATUS 0x304 -+ -+#endif /* _AUDIN_REGS_H_ */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0103-FROMLIST-drm-bridge-dw-hdmi-Fix-color-space-conversi.patch b/packages/linux/patches/amlogic/amlogic-0103-FROMLIST-drm-bridge-dw-hdmi-Fix-color-space-conversi.patch new file mode 100644 index 0000000000..61538daedc --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0103-FROMLIST-drm-bridge-dw-hdmi-Fix-color-space-conversi.patch @@ -0,0 +1,36 @@ +From 3816853f9ea2c93c27f462a030f5446b5f7613a5 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Sun, 1 Mar 2020 16:46:34 +0000 +Subject: [PATCH 103/146] FROMLIST: drm/bridge: dw-hdmi: Fix color space + conversion detection + +Currently, is_color_space_conversion() compares not only color spaces +but also formats. For example, function would return true if YCbCr 4:4:4 +and YCbCr 4:2:2 would be set. Obviously in that case color spaces are +the same. + +Fix that by comparing if both values represent RGB color space. + +Fixes: b21f4b658df8 ("drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi") +Signed-off-by: Jernej Skrabec +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 2115b13676cb..97e5eb0e81cd 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -956,7 +956,8 @@ static void hdmi_video_sample(struct dw_hdmi *hdmi) + + static int is_color_space_conversion(struct dw_hdmi *hdmi) + { +- return hdmi->hdmi_data.enc_in_bus_format != hdmi->hdmi_data.enc_out_bus_format; ++ return hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format) != ++ hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format); + } + + static int is_color_space_decimation(struct dw_hdmi *hdmi) +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0103-TEMP-ASoC-meson-add-initial-aiu-i2s-support.patch b/packages/linux/patches/amlogic/amlogic-0103-TEMP-ASoC-meson-add-initial-aiu-i2s-support.patch deleted file mode 100644 index 8c618cd035..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0103-TEMP-ASoC-meson-add-initial-aiu-i2s-support.patch +++ /dev/null @@ -1,802 +0,0 @@ -From cff0b1db349698d5674edc2bd5f1dbfcfcced024 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 30 Mar 2017 12:17:27 +0200 -Subject: [PATCH 103/187] TEMP: ASoC: meson: add initial aiu i2s support - -Add support for the aiu i2s found on Amlogic Meson SoC family. -With this initial implementation, only playback is supported. -Capture will be part of furture work. - -Signed-off-by: Jerome Brunet ---- - sound/soc/meson-gx/Kconfig | 8 + - sound/soc/meson-gx/Makefile | 3 + - sound/soc/meson-gx/aiu-i2s.c | 749 +++++++++++++++++++++++++++++++++++ - 3 files changed, 760 insertions(+) - create mode 100644 sound/soc/meson-gx/aiu-i2s.c - -diff --git a/sound/soc/meson-gx/Kconfig b/sound/soc/meson-gx/Kconfig -index 280e49e7c16f..8ec683cdf327 100644 ---- a/sound/soc/meson-gx/Kconfig -+++ b/sound/soc/meson-gx/Kconfig -@@ -9,3 +9,11 @@ menuconfig SND_SOC_MESON_GX - select the audio interfaces to support below. This WIP drivers - are kept separated from the actual upstream amlogic ASoC driver - to minimize conflicts until support is submitted and merged -+ -+config SND_SOC_MESON_GX_I2S -+ tristate "Meson i2s interface" -+ depends on SND_SOC_MESON_GX -+ help -+ Say Y or M if you want to add support for i2s driver for Amlogic -+ Meson SoCs. -+ -diff --git a/sound/soc/meson-gx/Makefile b/sound/soc/meson-gx/Makefile -index 6f124c31a85c..02f9c4df6348 100644 ---- a/sound/soc/meson-gx/Makefile -+++ b/sound/soc/meson-gx/Makefile -@@ -1,3 +1,6 @@ - snd-soc-meson-audio-core-objs := audio-core.o -+snd-soc-meson-aiu-i2s-objs := aiu-i2s.o - - obj-$(CONFIG_SND_SOC_MESON_GX) += snd-soc-meson-audio-core.o -+obj-$(CONFIG_SND_SOC_MESON_GX_I2S) += snd-soc-meson-aiu-i2s.o -+ -diff --git a/sound/soc/meson-gx/aiu-i2s.c b/sound/soc/meson-gx/aiu-i2s.c -new file mode 100644 -index 000000000000..63d7821c2c72 ---- /dev/null -+++ b/sound/soc/meson-gx/aiu-i2s.c -@@ -0,0 +1,749 @@ -+/* -+ * Copyright (C) 2017 BayLibre, SAS -+ * Author: Jerome Brunet -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "aiu-regs.h" -+#include "audio-core.h" -+ -+#define DRV_NAME "meson-aiu-i2s" -+ -+struct meson_aiu_i2s { -+ struct meson_audio_core_data *core; -+ struct clk *mclk; -+ struct clk *bclks; -+ struct clk *iface; -+ struct clk *fast; -+ bool bclks_idle; -+ int irq; -+}; -+ -+#define AIU_MEM_I2S_BUF_CNTL_INIT BIT(0) -+#define AIU_MEM_I2S_CONTROL_INIT BIT(0) -+#define AIU_MEM_I2S_CONTROL_FILL_EN BIT(1) -+#define AIU_MEM_I2S_CONTROL_EMPTY_EN BIT(2) -+#define AIU_MEM_I2S_CONTROL_MODE_16BIT BIT(6) -+#define AIU_MEM_I2S_CONTROL_BUSY BIT(7) -+#define AIU_MEM_I2S_CONTROL_DATA_READY BIT(8) -+#define AIU_MEM_I2S_CONTROL_LEVEL_CNTL BIT(9) -+#define AIU_MEM_I2S_MASKS_IRQ_BLOCK_MASK GENMASK(31, 16) -+#define AIU_MEM_I2S_MASKS_IRQ_BLOCK(n) ((n) << 16) -+#define AIU_MEM_I2S_MASKS_CH_MEM_MASK GENMASK(15, 8) -+#define AIU_MEM_I2S_MASKS_CH_MEM(ch) ((ch) << 8) -+#define AIU_MEM_I2S_MASKS_CH_RD_MASK GENMASK(7, 0) -+#define AIU_MEM_I2S_MASKS_CH_RD(ch) ((ch) << 0) -+#define AIU_RST_SOFT_I2S_FAST_DOMAIN BIT(0) -+#define AIU_RST_SOFT_I2S_SLOW_DOMAIN BIT(1) -+ -+/* -+ * The DMA works by i2s "blocks" (or DMA burst). The burst size and the memory -+ * layout expected depends on the mode of operation. -+ * -+ * - Normal mode: The channels are expected to be packed in 32 bytes groups -+ * interleaved the buffer. AIU_MEM_I2S_MASKS_CH_MEM is a bitfield representing -+ * the channels present in memory. AIU_MEM_I2S_MASKS_CH_MEM represents the -+ * channels read by the DMA. This is very flexible but the unsual memory layout -+ * makes it less easy to deal with. The burst size is 32 bytes times the number -+ * of channels read. -+ * -+ * - Split mode: -+ * Classical channel interleaved frame organisation. In this mode, -+ * AIU_MEM_I2S_MASKS_CH_MEM and AIU_MEM_I2S_MASKS_CH_MEM must be set to 0xff and -+ * the burst size is fixed to 256 bytes. The input can be either 2 or 8 -+ * channels. -+ * -+ * The following driver implements the split mode. -+ */ -+ -+#define AIU_I2S_DMA_BURST 256 -+ -+static struct snd_pcm_hardware meson_aiu_i2s_dma_hw = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_PAUSE), -+ -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE), -+ -+ /* -+ * TODO: The DMA can change the endianness, the msb position -+ * and deal with unsigned - support this later on -+ */ -+ -+ .rate_min = 8000, -+ .rate_max = 192000, -+ .channels_min = 2, -+ .channels_max = 8, -+ .period_bytes_min = AIU_I2S_DMA_BURST, -+ .period_bytes_max = AIU_I2S_DMA_BURST * 65535, -+ .periods_min = 2, -+ .periods_max = UINT_MAX, -+ .buffer_bytes_max = 1 * 1024 * 1024, -+ .fifo_size = 0, -+}; -+ -+static struct meson_aiu_i2s *meson_aiu_i2s_dma_priv(struct snd_pcm_substream *s) -+{ -+ struct snd_soc_pcm_runtime *rtd = s->private_data; -+ struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); -+ -+ return snd_soc_component_get_drvdata(component); -+} -+ -+static snd_pcm_uframes_t -+meson_aiu_i2s_dma_pointer(struct snd_pcm_substream *substream) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -+ unsigned int addr; -+ int ret; -+ -+ ret = regmap_read(priv->core->aiu, AIU_MEM_I2S_RD_PTR, -+ &addr); -+ if (ret) -+ return 0; -+ -+ return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr); -+} -+ -+static void __dma_enable(struct meson_aiu_i2s *priv, bool enable) -+{ -+ unsigned int en_mask = (AIU_MEM_I2S_CONTROL_FILL_EN | -+ AIU_MEM_I2S_CONTROL_EMPTY_EN); -+ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, en_mask, -+ enable ? en_mask : 0); -+ -+} -+ -+static int meson_aiu_i2s_dma_trigger(struct snd_pcm_substream *substream, int cmd) -+{ -+ struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ case SNDRV_PCM_TRIGGER_RESUME: -+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: -+ __dma_enable(priv, true); -+ break; -+ case SNDRV_PCM_TRIGGER_SUSPEND: -+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: -+ case SNDRV_PCM_TRIGGER_STOP: -+ __dma_enable(priv, false); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static void __dma_init_mem(struct meson_aiu_i2s *priv) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, -+ AIU_MEM_I2S_CONTROL_INIT, -+ AIU_MEM_I2S_CONTROL_INIT); -+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_BUF_CNTL, -+ AIU_MEM_I2S_BUF_CNTL_INIT, -+ AIU_MEM_I2S_BUF_CNTL_INIT); -+ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, -+ AIU_MEM_I2S_CONTROL_INIT, -+ 0); -+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_BUF_CNTL, -+ AIU_MEM_I2S_BUF_CNTL_INIT, -+ 0); -+} -+ -+static int meson_aiu_i2s_dma_prepare(struct snd_pcm_substream *substream) -+{ -+ struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -+ -+ __dma_init_mem(priv); -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dma_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -+ int ret; -+ u32 burst_num, mem_ctl; -+ dma_addr_t end_ptr; -+ -+ ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); -+ if (ret < 0) -+ return ret; -+ -+ /* Setup memory layout */ -+ if (params_physical_width(params) == 16) -+ mem_ctl = AIU_MEM_I2S_CONTROL_MODE_16BIT; -+ else -+ mem_ctl = 0; -+ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, -+ AIU_MEM_I2S_CONTROL_MODE_16BIT, -+ mem_ctl); -+ -+ /* Initialize memory pointers */ -+ regmap_write(priv->core->aiu, AIU_MEM_I2S_START_PTR, runtime->dma_addr); -+ regmap_write(priv->core->aiu, AIU_MEM_I2S_RD_PTR, runtime->dma_addr); -+ -+ /* The end pointer is the address of the last valid block */ -+ end_ptr = runtime->dma_addr + runtime->dma_bytes - AIU_I2S_DMA_BURST; -+ regmap_write(priv->core->aiu, AIU_MEM_I2S_END_PTR, end_ptr); -+ -+ /* Memory masks */ -+ burst_num = params_period_bytes(params) / AIU_I2S_DMA_BURST; -+ regmap_write(priv->core->aiu, AIU_MEM_I2S_MASKS, -+ AIU_MEM_I2S_MASKS_CH_RD(0xff) | -+ AIU_MEM_I2S_MASKS_CH_MEM(0xff) | -+ AIU_MEM_I2S_MASKS_IRQ_BLOCK(burst_num)); -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dma_hw_free(struct snd_pcm_substream *substream) -+{ -+ return snd_pcm_lib_free_pages(substream); -+} -+ -+ -+static irqreturn_t meson_aiu_i2s_dma_irq_block(int irq, void *dev_id) -+{ -+ struct snd_pcm_substream *playback = dev_id; -+ -+ snd_pcm_period_elapsed(playback); -+ -+ return IRQ_HANDLED; -+} -+ -+static int meson_aiu_i2s_dma_open(struct snd_pcm_substream *substream) -+{ -+ struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -+ int ret; -+ -+ snd_soc_set_runtime_hwparams(substream, &meson_aiu_i2s_dma_hw); -+ -+ /* -+ * Make sure the buffer and period size are multiple of the DMA burst -+ * size -+ */ -+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -+ AIU_I2S_DMA_BURST); -+ if (ret) -+ return ret; -+ -+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -+ AIU_I2S_DMA_BURST); -+ if (ret) -+ return ret; -+ -+ /* Request the I2S DDR irq */ -+ ret = request_irq(priv->irq, meson_aiu_i2s_dma_irq_block, 0, -+ DRV_NAME, substream); -+ if (ret) -+ return ret; -+ -+ /* Power up the i2s fast domain - can't write the registers w/o it */ -+ ret = clk_prepare_enable(priv->fast); -+ if (ret) -+ return ret; -+ -+ /* Make sure the dma is initially disabled */ -+ __dma_enable(priv, false); -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dma_close(struct snd_pcm_substream *substream) -+{ -+ struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -+ -+ clk_disable_unprepare(priv->fast); -+ free_irq(priv->irq, substream); -+ -+ return 0; -+} -+ -+static const struct snd_pcm_ops meson_aiu_i2s_dma_ops = { -+ .open = meson_aiu_i2s_dma_open, -+ .close = meson_aiu_i2s_dma_close, -+ .ioctl = snd_pcm_lib_ioctl, -+ .hw_params = meson_aiu_i2s_dma_hw_params, -+ .hw_free = meson_aiu_i2s_dma_hw_free, -+ .prepare = meson_aiu_i2s_dma_prepare, -+ .pointer = meson_aiu_i2s_dma_pointer, -+ .trigger = meson_aiu_i2s_dma_trigger, -+}; -+ -+static int meson_aiu_i2s_dma_new(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_card *card = rtd->card->snd_card; -+ size_t size = meson_aiu_i2s_dma_hw.buffer_bytes_max; -+ -+ snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, -+ SNDRV_DMA_TYPE_DEV, -+ card->dev, size, size); -+ -+ return 0; -+} -+ -+#define AIU_CLK_CTRL_I2S_DIV_EN BIT(0) -+#define AIU_CLK_CTRL_I2S_DIV_MASK GENMASK(3, 2) -+#define AIU_CLK_CTRL_AOCLK_POLARITY_MASK BIT(6) -+#define AIU_CLK_CTRL_AOCLK_POLARITY_NORMAL (0 << 6) -+#define AIU_CLK_CTRL_AOCLK_POLARITY_INVERTED (1 << 6) -+#define AIU_CLK_CTRL_ALRCLK_POLARITY_MASK BIT(7) -+#define AIU_CLK_CTRL_ALRCLK_POLARITY_NORMAL (0 << 7) -+#define AIU_CLK_CTRL_ALRCLK_POLARITY_INVERTED (1 << 7) -+#define AIU_CLK_CTRL_ALRCLK_SKEW_MASK GENMASK(9, 8) -+#define AIU_CLK_CTRL_ALRCLK_LEFT_J (0 << 8) -+#define AIU_CLK_CTRL_ALRCLK_I2S (1 << 8) -+#define AIU_CLK_CTRL_ALRCLK_RIGHT_J (2 << 8) -+#define AIU_CLK_CTRL_MORE_I2S_DIV_MASK GENMASK(5, 0) -+#define AIU_CLK_CTRL_MORE_I2S_DIV(div) (((div) - 1) << 0) -+#define AIU_CODEC_DAC_LRCLK_CTRL_DIV_MASK GENMASK(11, 0) -+#define AIU_CODEC_DAC_LRCLK_CTRL_DIV(div) (((div) - 1) << 0) -+#define AIU_I2S_DAC_CFG_PAYLOAD_SIZE_MASK GENMASK(1, 0) -+#define AIU_I2S_DAC_CFG_AOCLK_32 (0 << 0) -+#define AIU_I2S_DAC_CFG_AOCLK_48 (2 << 0) -+#define AIU_I2S_DAC_CFG_AOCLK_64 (3 << 0) -+#define AIU_I2S_MISC_HOLD_EN BIT(2) -+#define AIU_I2S_SOURCE_DESC_MODE_8CH BIT(0) -+#define AIU_I2S_SOURCE_DESC_MODE_24BIT BIT(5) -+#define AIU_I2S_SOURCE_DESC_MODE_32BIT BIT(9) -+#define AIU_I2S_SOURCE_DESC_MODE_SPLIT BIT(11) -+ -+static void __hold(struct meson_aiu_i2s *priv, bool enable) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_I2S_MISC, -+ AIU_I2S_MISC_HOLD_EN, -+ enable ? AIU_I2S_MISC_HOLD_EN : 0); -+} -+ -+static void __divider_enable(struct meson_aiu_i2s *priv, bool enable) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL, -+ AIU_CLK_CTRL_I2S_DIV_EN, -+ enable ? AIU_CLK_CTRL_I2S_DIV_EN : 0); -+} -+ -+static void __playback_start(struct meson_aiu_i2s *priv) -+{ -+ __divider_enable(priv, true); -+ __hold(priv, false); -+} -+ -+static void __playback_stop(struct meson_aiu_i2s *priv, bool clk_force) -+{ -+ __hold(priv, true); -+ /* Disable the bit clks if necessary */ -+ if (clk_force || !priv->bclks_idle) -+ __divider_enable(priv, false); -+} -+ -+static int meson_aiu_i2s_dai_trigger(struct snd_pcm_substream *substream, int cmd, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_i2s *priv = snd_soc_dai_get_drvdata(dai); -+ bool clk_force_stop = false; -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ case SNDRV_PCM_TRIGGER_RESUME: -+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: -+ __playback_start(priv); -+ return 0; -+ -+ case SNDRV_PCM_TRIGGER_STOP: -+ case SNDRV_PCM_TRIGGER_SUSPEND: -+ clk_force_stop = true; -+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: -+ __playback_stop(priv, clk_force_stop); -+ return 0; -+ -+ default: -+ return -EINVAL; -+ } -+} -+ -+static int __bclks_set_rate(struct meson_aiu_i2s *priv, unsigned int srate, -+ unsigned int width) -+{ -+ unsigned int fs; -+ -+ /* Get the oversampling factor */ -+ fs = DIV_ROUND_CLOSEST(clk_get_rate(priv->mclk), srate); -+ -+ /* -+ * This DAI is usually connected to the dw-hdmi which does not support -+ * bclk being 32 * lrclk or 48 * lrclk -+ * Restrict to blck = 64 * lrclk -+ */ -+ if (fs % 64) -+ return -EINVAL; -+ -+ /* Set the divider between lrclk and bclk */ -+ regmap_update_bits(priv->core->aiu, AIU_I2S_DAC_CFG, -+ AIU_I2S_DAC_CFG_PAYLOAD_SIZE_MASK, -+ AIU_I2S_DAC_CFG_AOCLK_64); -+ -+ regmap_update_bits(priv->core->aiu, AIU_CODEC_DAC_LRCLK_CTRL, -+ AIU_CODEC_DAC_LRCLK_CTRL_DIV_MASK, -+ AIU_CODEC_DAC_LRCLK_CTRL_DIV(64)); -+ -+ /* Use CLK_MORE for the i2s divider */ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL, -+ AIU_CLK_CTRL_I2S_DIV_MASK, -+ 0); -+ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL_MORE, -+ AIU_CLK_CTRL_MORE_I2S_DIV_MASK, -+ AIU_CLK_CTRL_MORE_I2S_DIV(fs / 64)); -+ -+ return 0; -+} -+ -+static int __setup_desc(struct meson_aiu_i2s *priv, unsigned int width, -+ unsigned int channels) -+{ -+ u32 desc = 0; -+ -+ switch (width) { -+ case 24: -+ /* -+ * For some reason, 24 bits wide audio don't play well -+ * if the 32 bits mode is not set -+ */ -+ desc |= (AIU_I2S_SOURCE_DESC_MODE_24BIT | -+ AIU_I2S_SOURCE_DESC_MODE_32BIT); -+ break; -+ case 16: -+ break; -+ -+ default: -+ return -EINVAL; -+ } -+ -+ switch (channels) { -+ case 2: /* Nothing to do */ -+ break; -+ case 8: -+ /* TODO: Still requires testing ... */ -+ desc |= AIU_I2S_SOURCE_DESC_MODE_8CH; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ regmap_update_bits(priv->core->aiu, AIU_I2S_SOURCE_DESC, -+ AIU_I2S_SOURCE_DESC_MODE_8CH | -+ AIU_I2S_SOURCE_DESC_MODE_24BIT | -+ AIU_I2S_SOURCE_DESC_MODE_32BIT, -+ desc); -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dai_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_i2s *priv = snd_soc_dai_get_drvdata(dai); -+ unsigned int width = params_width(params); -+ unsigned int channels = params_channels(params); -+ unsigned int rate = params_rate(params); -+ int ret; -+ -+ ret = __setup_desc(priv, width, channels); -+ if (ret) { -+ dev_err(dai->dev, "Unable set to set i2s description\n"); -+ return ret; -+ } -+ -+ ret = __bclks_set_rate(priv, rate, width); -+ if (ret) { -+ dev_err(dai->dev, "Unable set to the i2s clock rates\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) -+{ -+ struct meson_aiu_i2s *priv = snd_soc_dai_get_drvdata(dai); -+ u32 val; -+ -+ if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) -+ return -EINVAL; -+ -+ /* DAI output mode */ -+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { -+ case SND_SOC_DAIFMT_I2S: -+ val = AIU_CLK_CTRL_ALRCLK_I2S; -+ break; -+ case SND_SOC_DAIFMT_LEFT_J: -+ val = AIU_CLK_CTRL_ALRCLK_LEFT_J; -+ break; -+ case SND_SOC_DAIFMT_RIGHT_J: -+ val = AIU_CLK_CTRL_ALRCLK_RIGHT_J; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL, -+ AIU_CLK_CTRL_ALRCLK_SKEW_MASK, -+ val); -+ -+ /* DAI clock polarity */ -+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { -+ case SND_SOC_DAIFMT_IB_IF: -+ /* Invert both clocks */ -+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_INVERTED | -+ AIU_CLK_CTRL_AOCLK_POLARITY_INVERTED; -+ break; -+ case SND_SOC_DAIFMT_IB_NF: -+ /* Invert bit clock */ -+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_NORMAL | -+ AIU_CLK_CTRL_AOCLK_POLARITY_INVERTED; -+ break; -+ case SND_SOC_DAIFMT_NB_IF: -+ /* Invert frame clock */ -+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_INVERTED | -+ AIU_CLK_CTRL_AOCLK_POLARITY_NORMAL; -+ break; -+ case SND_SOC_DAIFMT_NB_NF: -+ /* Normal clocks */ -+ val = AIU_CLK_CTRL_ALRCLK_POLARITY_NORMAL | -+ AIU_CLK_CTRL_AOCLK_POLARITY_NORMAL; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL, -+ AIU_CLK_CTRL_ALRCLK_POLARITY_MASK | -+ AIU_CLK_CTRL_AOCLK_POLARITY_MASK, -+ val); -+ -+ switch (fmt & SND_SOC_DAIFMT_CLOCK_MASK) { -+ case SND_SOC_DAIFMT_CONT: -+ priv->bclks_idle = true; -+ break; -+ case SND_SOC_DAIFMT_GATED: -+ priv->bclks_idle = false; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, -+ unsigned int freq, int dir) -+{ -+ struct meson_aiu_i2s *priv = snd_soc_dai_get_drvdata(dai); -+ int ret; -+ -+ if (WARN_ON(clk_id != 0)) -+ return -EINVAL; -+ -+ if (dir == SND_SOC_CLOCK_IN) -+ return 0; -+ -+ ret = clk_set_rate(priv->mclk, freq); -+ if (ret) { -+ dev_err(dai->dev, "Failed to set sysclk to %uHz", freq); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int meson_aiu_i2s_dai_startup(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_i2s *priv = snd_soc_dai_get_drvdata(dai); -+ int ret; -+ -+ /* Power up the i2s fast domain - can't write the registers w/o it */ -+ ret = clk_prepare_enable(priv->fast); -+ if (ret) -+ goto out_clk_fast; -+ -+ /* Make sure nothing gets out of the DAI yet */ -+ __hold(priv, true); -+ -+ /* I2S encoder needs the mixer interface gate */ -+ ret = clk_prepare_enable(priv->iface); -+ if (ret) -+ goto out_clk_iface; -+ -+ /* Enable the i2s master clock */ -+ ret = clk_prepare_enable(priv->mclk); -+ if (ret) -+ goto out_mclk; -+ -+ /* Enable the bit clock gate */ -+ ret = clk_prepare_enable(priv->bclks); -+ if (ret) -+ goto out_bclks; -+ -+ /* Make sure the interface expect a memory layout we can work with */ -+ regmap_update_bits(priv->core->aiu, AIU_I2S_SOURCE_DESC, -+ AIU_I2S_SOURCE_DESC_MODE_SPLIT, -+ AIU_I2S_SOURCE_DESC_MODE_SPLIT); -+ -+ return 0; -+ -+out_bclks: -+ clk_disable_unprepare(priv->mclk); -+out_mclk: -+ clk_disable_unprepare(priv->iface); -+out_clk_iface: -+ clk_disable_unprepare(priv->fast); -+out_clk_fast: -+ return ret; -+} -+ -+static void meson_aiu_i2s_dai_shutdown(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_i2s *priv = snd_soc_dai_get_drvdata(dai); -+ -+ clk_disable_unprepare(priv->bclks); -+ clk_disable_unprepare(priv->mclk); -+ clk_disable_unprepare(priv->iface); -+ clk_disable_unprepare(priv->fast); -+} -+ -+static const struct snd_soc_dai_ops meson_aiu_i2s_dai_ops = { -+ .startup = meson_aiu_i2s_dai_startup, -+ .shutdown = meson_aiu_i2s_dai_shutdown, -+ .trigger = meson_aiu_i2s_dai_trigger, -+ .hw_params = meson_aiu_i2s_dai_hw_params, -+ .set_fmt = meson_aiu_i2s_dai_set_fmt, -+ .set_sysclk = meson_aiu_i2s_dai_set_sysclk, -+}; -+ -+static struct snd_soc_dai_driver meson_aiu_i2s_dai = { -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 8, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE) -+ }, -+ .ops = &meson_aiu_i2s_dai_ops, -+}; -+ -+static const struct snd_soc_component_driver meson_aiu_i2s_component = { -+ .ops = &meson_aiu_i2s_dma_ops, -+ .pcm_new = meson_aiu_i2s_dma_new, -+ .name = DRV_NAME, -+}; -+ -+static int meson_aiu_i2s_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct meson_aiu_i2s *priv; -+ -+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, priv); -+ priv->core = dev_get_drvdata(dev->parent); -+ -+ priv->fast = devm_clk_get(dev, "fast"); -+ if (IS_ERR(priv->fast)) { -+ if (PTR_ERR(priv->fast) != -EPROBE_DEFER) -+ dev_err(dev, "Can't get the i2s fast domain clock\n"); -+ return PTR_ERR(priv->fast); -+ } -+ -+ priv->iface = devm_clk_get(dev, "iface"); -+ if (IS_ERR(priv->iface)) { -+ if (PTR_ERR(priv->iface) != -EPROBE_DEFER) -+ dev_err(dev, "Can't get i2s dai clock gate\n"); -+ return PTR_ERR(priv->iface); -+ } -+ -+ priv->bclks = devm_clk_get(dev, "bclks"); -+ if (IS_ERR(priv->bclks)) { -+ if (PTR_ERR(priv->bclks) != -EPROBE_DEFER) -+ dev_err(dev, "Can't get bit clocks gate\n"); -+ return PTR_ERR(priv->bclks); -+ } -+ -+ priv->mclk = devm_clk_get(dev, "mclk"); -+ if (IS_ERR(priv->mclk)) { -+ if (PTR_ERR(priv->mclk) != -EPROBE_DEFER) -+ dev_err(dev, "failed to get the i2s master clock\n"); -+ return PTR_ERR(priv->mclk); -+ } -+ -+ priv->irq = platform_get_irq(pdev, 0); -+ if (priv->irq <= 0) { -+ dev_err(dev, "Can't get i2s ddr irq\n"); -+ return priv->irq; -+ } -+ -+ return devm_snd_soc_register_component(dev, &meson_aiu_i2s_component, -+ &meson_aiu_i2s_dai, 1); -+} -+ -+static const struct of_device_id meson_aiu_i2s_of_match[] = { -+ { .compatible = "amlogic,meson-aiu-i2s", }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, meson_aiu_i2s_of_match); -+ -+static struct platform_driver meson_aiu_i2s_pdrv = { -+ .probe = meson_aiu_i2s_probe, -+ .driver = { -+ .name = DRV_NAME, -+ .of_match_table = meson_aiu_i2s_of_match, -+ }, -+}; -+module_platform_driver(meson_aiu_i2s_pdrv); -+ -+MODULE_DESCRIPTION("Meson AIU i2s ASoC Driver"); -+MODULE_AUTHOR("Jerome Brunet "); -+MODULE_LICENSE("GPL v2"); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0104-FROMLIST-drm-bridge-dw-hdmi-do-not-force-none-scan-m.patch b/packages/linux/patches/amlogic/amlogic-0104-FROMLIST-drm-bridge-dw-hdmi-do-not-force-none-scan-m.patch new file mode 100644 index 0000000000..025cff0fd7 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0104-FROMLIST-drm-bridge-dw-hdmi-do-not-force-none-scan-m.patch @@ -0,0 +1,36 @@ +From ead734fa3522fd224e9ad975206ee4784b64add5 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 1 Mar 2020 16:47:42 +0000 +Subject: [PATCH 104/146] FROMLIST: drm/bridge: dw-hdmi: do not force "none" + scan mode + +Setting scan mode to "none" confuses some TVs like LG B8, which randomly +change overscan procentage over time. Digital outputs like HDMI and DVI, +handled by this controller, don't really need overscan, so we can always +set scan mode to underscan. Actually, this is exactly what +drm_hdmi_avi_infoframe_from_display_mode() already does, so we can just +remove offending line. + +Signed-off-by: Jonas Karlman +[updated commit message] +Signed-off-by: Jernej Skrabec +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 97e5eb0e81cd..664e3c5cd5b5 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1655,8 +1655,6 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; + } + +- frame.scan_mode = HDMI_SCAN_MODE_NONE; +- + /* + * The Designware IP uses a different byte format from standard + * AVI info frames, though generally the bits are in the correct +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0104-TEMP-ASoC-meson-add-initial-spdif-support.patch b/packages/linux/patches/amlogic/amlogic-0104-TEMP-ASoC-meson-add-initial-spdif-support.patch deleted file mode 100644 index 75a7c96fe5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0104-TEMP-ASoC-meson-add-initial-spdif-support.patch +++ /dev/null @@ -1,726 +0,0 @@ -From fdcb2c39d1ddefcb74d91e573fb6f71f9f8e4c7f Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 30 Mar 2017 13:46:03 +0200 -Subject: [PATCH 104/187] TEMP: ASoC: meson: add initial spdif support - -Add support for the spdif found on Amlogic Meson SoC family. -With this initial implementation, only uncompressed pcm playback -from the spdif dma is supported. Future work will add compressed -support, pcm playback from i2s dma and capture. - -Signed-off-by: Jerome Brunet ---- - sound/soc/meson-gx/Kconfig | 7 + - sound/soc/meson-gx/Makefile | 3 +- - sound/soc/meson-gx/aiu-spdif.c | 671 +++++++++++++++++++++++++++++++++ - 3 files changed, 680 insertions(+), 1 deletion(-) - create mode 100644 sound/soc/meson-gx/aiu-spdif.c - -diff --git a/sound/soc/meson-gx/Kconfig b/sound/soc/meson-gx/Kconfig -index 8ec683cdf327..141afabfacea 100644 ---- a/sound/soc/meson-gx/Kconfig -+++ b/sound/soc/meson-gx/Kconfig -@@ -17,3 +17,10 @@ config SND_SOC_MESON_GX_I2S - Say Y or M if you want to add support for i2s driver for Amlogic - Meson SoCs. - -+config SND_SOC_MESON_GX_SPDIF -+ tristate "Meson spdif interface" -+ depends on SND_SOC_MESON_GX -+ select SND_PCM_IEC958 -+ help -+ Say Y or M if you want to add support for spdif driver for Amlogic -+ Meson SoCs. -diff --git a/sound/soc/meson-gx/Makefile b/sound/soc/meson-gx/Makefile -index 02f9c4df6348..d37672ebe57b 100644 ---- a/sound/soc/meson-gx/Makefile -+++ b/sound/soc/meson-gx/Makefile -@@ -1,6 +1,7 @@ - snd-soc-meson-audio-core-objs := audio-core.o - snd-soc-meson-aiu-i2s-objs := aiu-i2s.o -+snd-soc-meson-aiu-spdif-objs := aiu-spdif.o - - obj-$(CONFIG_SND_SOC_MESON_GX) += snd-soc-meson-audio-core.o - obj-$(CONFIG_SND_SOC_MESON_GX_I2S) += snd-soc-meson-aiu-i2s.o -- -+obj-$(CONFIG_SND_SOC_MESON_GX_SPDIF) += snd-soc-meson-aiu-spdif.o -diff --git a/sound/soc/meson-gx/aiu-spdif.c b/sound/soc/meson-gx/aiu-spdif.c -new file mode 100644 -index 000000000000..748a9b1d680c ---- /dev/null -+++ b/sound/soc/meson-gx/aiu-spdif.c -@@ -0,0 +1,671 @@ -+/* -+ * Copyright (C) 2017 BayLibre, SAS -+ * Author: Jerome Brunet -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "aiu-regs.h" -+#include "audio-core.h" -+ -+#define DRV_NAME "meson-aiu-spdif" -+ -+struct meson_aiu_spdif { -+ struct meson_audio_core_data *core; -+ struct clk *iface; -+ struct clk *fast; -+ struct clk *mclk_i958; -+ struct clk *mclk; -+ int irq; -+}; -+ -+ -+#define AIU_958_DCU_FF_CTRL_EN BIT(0) -+#define AIU_958_DCU_FF_CTRL_AUTO_DISABLE BIT(1) -+#define AIU_958_DCU_FF_CTRL_IRQ_MODE_MASK GENMASK(3, 2) -+#define AIU_958_DCU_FF_CTRL_IRQ_OUT_THD BIT(2) -+#define AIU_958_DCU_FF_CTRL_IRQ_FRAME_READ BIT(3) -+#define AIU_958_DCU_FF_CTRL_SYNC_HEAD_EN BIT(4) -+#define AIU_958_DCU_FF_CTRL_BYTE_SEEK BIT(5) -+#define AIU_958_DCU_FF_CTRL_CONTINUE BIT(6) -+#define AIU_MEM_IEC958_BUF_CNTL_INIT BIT(0) -+#define AIU_MEM_IEC958_CONTROL_INIT BIT(0) -+#define AIU_MEM_IEC958_CONTROL_FILL_EN BIT(1) -+#define AIU_MEM_IEC958_CONTROL_EMPTY_EN BIT(2) -+#define AIU_MEM_IEC958_CONTROL_ENDIAN_MASK GENMASK(5, 3) -+#define AIU_MEM_IEC958_CONTROL_RD_DDR BIT(6) -+#define AIU_MEM_IEC958_CONTROL_MODE_16BIT BIT(7) -+#define AIU_MEM_IEC958_MASKS_CH_MEM_MASK GENMASK(15, 8) -+#define AIU_MEM_IEC958_MASKS_CH_MEM(ch) ((ch) << 8) -+#define AIU_MEM_IEC958_MASKS_CH_RD_MASK GENMASK(7, 0) -+#define AIU_MEM_IEC958_MASKS_CH_RD(ch) ((ch) << 0) -+ -+#define AIU_SPDIF_DMA_BURST 8 -+#define AIU_SPDIF_BPF_MAX USHRT_MAX -+ -+static struct snd_pcm_hardware meson_aiu_spdif_dma_hw = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_PAUSE), -+ -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE), -+ -+ .rates = (SNDRV_PCM_RATE_32000 | -+ SNDRV_PCM_RATE_44100 | -+ SNDRV_PCM_RATE_48000 | -+ SNDRV_PCM_RATE_96000 | -+ SNDRV_PCM_RATE_192000), -+ /* -+ * TODO: The DMA can change the endianness, the msb position -+ * and deal with unsigned - support this later on -+ */ -+ -+ .channels_min = 2, -+ .channels_max = 2, -+ .period_bytes_min = AIU_SPDIF_DMA_BURST, -+ .period_bytes_max = AIU_SPDIF_BPF_MAX, -+ .periods_min = 2, -+ .periods_max = UINT_MAX, -+ .buffer_bytes_max = 1 * 1024 * 1024, -+ .fifo_size = 0, -+}; -+ -+static struct meson_aiu_spdif *meson_aiu_spdif_dma_priv(struct snd_pcm_substream *s) -+{ -+ struct snd_soc_pcm_runtime *rtd = s->private_data; -+ struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); -+ -+ return snd_soc_component_get_drvdata(component); -+} -+ -+static snd_pcm_uframes_t -+meson_aiu_spdif_dma_pointer(struct snd_pcm_substream *substream) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ struct meson_aiu_spdif *priv = meson_aiu_spdif_dma_priv(substream); -+ unsigned int addr; -+ int ret; -+ -+ ret = regmap_read(priv->core->aiu, AIU_MEM_IEC958_RD_PTR, -+ &addr); -+ if (ret) -+ return 0; -+ -+ return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr); -+} -+ -+static void __dma_enable(struct meson_aiu_spdif *priv, bool enable) -+{ -+ unsigned int en_mask = (AIU_MEM_IEC958_CONTROL_FILL_EN | -+ AIU_MEM_IEC958_CONTROL_EMPTY_EN); -+ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL, en_mask, -+ enable ? en_mask : 0); -+} -+ -+static void __dcu_fifo_enable(struct meson_aiu_spdif *priv, bool enable) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_958_DCU_FF_CTRL, -+ AIU_958_DCU_FF_CTRL_EN, -+ enable ? AIU_958_DCU_FF_CTRL_EN : 0); -+} -+ -+static int meson_aiu_spdif_dma_trigger(struct snd_pcm_substream *substream, int cmd) -+{ -+ struct meson_aiu_spdif *priv = meson_aiu_spdif_dma_priv(substream); -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ case SNDRV_PCM_TRIGGER_RESUME: -+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: -+ __dcu_fifo_enable(priv, true); -+ __dma_enable(priv, true); -+ break; -+ case SNDRV_PCM_TRIGGER_SUSPEND: -+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: -+ case SNDRV_PCM_TRIGGER_STOP: -+ __dma_enable(priv, false); -+ __dcu_fifo_enable(priv, false); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static void __dma_init_mem(struct meson_aiu_spdif *priv) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL, -+ AIU_MEM_IEC958_CONTROL_INIT, -+ AIU_MEM_IEC958_CONTROL_INIT); -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_BUF_CNTL, -+ AIU_MEM_IEC958_BUF_CNTL_INIT, -+ AIU_MEM_IEC958_BUF_CNTL_INIT); -+ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL, -+ AIU_MEM_IEC958_CONTROL_INIT, -+ 0); -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_BUF_CNTL, -+ AIU_MEM_IEC958_BUF_CNTL_INIT, -+ 0); -+} -+ -+static int meson_aiu_spdif_dma_prepare(struct snd_pcm_substream *substream) -+{ -+ struct meson_aiu_spdif *priv = meson_aiu_spdif_dma_priv(substream); -+ -+ __dma_init_mem(priv); -+ -+ return 0; -+} -+ -+static int __setup_memory_layout(struct meson_aiu_spdif *priv, -+ unsigned int width) -+{ -+ u32 mem_ctl = AIU_MEM_IEC958_CONTROL_RD_DDR; -+ -+ if (width == 16) -+ mem_ctl |= AIU_MEM_IEC958_CONTROL_MODE_16BIT; -+ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL, -+ AIU_MEM_IEC958_CONTROL_ENDIAN_MASK | -+ AIU_MEM_IEC958_CONTROL_MODE_16BIT | -+ AIU_MEM_IEC958_CONTROL_RD_DDR, -+ mem_ctl); -+ -+ return 0; -+} -+ -+static int meson_aiu_spdif_dma_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ struct meson_aiu_spdif *priv = meson_aiu_spdif_dma_priv(substream); -+ int ret; -+ dma_addr_t end_ptr; -+ -+ ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); -+ if (ret < 0) -+ return ret; -+ -+ ret = __setup_memory_layout(priv, params_physical_width(params)); -+ if (ret) -+ return ret; -+ -+ /* Initialize memory pointers */ -+ regmap_write(priv->core->aiu, -+ AIU_MEM_IEC958_START_PTR, runtime->dma_addr); -+ regmap_write(priv->core->aiu, -+ AIU_MEM_IEC958_RD_PTR, runtime->dma_addr); -+ -+ /* The end pointer is the address of the last valid block */ -+ end_ptr = runtime->dma_addr + runtime->dma_bytes - AIU_SPDIF_DMA_BURST; -+ regmap_write(priv->core->aiu, AIU_MEM_IEC958_END_PTR, end_ptr); -+ -+ /* Memory masks */ -+ regmap_write(priv->core->aiu, AIU_MEM_IEC958_MASKS, -+ AIU_MEM_IEC958_MASKS_CH_RD(0xff) | -+ AIU_MEM_IEC958_MASKS_CH_MEM(0xff)); -+ -+ /* Setup the number bytes read by the FIFO between each IRQ */ -+ regmap_write(priv->core->aiu, AIU_958_BPF, params_period_bytes(params)); -+ -+ /* -+ * AUTO_DISABLE and SYNC_HEAD are enabled by default but -+ * this should be disabled in PCM (uncompressed) mode -+ */ -+ regmap_update_bits(priv->core->aiu, AIU_958_DCU_FF_CTRL, -+ AIU_958_DCU_FF_CTRL_AUTO_DISABLE | -+ AIU_958_DCU_FF_CTRL_IRQ_MODE_MASK | -+ AIU_958_DCU_FF_CTRL_SYNC_HEAD_EN, -+ AIU_958_DCU_FF_CTRL_IRQ_FRAME_READ); -+ -+ return 0; -+} -+ -+static int meson_aiu_spdif_dma_hw_free(struct snd_pcm_substream *substream) -+{ -+ return snd_pcm_lib_free_pages(substream); -+} -+ -+static irqreturn_t meson_aiu_spdif_dma_irq(int irq, void *dev_id) -+{ -+ struct snd_pcm_substream *playback = dev_id; -+ -+ snd_pcm_period_elapsed(playback); -+ -+ return IRQ_HANDLED; -+} -+ -+static int meson_aiu_spdif_dma_open(struct snd_pcm_substream *substream) -+{ -+ struct meson_aiu_spdif *priv = meson_aiu_spdif_dma_priv(substream); -+ int ret; -+ -+ snd_soc_set_runtime_hwparams(substream, &meson_aiu_spdif_dma_hw); -+ -+ /* -+ * Make sure the buffer and period size are multiple of the DMA burst -+ * size -+ */ -+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -+ AIU_SPDIF_DMA_BURST); -+ if (ret) -+ return ret; -+ -+ ret = snd_pcm_hw_constraint_step(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -+ AIU_SPDIF_DMA_BURST); -+ if (ret) -+ return ret; -+ -+ /* Request the SPDIF DDR irq */ -+ ret = request_irq(priv->irq, meson_aiu_spdif_dma_irq, 0, -+ DRV_NAME, substream); -+ if (ret) -+ return ret; -+ -+ /* Power up the spdif fast domain - can't write the register w/o it */ -+ ret = clk_prepare_enable(priv->fast); -+ if (ret) -+ return ret; -+ -+ /* Make sure the dma is initially halted */ -+ __dma_enable(priv, false); -+ __dcu_fifo_enable(priv, false); -+ -+ return 0; -+} -+ -+static int meson_aiu_spdif_dma_close(struct snd_pcm_substream *substream) -+{ -+ struct meson_aiu_spdif *priv = meson_aiu_spdif_dma_priv(substream); -+ -+ clk_disable_unprepare(priv->fast); -+ free_irq(priv->irq, substream); -+ -+ return 0; -+} -+ -+static const struct snd_pcm_ops meson_aiu_spdif_dma_ops = { -+ .open = meson_aiu_spdif_dma_open, -+ .close = meson_aiu_spdif_dma_close, -+ .ioctl = snd_pcm_lib_ioctl, -+ .hw_params = meson_aiu_spdif_dma_hw_params, -+ .hw_free = meson_aiu_spdif_dma_hw_free, -+ .prepare = meson_aiu_spdif_dma_prepare, -+ .pointer = meson_aiu_spdif_dma_pointer, -+ .trigger = meson_aiu_spdif_dma_trigger, -+}; -+ -+static int meson_aiu_spdif_dma_new(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_card *card = rtd->card->snd_card; -+ size_t size = meson_aiu_spdif_dma_hw.buffer_bytes_max; -+ -+ snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, -+ SNDRV_DMA_TYPE_DEV, -+ card->dev, size, size); -+ -+ return 0; -+} -+ -+#define AIU_CLK_CTRL_958_DIV_EN BIT(1) -+#define AIU_CLK_CTRL_958_DIV_MASK GENMASK(5, 4) -+#define AIU_CLK_CTRL_958_DIV_MORE BIT(12) -+#define AIU_MEM_IEC958_CONTROL_MODE_LINEAR BIT(8) -+#define AIU_958_CTRL_HOLD_EN BIT(0) -+#define AIU_958_MISC_NON_PCM BIT(0) -+#define AIU_958_MISC_MODE_16BITS BIT(1) -+#define AIU_958_MISC_16BITS_ALIGN_MASK GENMASK(6, 5) -+#define AIU_958_MISC_16BITS_ALIGN(val) ((val) << 5) -+#define AIU_958_MISC_MODE_32BITS BIT(7) -+#define AIU_958_MISC_32BITS_SHIFT_MASK GENMASK(10, 8) -+#define AIU_958_MISC_32BITS_SHIFT(val) ((val) << 8) -+#define AIU_958_MISC_U_FROM_STREAM BIT(12) -+#define AIU_958_MISC_FORCE_LR BIT(13) -+ -+#define AIU_CS_WORD_LEN 4 -+ -+static void __hold(struct meson_aiu_spdif *priv, bool enable) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_958_CTRL, -+ AIU_958_CTRL_HOLD_EN, -+ enable ? AIU_958_CTRL_HOLD_EN : 0); -+} -+ -+static void __divider_enable(struct meson_aiu_spdif *priv, bool enable) -+{ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL, -+ AIU_CLK_CTRL_958_DIV_EN, -+ enable ? AIU_CLK_CTRL_958_DIV_EN : 0); -+} -+ -+static void __playback_start(struct meson_aiu_spdif *priv) -+{ -+ __divider_enable(priv, true); -+ __hold(priv, false); -+} -+ -+static void __playback_stop(struct meson_aiu_spdif *priv) -+{ -+ __hold(priv, true); -+ __divider_enable(priv, false); -+} -+ -+static int meson_aiu_spdif_dai_trigger(struct snd_pcm_substream *substream, int cmd, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_spdif *priv = snd_soc_dai_get_drvdata(dai); -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ case SNDRV_PCM_TRIGGER_RESUME: -+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: -+ __playback_start(priv); -+ return 0; -+ -+ case SNDRV_PCM_TRIGGER_STOP: -+ case SNDRV_PCM_TRIGGER_SUSPEND: -+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: -+ __playback_stop(priv); -+ return 0; -+ -+ default: -+ return -EINVAL; -+ } -+} -+ -+static int __setup_spdif_clk(struct meson_aiu_spdif *priv, unsigned int rate) -+{ -+ unsigned int mrate; -+ -+ /* Leave the internal divisor alone */ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL, -+ AIU_CLK_CTRL_958_DIV_MASK | -+ AIU_CLK_CTRL_958_DIV_MORE, -+ 0); -+ -+ /* 2 * 32bits per subframe * 2 channels = 128 */ -+ mrate = rate * 128; -+ return clk_set_rate(priv->mclk, mrate); -+} -+ -+static int __setup_cs_word(struct meson_aiu_spdif *priv, -+ struct snd_pcm_hw_params *params) -+{ -+ u8 cs[AIU_CS_WORD_LEN]; -+ u32 val; -+ int ret; -+ -+ ret = snd_pcm_create_iec958_consumer_hw_params(params, cs, -+ AIU_CS_WORD_LEN); -+ if (ret < 0) -+ return -EINVAL; -+ -+ /* Write the 1st half word */ -+ val = cs[1] | cs[0] << 8; -+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_L0, val); -+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_R0, val); -+ -+ /* Write the 2nd half word */ -+ val = cs[3] | cs[2] << 8; -+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_L1, val); -+ regmap_write(priv->core->aiu, AIU_958_CHSTAT_R1, val); -+ -+ return 0; -+} -+ -+static int __setup_pcm_fmt(struct meson_aiu_spdif *priv, -+ unsigned int width) -+{ -+ u32 val = 0; -+ -+ switch (width) { -+ case 16: -+ val |= AIU_958_MISC_MODE_16BITS; -+ val |= AIU_958_MISC_16BITS_ALIGN(2); -+ break; -+ case 32: -+ case 24: -+ /* -+ * Looks like this should only be set for 32bits mode, but the -+ * vendor kernel sets it like this for 24bits as well, let's -+ * try and see -+ */ -+ val |= AIU_958_MISC_MODE_32BITS; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ /* No idea what this actually does, copying the vendor kernel for now */ -+ val |= AIU_958_MISC_FORCE_LR; -+ val |= AIU_958_MISC_U_FROM_STREAM; -+ -+ regmap_update_bits(priv->core->aiu, AIU_958_MISC, -+ AIU_958_MISC_NON_PCM | -+ AIU_958_MISC_MODE_16BITS | -+ AIU_958_MISC_16BITS_ALIGN_MASK | -+ AIU_958_MISC_MODE_32BITS | -+ AIU_958_MISC_FORCE_LR, -+ val); -+ -+ return 0; -+} -+ -+static int meson_aiu_spdif_dai_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_spdif *priv = snd_soc_dai_get_drvdata(dai); -+ int ret; -+ -+ ret = __setup_spdif_clk(priv, params_rate(params)); -+ if (ret) { -+ dev_err(dai->dev, "Unable to set the spdif clock\n"); -+ return ret; -+ } -+ -+ ret = __setup_cs_word(priv, params); -+ if (ret) { -+ dev_err(dai->dev, "Unable to set the channel status word\n"); -+ return ret; -+ } -+ -+ ret = __setup_pcm_fmt(priv, params_width(params)); -+ if (ret) { -+ dev_err(dai->dev, "Unable to set the pcm format\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int meson_aiu_spdif_dai_startup(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_spdif *priv = snd_soc_dai_get_drvdata(dai); -+ int ret; -+ -+ /* Power up the spdif fast domain - can't write the registers w/o it */ -+ ret = clk_prepare_enable(priv->fast); -+ if (ret) -+ goto out_clk_fast; -+ -+ /* Make sure nothing gets out of the DAI yet*/ -+ __hold(priv, true); -+ -+ ret = clk_set_parent(priv->mclk, priv->mclk_i958); -+ if (ret) -+ return ret; -+ -+ /* Enable the clock gate */ -+ ret = clk_prepare_enable(priv->iface); -+ if (ret) -+ goto out_clk_iface; -+ -+ /* Enable the spdif clock */ -+ ret = clk_prepare_enable(priv->mclk); -+ if (ret) -+ goto out_mclk; -+ -+ /* -+ * Make sure the interface expect a memory layout we can work with -+ * MEM prefixed register usually belong to the DMA, but when the spdif -+ * DAI takes data from the i2s buffer, we need to make sure it works in -+ * split mode and not the "normal mode" (channel samples packed in -+ * 32 bytes groups) -+ */ -+ regmap_update_bits(priv->core->aiu, AIU_MEM_IEC958_CONTROL, -+ AIU_MEM_IEC958_CONTROL_MODE_LINEAR, -+ AIU_MEM_IEC958_CONTROL_MODE_LINEAR); -+ -+ return 0; -+ -+out_mclk: -+ clk_disable_unprepare(priv->iface); -+out_clk_iface: -+ clk_disable_unprepare(priv->fast); -+out_clk_fast: -+ return ret; -+} -+ -+static void meson_aiu_spdif_dai_shutdown(struct snd_pcm_substream *substream, -+ struct snd_soc_dai *dai) -+{ -+ struct meson_aiu_spdif *priv = snd_soc_dai_get_drvdata(dai); -+ -+ clk_disable_unprepare(priv->iface); -+ clk_disable_unprepare(priv->mclk); -+ clk_disable_unprepare(priv->fast); -+} -+ -+static const struct snd_soc_dai_ops meson_aiu_spdif_dai_ops = { -+ .startup = meson_aiu_spdif_dai_startup, -+ .shutdown = meson_aiu_spdif_dai_shutdown, -+ .trigger = meson_aiu_spdif_dai_trigger, -+ .hw_params = meson_aiu_spdif_dai_hw_params, -+}; -+ -+static struct snd_soc_dai_driver meson_aiu_spdif_dai = { -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = (SNDRV_PCM_RATE_32000 | -+ SNDRV_PCM_RATE_44100 | -+ SNDRV_PCM_RATE_48000 | -+ SNDRV_PCM_RATE_96000 | -+ SNDRV_PCM_RATE_192000), -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE) -+ }, -+ .ops = &meson_aiu_spdif_dai_ops, -+}; -+ -+static const struct snd_soc_component_driver meson_aiu_spdif_component = { -+ .ops = &meson_aiu_spdif_dma_ops, -+ .pcm_new = meson_aiu_spdif_dma_new, -+ .name = DRV_NAME, -+}; -+ -+static int meson_aiu_spdif_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct meson_aiu_spdif *priv; -+ -+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, priv); -+ priv->core = dev_get_drvdata(dev->parent); -+ -+ priv->fast = devm_clk_get(dev, "fast"); -+ if (IS_ERR(priv->fast)) { -+ if (PTR_ERR(priv->fast) != -EPROBE_DEFER) -+ dev_err(dev, "Can't get spdif fast domain clockt\n"); -+ return PTR_ERR(priv->fast); -+ } -+ -+ priv->iface = devm_clk_get(dev, "iface"); -+ if (IS_ERR(priv->iface)) { -+ if (PTR_ERR(priv->iface) != -EPROBE_DEFER) -+ dev_err(dev, -+ "Can't get the dai clock gate\n"); -+ return PTR_ERR(priv->iface); -+ } -+ -+ priv->mclk_i958 = devm_clk_get(dev, "mclk_i958"); -+ if (IS_ERR(priv->mclk_i958)) { -+ if (PTR_ERR(priv->mclk_i958) != -EPROBE_DEFER) -+ dev_err(dev, "Can't get the spdif master clock\n"); -+ return PTR_ERR(priv->mclk_i958); -+ } -+ -+ /* -+ * TODO: the spdif dai can also get its data from the i2s fifo. -+ * For this use-case, the DAI driver will need to get the i2s master -+ * clock in order to reparent the spdif clock from cts_mclk_i958 to -+ * cts_amclk -+ */ -+ -+ priv->mclk = devm_clk_get(dev, "mclk"); -+ if (IS_ERR(priv->mclk)) { -+ if (PTR_ERR(priv->mclk) != -EPROBE_DEFER) -+ dev_err(dev, "Can't get the spdif input mux clock\n"); -+ return PTR_ERR(priv->mclk); -+ } -+ -+ return devm_snd_soc_register_component(dev, &meson_aiu_spdif_component, -+ &meson_aiu_spdif_dai, 1); -+} -+ -+static const struct of_device_id meson_aiu_spdif_of_match[] = { -+ { .compatible = "amlogic,meson-aiu-spdif", }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, meson_aiu_spdif_of_match); -+ -+static struct platform_driver meson_aiu_spdif_pdrv = { -+ .probe = meson_aiu_spdif_probe, -+ .driver = { -+ .name = DRV_NAME, -+ .of_match_table = meson_aiu_spdif_of_match, -+ }, -+}; -+module_platform_driver(meson_aiu_spdif_pdrv); -+ -+MODULE_DESCRIPTION("Meson AIU spdif ASoC Driver"); -+MODULE_AUTHOR("Jerome Brunet "); -+MODULE_LICENSE("GPL v2"); --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0105-FROMLIST-drm-bridge-dw-hdmi-Add-support-for-RGB-limi.patch b/packages/linux/patches/amlogic/amlogic-0105-FROMLIST-drm-bridge-dw-hdmi-Add-support-for-RGB-limi.patch new file mode 100644 index 0000000000..19089b2a50 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0105-FROMLIST-drm-bridge-dw-hdmi-Add-support-for-RGB-limi.patch @@ -0,0 +1,115 @@ +From 6160df65923ea72b35531490a989b8e07a708539 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Sun, 1 Mar 2020 16:55:05 +0000 +Subject: [PATCH 105/146] FROMLIST: drm/bridge: dw-hdmi: Add support for RGB + limited range + +CEA 861 standard request that RGB quantization range is "limited" for +CEA modes. Support that by adding CSC matrix which downscales values. + +This allows to proper color reproduction on TV and PC monitor at the +same time. In future, override property can be added, like "Broadcast +RGB" in i915 driver. + +Signed-off-by: Jernej Skrabec +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 36 +++++++++++++++++++++-- + 1 file changed, 34 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 664e3c5cd5b5..1103be760fd5 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -92,6 +92,12 @@ static const u16 csc_coeff_rgb_in_eitu709[3][4] = { + { 0x6756, 0x78ab, 0x2000, 0x0200 } + }; + ++static const u16 csc_coeff_rgb_limited[3][4] = { ++ { 0x1B7C, 0x0000, 0x0000, 0x0020 }, ++ { 0x0000, 0x1B7C, 0x0000, 0x0020 }, ++ { 0x0000, 0x0000, 0x1B7C, 0x0020 } ++}; ++ + struct hdmi_vmode { + bool mdataenablepolarity; + +@@ -109,6 +115,7 @@ struct hdmi_data_info { + unsigned int pix_repet_factor; + unsigned int hdcp_enable; + struct hdmi_vmode video_mode; ++ bool rgb_limited_range; + }; + + struct dw_hdmi_i2c { +@@ -960,6 +967,13 @@ static int is_color_space_conversion(struct dw_hdmi *hdmi) + hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format); + } + ++static int is_rgb_downscale_needed(struct dw_hdmi *hdmi) ++{ ++ return hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format) && ++ hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) && ++ hdmi->hdmi_data.rgb_limited_range; ++} ++ + static int is_color_space_decimation(struct dw_hdmi *hdmi) + { + if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) +@@ -1006,6 +1020,8 @@ static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi) + csc_coeff = &csc_coeff_rgb_in_eitu709; + csc_scale = 0; + } ++ } else if (is_rgb_downscale_needed(hdmi)) { ++ csc_coeff = &csc_coeff_rgb_limited; + } + + /* The CSC registers are sequential, alternating MSB then LSB */ +@@ -1615,6 +1631,18 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + drm_hdmi_avi_infoframe_from_display_mode(&frame, + &hdmi->connector, mode); + ++ if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { ++ drm_hdmi_avi_infoframe_quant_range(&frame, &hdmi->connector, ++ mode, ++ hdmi->hdmi_data.rgb_limited_range ? ++ HDMI_QUANTIZATION_RANGE_LIMITED : ++ HDMI_QUANTIZATION_RANGE_FULL); ++ } else { ++ frame.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; ++ frame.ycc_quantization_range = ++ HDMI_YCC_QUANTIZATION_RANGE_LIMITED; ++ } ++ + if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)) + frame.colorspace = HDMI_COLORSPACE_YUV444; + else if (hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) +@@ -2007,13 +2035,13 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); + + /* Enable csc path */ +- if (is_color_space_conversion(hdmi)) { ++ if (is_color_space_conversion(hdmi) || is_rgb_downscale_needed(hdmi)) { + hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE; + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); + } + + /* Enable color space conversion if needed */ +- if (is_color_space_conversion(hdmi)) ++ if (is_color_space_conversion(hdmi) || is_rgb_downscale_needed(hdmi)) + hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_IN_PATH, + HDMI_MC_FLOWCTRL); + else +@@ -2116,6 +2144,10 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + if (hdmi->hdmi_data.enc_out_bus_format == MEDIA_BUS_FMT_FIXED) + hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; + ++ hdmi->hdmi_data.rgb_limited_range = hdmi->sink_is_hdmi && ++ drm_default_rgb_quant_range(mode) == ++ HDMI_QUANTIZATION_RANGE_LIMITED; ++ + hdmi->hdmi_data.pix_repet_factor = 0; + hdmi->hdmi_data.hdcp_enable = 0; + hdmi->hdmi_data.video_mode.mdataenablepolarity = true; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0105-TEMP-ARM64-defconfig-enable-audio-support-for-meson-.patch b/packages/linux/patches/amlogic/amlogic-0105-TEMP-ARM64-defconfig-enable-audio-support-for-meson-.patch deleted file mode 100644 index 8ae582957d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0105-TEMP-ARM64-defconfig-enable-audio-support-for-meson-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 646e709d8d8a004c54a721fd6a2ae5bf24e7a533 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Fri, 31 Mar 2017 15:55:03 +0200 -Subject: [PATCH 105/187] TEMP: ARM64: defconfig: enable audio support for - meson SoCs as module - -Add audio support for meson SoCs. This includes the audio core -driver and the i2s and spdif output interfaces - -Signed-off-by: Jerome Brunet ---- - arch/arm64/configs/defconfig | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig -index 1053815f20cc..407e25b22c41 100644 ---- a/arch/arm64/configs/defconfig -+++ b/arch/arm64/configs/defconfig -@@ -556,6 +556,9 @@ CONFIG_SND_HDA_CODEC_HDMI=m - CONFIG_SND_SOC=y - CONFIG_SND_BCM2835_SOC_I2S=m - CONFIG_SND_MESON_AXG_SOUND_CARD=m -+CONFIG_SND_SOC_MESON_GX=m -+CONFIG_SND_SOC_MESON_GX_I2S=m -+CONFIG_SND_SOC_MESON_GX_SPDIF=m - CONFIG_SND_SOC_ROCKCHIP=m - CONFIG_SND_SOC_ROCKCHIP_SPDIF=m - CONFIG_SND_SOC_ROCKCHIP_RT5645=m --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch b/packages/linux/patches/amlogic/amlogic-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch new file mode 100644 index 0000000000..c2ca401861 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch @@ -0,0 +1,387 @@ +From dc3637389ac69c219bb4321677b1647cd5645a9b Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Fri, 6 Dec 2019 16:23:23 +0100 +Subject: [PATCH 106/146] FROMLIST: media: v4l2-mem2mem: handle draining, + stopped and next-buf-is-last states + +Since the draining and stop phase of the HW decoder mem2mem bahaviour is +now clearly defined, we can move handling of the following states to the +common v4l2-mem2mem core code: +- draining +- stopped +- next-buf-is-last + +By introducing the following v4l2-mem2mem APIS: +- v4l2_m2m_encoder_cmd/v4l2_m2m_ioctl_encoder_cmd to handle start/stop command +- v4l2_m2m_decoder_cmd/v4l2_m2m_ioctl_decoder_cmd to handle start/stop command +- v4l2_m2m_start_streaming to handle start of streaming of the de/encoder queue +- v4l2_m2m_stop_streaming to handle stop of streaming of the de/encoder queue +- v4l2_m2m_last_buffer_done to maek the current dest buffer as the last one + +And inline helpers: +- v4l2_m2m_mark_stopped to mark the de/encoding process as stopped +- v4l2_m2m_clear_state to clear the de/encoding state +- v4l2_m2m_dst_buf_is_last to detect the current dequeud dst_buf is the last +- v4l2_m2m_has_stopped to detect the de/encoding stopped state +- v4l2_m2m_is_last_draining_src_buf to detect the currect source buffer should + be the last processing before stopping the de/encoding process + +The special next-buf-is-last when min_buffers != 1 case is also handled +in v4l2_m2m_qbuf() by reusing the other introduced APIs. + +This state management has been stolen from the vicodec implementation, +and is no-op for drivers not calling the v4l2_m2m_encoder_cmd or +v4l2_m2m_decoder_cmd and v4l2_m2m_start_streaming/v4l2_m2m_stop_streaming. + +The vicodec will be the first one to be converted as an example. + +Signed-off-by: Neil Armstrong +--- + drivers/media/v4l2-core/v4l2-mem2mem.c | 172 ++++++++++++++++++++++++- + include/media/v4l2-mem2mem.h | 95 ++++++++++++++ + 2 files changed, 265 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c +index 1afd9c6ad908..f221d6c7a137 100644 +--- a/drivers/media/v4l2-core/v4l2-mem2mem.c ++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c +@@ -340,6 +340,11 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, + m2m_ctx->new_frame = !dst->vb2_buf.copied_timestamp || + dst->vb2_buf.timestamp != src->vb2_buf.timestamp; + ++ if (m2m_ctx->has_stopped) { ++ dprintk("Device has stopped\n"); ++ goto job_unlock; ++ } ++ + if (m2m_dev->m2m_ops->job_ready + && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { + dprintk("Driver not ready\n"); +@@ -556,6 +561,99 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + } + EXPORT_SYMBOL_GPL(v4l2_m2m_querybuf); + ++void v4l2_m2m_last_buffer_done(struct v4l2_m2m_ctx *m2m_ctx, ++ struct vb2_v4l2_buffer *vbuf) ++{ ++ vbuf->flags |= V4L2_BUF_FLAG_LAST; ++ vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE); ++ ++ v4l2_m2m_mark_stopped(m2m_ctx); ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_last_buffer_done); ++ ++static int v4l2_mark_last_buf(struct v4l2_m2m_ctx *m2m_ctx) ++{ ++ struct vb2_v4l2_buffer *next_dst_buf; ++ ++ if (m2m_ctx->is_draining) ++ return -EBUSY; ++ ++ if (m2m_ctx->has_stopped) ++ return 0; ++ ++ m2m_ctx->last_src_buf = v4l2_m2m_last_src_buf(m2m_ctx); ++ m2m_ctx->is_draining = true; ++ ++ if (m2m_ctx->last_src_buf) ++ return 0; ++ ++ next_dst_buf = v4l2_m2m_dst_buf_remove(m2m_ctx); ++ if (!next_dst_buf) { ++ m2m_ctx->next_buf_last = true; ++ return 0; ++ } ++ ++ v4l2_m2m_last_buffer_done(m2m_ctx, next_dst_buf); ++ ++ return 0; ++} ++ ++void v4l2_m2m_start_streaming(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_queue *q) ++{ ++ if (V4L2_TYPE_IS_OUTPUT(q->type)) ++ m2m_ctx->last_src_buf = NULL; ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_start_streaming); ++ ++void v4l2_m2m_stop_streaming(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_queue *q) ++{ ++ if (V4L2_TYPE_IS_OUTPUT(q->type)) { ++ if (m2m_ctx->is_draining) { ++ struct vb2_v4l2_buffer *next_dst_buf; ++ ++ m2m_ctx->last_src_buf = NULL; ++ next_dst_buf = v4l2_m2m_dst_buf_remove(m2m_ctx); ++ if (!next_dst_buf) ++ m2m_ctx->next_buf_last = true; ++ else ++ v4l2_m2m_last_buffer_done(m2m_ctx, ++ next_dst_buf); ++ } ++ } else { ++ v4l2_m2m_clear_state(m2m_ctx); ++ } ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_stop_streaming); ++ ++static void v4l2_m2m_force_last_buf_done(struct v4l2_m2m_ctx *m2m_ctx, ++ struct vb2_queue *q) ++{ ++ struct vb2_buffer *vb; ++ struct vb2_v4l2_buffer *vbuf; ++ unsigned int i; ++ ++ if (WARN_ON(q->is_output)) ++ return; ++ if (list_empty(&q->queued_list)) ++ return; ++ ++ vb = list_first_entry(&q->queued_list, struct vb2_buffer, queued_entry); ++ for (i = 0; i < vb->num_planes; i++) ++ vb2_set_plane_payload(vb, i, 0); ++ ++ /* ++ * Since the buffer hasn't been queued to the ready queue, ++ * mark is active and owned before marking it LAST and DONE ++ */ ++ vb->state = VB2_BUF_STATE_ACTIVE; ++ atomic_inc(&q->owned_by_drv_count); ++ ++ vbuf = to_vb2_v4l2_buffer(vb); ++ vbuf->field = V4L2_FIELD_NONE; ++ ++ v4l2_m2m_last_buffer_done(m2m_ctx, vbuf); ++} ++ + int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_buffer *buf) + { +@@ -570,11 +668,25 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + __func__); + return -EPERM; + } ++ + ret = vb2_qbuf(vq, vdev->v4l2_dev->mdev, buf); +- if (!ret && !(buf->flags & V4L2_BUF_FLAG_IN_REQUEST)) ++ if (ret) ++ return ret; ++ ++ /* ++ * If the capture queue is streaming, but streaming hasn't started ++ * on the device, but was asked to stop, mark the previously queued ++ * buffer as DONE with LAST flag since it won't be queued on the ++ * device. ++ */ ++ if (!V4L2_TYPE_IS_OUTPUT(vq->type) && ++ vb2_is_streaming(vq) && !vb2_start_streaming_called(vq) && ++ (v4l2_m2m_has_stopped(m2m_ctx) || v4l2_m2m_dst_buf_is_last(m2m_ctx))) ++ v4l2_m2m_force_last_buf_done(m2m_ctx, vq); ++ else if (!(buf->flags & V4L2_BUF_FLAG_IN_REQUEST)) + v4l2_m2m_try_schedule(m2m_ctx); + +- return ret; ++ return 0; + } + EXPORT_SYMBOL_GPL(v4l2_m2m_qbuf); + +@@ -1225,6 +1337,62 @@ int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh, + } + EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_try_decoder_cmd); + ++int v4l2_m2m_encoder_cmd(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, ++ struct v4l2_encoder_cmd *ec) ++{ ++ if (ec->cmd != V4L2_ENC_CMD_STOP && ec->cmd != V4L2_ENC_CMD_START) ++ return -EINVAL; ++ ++ if (ec->cmd == V4L2_ENC_CMD_STOP) ++ return v4l2_mark_last_buf(m2m_ctx); ++ ++ if (m2m_ctx->is_draining) ++ return -EBUSY; ++ ++ if (m2m_ctx->has_stopped) ++ m2m_ctx->has_stopped = false; ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_encoder_cmd); ++ ++int v4l2_m2m_decoder_cmd(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, ++ struct v4l2_decoder_cmd *dc) ++{ ++ if (dc->cmd != V4L2_DEC_CMD_STOP && dc->cmd != V4L2_DEC_CMD_START) ++ return -EINVAL; ++ ++ if (dc->cmd == V4L2_DEC_CMD_STOP) ++ return v4l2_mark_last_buf(m2m_ctx); ++ ++ if (m2m_ctx->is_draining) ++ return -EBUSY; ++ ++ if (m2m_ctx->has_stopped) ++ m2m_ctx->has_stopped = false; ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_decoder_cmd); ++ ++int v4l2_m2m_ioctl_encoder_cmd(struct file *file, void *priv, ++ struct v4l2_encoder_cmd *ec) ++{ ++ struct v4l2_fh *fh = file->private_data; ++ ++ return v4l2_m2m_encoder_cmd(file, fh->m2m_ctx, ec); ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_encoder_cmd); ++ ++int v4l2_m2m_ioctl_decoder_cmd(struct file *file, void *priv, ++ struct v4l2_decoder_cmd *dc) ++{ ++ struct v4l2_fh *fh = file->private_data; ++ ++ return v4l2_m2m_decoder_cmd(file, fh->m2m_ctx, dc); ++} ++EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_decoder_cmd); ++ + int v4l2_m2m_ioctl_stateless_try_decoder_cmd(struct file *file, void *fh, + struct v4l2_decoder_cmd *dc) + { +diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h +index 1d85e24791e4..3476889af46c 100644 +--- a/include/media/v4l2-mem2mem.h ++++ b/include/media/v4l2-mem2mem.h +@@ -80,6 +80,10 @@ struct v4l2_m2m_queue_ctx { + * for an existing frame. This is always true unless + * V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF is set, which + * indicates slicing support. ++ * @is_draining: indicates device is in draining phase ++ * @last_src_buf: indicate the last source buffer for draining ++ * @next_buf_last: next capture queud buffer will be tagged as last ++ * @has_stopped: indicate the device has been stopped + * @m2m_dev: opaque pointer to the internal data to handle M2M context + * @cap_q_ctx: Capture (output to memory) queue context + * @out_q_ctx: Output (input from memory) queue context +@@ -98,6 +102,11 @@ struct v4l2_m2m_ctx { + + bool new_frame; + ++ bool is_draining; ++ struct vb2_v4l2_buffer *last_src_buf; ++ bool next_buf_last; ++ bool has_stopped; ++ + /* internal use only */ + struct v4l2_m2m_dev *m2m_dev; + +@@ -215,6 +224,50 @@ v4l2_m2m_buf_done(struct vb2_v4l2_buffer *buf, enum vb2_buffer_state state) + vb2_buffer_done(&buf->vb2_buf, state); + } + ++static inline void ++v4l2_m2m_clear_state(struct v4l2_m2m_ctx *m2m_ctx) ++{ ++ m2m_ctx->next_buf_last = false; ++ m2m_ctx->is_draining = false; ++ m2m_ctx->has_stopped = false; ++} ++ ++static inline void ++v4l2_m2m_mark_stopped(struct v4l2_m2m_ctx *m2m_ctx) ++{ ++ m2m_ctx->next_buf_last = false; ++ m2m_ctx->is_draining = false; ++ m2m_ctx->has_stopped = true; ++} ++ ++static inline bool ++v4l2_m2m_dst_buf_is_last(struct v4l2_m2m_ctx *m2m_ctx) ++{ ++ return m2m_ctx->is_draining && m2m_ctx->next_buf_last; ++} ++ ++static inline bool ++v4l2_m2m_has_stopped(struct v4l2_m2m_ctx *m2m_ctx) ++{ ++ return m2m_ctx->has_stopped; ++} ++ ++static inline bool ++v4l2_m2m_is_last_draining_src_buf(struct v4l2_m2m_ctx *m2m_ctx, ++ struct vb2_v4l2_buffer *buf) ++{ ++ return m2m_ctx->is_draining && buf == m2m_ctx->last_src_buf; ++} ++ ++/** ++ * v4l2_m2m_last_buffer_done() - marks the buffer with LAST flag and DONE ++ * ++ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx ++ * @vbuf: pointer to struct &v4l2_buffer ++ */ ++void v4l2_m2m_last_buffer_done(struct v4l2_m2m_ctx *m2m_ctx, ++ struct vb2_v4l2_buffer *vbuf); ++ + /** + * v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer + * +@@ -312,6 +365,44 @@ int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + enum v4l2_buf_type type); + ++/** ++ * v4l2_m2m_start_streaming() - handle start of streaming of a video queue ++ * ++ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx ++ * @q: queue ++ */ ++void v4l2_m2m_start_streaming(struct v4l2_m2m_ctx *m2m_ctx, ++ struct vb2_queue *q); ++ ++/** ++ * v4l2_m2m_stop_streaming() - handle stop of streaming of a video queue ++ * ++ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx ++ * @q: queue ++ */ ++void v4l2_m2m_stop_streaming(struct v4l2_m2m_ctx *m2m_ctx, ++ struct vb2_queue *q); ++ ++/** ++ * v4l2_m2m_encoder_cmd() - execute an encoder command ++ * ++ * @file: pointer to struct &file ++ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx ++ * @ec: pointer to the encoder command ++ */ ++int v4l2_m2m_encoder_cmd(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, ++ struct v4l2_encoder_cmd *ec); ++ ++/** ++ * v4l2_m2m_decoder_cmd() - execute a decoder command ++ * ++ * @file: pointer to struct &file ++ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx ++ * @dc: pointer to the decoder command ++ */ ++int v4l2_m2m_decoder_cmd(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, ++ struct v4l2_decoder_cmd *dc); ++ + /** + * v4l2_m2m_poll() - poll replacement, for destination buffers only + * +@@ -704,6 +795,10 @@ int v4l2_m2m_ioctl_streamon(struct file *file, void *fh, + enum v4l2_buf_type type); + int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh, + enum v4l2_buf_type type); ++int v4l2_m2m_ioctl_encoder_cmd(struct file *file, void *fh, ++ struct v4l2_encoder_cmd *ec); ++int v4l2_m2m_ioctl_decoder_cmd(struct file *file, void *fh, ++ struct v4l2_decoder_cmd *dc); + int v4l2_m2m_ioctl_try_encoder_cmd(struct file *file, void *fh, + struct v4l2_encoder_cmd *ec); + int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0106-TEMP-ARM64-dts-meson-gx-add-audio-controller-nodes.patch b/packages/linux/patches/amlogic/amlogic-0106-TEMP-ARM64-dts-meson-gx-add-audio-controller-nodes.patch deleted file mode 100644 index a4b3e2e8b9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0106-TEMP-ARM64-dts-meson-gx-add-audio-controller-nodes.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 96fa2a1719158f983581988417fe763aa69ff61c Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Thu, 30 Mar 2017 15:19:04 +0200 -Subject: [PATCH 106/187] TEMP: ARM64: dts: meson-gx: add audio controller - nodes - -Add audio controller nodes for Amlogic meson gxbb and gxl. -This includes the audio-core node, the i2s and spdif DAIs - -Audio on this SoC family is still a work in progress. More nodes are likely -to be added later on (pcm DAIs, input DMAs, etc ...) - -Signed-off-by: Jerome Brunet ---- - arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 23 ++++++++++++++++++ - arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 27 +++++++++++++++++++++ - arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 27 +++++++++++++++++++++ - 3 files changed, 77 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -index 209f20bea4a1..ed6ab86d3e7e 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -226,6 +226,29 @@ - #reset-cells = <1>; - }; - -+ audio: audio@5400 { -+ compatible = "amlogic,meson-gx-audio-core"; -+ reg = <0x0 0x5400 0x0 0x2ac>, -+ <0x0 0xa000 0x0 0x304>; -+ reg-names = "aiu", "audin"; -+ status = "disabled"; -+ -+ aiu_i2s: audio-controller-0 { -+ #sound-dai-cells = <0>; -+ compatible = "amlogic,meson-aiu-i2s"; -+ interrupts = ; -+ status = "disabled"; -+ }; -+ -+ aiu_spdif: audio-controller-1 { -+ #sound-dai-cells = <0>; -+ compatible = "amlogic,meson-aiu-spdif"; -+ interrupts = ; -+ status = "disabled"; -+ }; -+ -+ }; -+ - uart_A: serial@84c0 { - compatible = "amlogic,meson-gx-uart"; - reg = <0x0 0x84c0 0x0 0x18>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -index f734faaf7b78..7316e8b171f2 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -@@ -724,6 +724,24 @@ - }; - }; - -+&audio { -+ clocks = <&clkc CLKID_AIU>, -+ <&clkc CLKID_AIU_GLUE>, -+ <&clkc CLKID_I2S_SPDIF>; -+ clock-names = "aiu_top", "aiu_glue", "audin"; -+ resets = <&reset RESET_AIU>, -+ <&reset RESET_AUDIN>; -+ reset-names = "aiu", "audin"; -+}; -+ -+&aiu_i2s { -+ clocks = <&clkc CLKID_I2S_OUT>, -+ <&clkc CLKID_MIXER_IFACE>, -+ <&clkc CLKID_AOCLK_GATE>, -+ <&clkc CLKID_CTS_AMCLK>; -+ clock-names = "fast", "iface", "bclks", "mclk"; -+}; -+ - &pwrc_vpu { - resets = <&reset RESET_VIU>, - <&reset RESET_VENC>, -@@ -812,6 +830,15 @@ - num-cs = <1>; - }; - -+&aiu_spdif { -+ clocks = <&clkc CLKID_IEC958>, -+ <&clkc CLKID_IEC958_GATE>, -+ <&clkc CLKID_CTS_MCLK_I958>, -+ <&clkc CLKID_CTS_AMCLK>, -+ <&clkc CLKID_CTS_I958>; -+ clock-names = "fast", "iface", "mclk_i958", "mclk_i2s", "mclk"; -+}; -+ - &spifc { - clocks = <&clkc CLKID_SPI>; - }; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -index c959456bacc6..2fa1cc8ea0b0 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -@@ -727,6 +727,24 @@ - }; - }; - -+&audio { -+ clocks = <&clkc CLKID_AIU>, -+ <&clkc CLKID_AIU_GLUE>, -+ <&clkc CLKID_I2S_SPDIF>; -+ clock-names = "aiu_top", "aiu_glue", "audin"; -+ resets = <&reset RESET_AIU>, -+ <&reset RESET_AUDIN>; -+ reset-names = "aiu", "audin"; -+}; -+ -+&aiu_i2s { -+ clocks = <&clkc CLKID_I2S_OUT>, -+ <&clkc CLKID_MIXER_IFACE>, -+ <&clkc CLKID_AOCLK_GATE>, -+ <&clkc CLKID_CTS_AMCLK>; -+ clock-names = "fast", "iface", "bclks", "mclk"; -+}; -+ - &pwrc_vpu { - resets = <&reset RESET_VIU>, - <&reset RESET_VENC>, -@@ -815,6 +833,15 @@ - num-cs = <1>; - }; - -+&aiu_spdif { -+ clocks = <&clkc CLKID_IEC958>, -+ <&clkc CLKID_IEC958_GATE>, -+ <&clkc CLKID_CTS_MCLK_I958>, -+ <&clkc CLKID_CTS_AMCLK>, -+ <&clkc CLKID_CTS_I958>; -+ clock-names = "fast", "iface", "mclk_i958", "mclk_i2s", "mclk"; -+}; -+ - &spifc { - clocks = <&clkc CLKID_SPI>; - }; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0107-FROMLIST-media-vicodec-use-v4l2-mem2mem-draining-sto.patch b/packages/linux/patches/amlogic/amlogic-0107-FROMLIST-media-vicodec-use-v4l2-mem2mem-draining-sto.patch new file mode 100644 index 0000000000..8ef823fcfa --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0107-FROMLIST-media-vicodec-use-v4l2-mem2mem-draining-sto.patch @@ -0,0 +1,304 @@ +From c83df769335de59f61295032f4d93ffdd31e33d9 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Fri, 6 Dec 2019 16:24:16 +0100 +Subject: [PATCH 107/146] FROMLIST: media: vicodec: use v4l2-mem2mem draining, + stopped and next-buf-is-last states handling + +Use the previously introduced v4l2-mem2mem core APIs to handle the drainig, +stopped and next-buf-is-last states. + +With these changes, the v4l2-compliance still passes with the following +commands : +v4l2-ctl --stream-mmap --stream-out-mmap --stream-to-hdr out.comp --stream-from in.yuv +>>>><><><><><><><><><><><><><><><><>< 15.53 fps + 15.53 fps +><><><><><><><><><><><><>< 13.99 fps + 13.99 fps +><><><><><><><><><><><>< 13.52 fps + 13.52 fps +><><><><><><><><><><><><>< 13.41 fps + 13.41 fps +><><><><><><><><><><><><>< 13.21 fps + 13.21 fps +><><><><><><><><><><><>< 13.09 fps + 13.09 fps +><><><><><><>< +STOP ENCODER +<<< +EOS EVENT + +v4l2-compliance --stream-from in.yuv -s + +The output is available at [1] + +v4l2-compliance -d1 --stream-from-hdr out.comp -s + +The output is available at [2] + +No functional changes should be noticed. + +[1] https://termbin.com/25nn +[2] https://termbin.com/dza4 + +Suggested-by: Hans Verkuil +Suggested-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/media/platform/vicodec/vicodec-core.c | 162 ++++++------------ + 1 file changed, 52 insertions(+), 110 deletions(-) + +diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c +index 82350097503e..425c47216dae 100644 +--- a/drivers/media/platform/vicodec/vicodec-core.c ++++ b/drivers/media/platform/vicodec/vicodec-core.c +@@ -117,15 +117,10 @@ struct vicodec_ctx { + struct vicodec_dev *dev; + bool is_enc; + bool is_stateless; +- bool is_draining; +- bool next_is_last; +- bool has_stopped; + spinlock_t *lock; + + struct v4l2_ctrl_handler hdl; + +- struct vb2_v4l2_buffer *last_src_buf; +- + /* Source and destination queue data */ + struct vicodec_q_data q_data[2]; + struct v4l2_fwht_state state; +@@ -431,11 +426,11 @@ static void device_run(void *priv) + v4l2_m2m_buf_copy_metadata(src_buf, dst_buf, false); + + spin_lock(ctx->lock); +- if (!ctx->comp_has_next_frame && src_buf == ctx->last_src_buf) { ++ if (!ctx->comp_has_next_frame && ++ v4l2_m2m_is_last_draining_src_buf(ctx->fh.m2m_ctx, src_buf)) { + dst_buf->flags |= V4L2_BUF_FLAG_LAST; + v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); +- ctx->is_draining = false; +- ctx->has_stopped = true; ++ v4l2_m2m_mark_stopped(ctx->fh.m2m_ctx); + } + if (ctx->is_enc || ctx->is_stateless) { + src_buf->sequence = q_src->sequence++; +@@ -586,8 +581,6 @@ static int job_ready(void *priv) + unsigned int max_to_copy; + unsigned int comp_frame_size; + +- if (ctx->has_stopped) +- return 0; + if (ctx->source_changed) + return 0; + if (ctx->is_stateless || ctx->is_enc || ctx->comp_has_frame) +@@ -607,7 +600,8 @@ static int job_ready(void *priv) + if (ctx->header_size < sizeof(struct fwht_cframe_hdr)) { + state = get_next_header(ctx, &p, p_src + sz - p); + if (ctx->header_size < sizeof(struct fwht_cframe_hdr)) { +- if (ctx->is_draining && src_buf == ctx->last_src_buf) ++ if (v4l2_m2m_is_last_draining_src_buf(ctx->fh.m2m_ctx, ++ src_buf)) + return 1; + job_remove_src_buf(ctx, state); + goto restart; +@@ -636,7 +630,8 @@ static int job_ready(void *priv) + p += copy; + ctx->comp_size += copy; + if (ctx->comp_size < max_to_copy) { +- if (ctx->is_draining && src_buf == ctx->last_src_buf) ++ if (v4l2_m2m_is_last_draining_src_buf(ctx->fh.m2m_ctx, ++ src_buf)) + return 1; + job_remove_src_buf(ctx, state); + goto restart; +@@ -1219,41 +1214,6 @@ static int vidioc_s_selection(struct file *file, void *priv, + return 0; + } + +-static int vicodec_mark_last_buf(struct vicodec_ctx *ctx) +-{ +- struct vb2_v4l2_buffer *next_dst_buf; +- int ret = 0; +- +- spin_lock(ctx->lock); +- if (ctx->is_draining) { +- ret = -EBUSY; +- goto unlock; +- } +- if (ctx->has_stopped) +- goto unlock; +- +- ctx->last_src_buf = v4l2_m2m_last_src_buf(ctx->fh.m2m_ctx); +- ctx->is_draining = true; +- if (ctx->last_src_buf) +- goto unlock; +- +- next_dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); +- if (!next_dst_buf) { +- ctx->next_is_last = true; +- goto unlock; +- } +- +- next_dst_buf->flags |= V4L2_BUF_FLAG_LAST; +- vb2_buffer_done(&next_dst_buf->vb2_buf, VB2_BUF_STATE_DONE); +- ctx->is_draining = false; +- ctx->has_stopped = true; +- v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); +- +-unlock: +- spin_unlock(ctx->lock); +- return ret; +-} +- + static int vicodec_encoder_cmd(struct file *file, void *fh, + struct v4l2_encoder_cmd *ec) + { +@@ -1268,18 +1228,19 @@ static int vicodec_encoder_cmd(struct file *file, void *fh, + !vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q)) + return 0; + +- if (ec->cmd == V4L2_ENC_CMD_STOP) +- return vicodec_mark_last_buf(ctx); +- ret = 0; +- spin_lock(ctx->lock); +- if (ctx->is_draining) { +- ret = -EBUSY; +- } else if (ctx->has_stopped) { +- ctx->has_stopped = false; ++ ret = v4l2_m2m_ioctl_encoder_cmd(file, fh, ec); ++ if (ret < 0) ++ return ret; ++ ++ if (ec->cmd == V4L2_ENC_CMD_STOP && ++ v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) ++ v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); ++ ++ if (ec->cmd == V4L2_ENC_CMD_START && ++ v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) + vb2_clear_last_buffer_dequeued(&ctx->fh.m2m_ctx->cap_q_ctx.q); +- } +- spin_unlock(ctx->lock); +- return ret; ++ ++ return 0; + } + + static int vicodec_decoder_cmd(struct file *file, void *fh, +@@ -1296,18 +1257,19 @@ static int vicodec_decoder_cmd(struct file *file, void *fh, + !vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q)) + return 0; + +- if (dc->cmd == V4L2_DEC_CMD_STOP) +- return vicodec_mark_last_buf(ctx); +- ret = 0; +- spin_lock(ctx->lock); +- if (ctx->is_draining) { +- ret = -EBUSY; +- } else if (ctx->has_stopped) { +- ctx->has_stopped = false; ++ ret = v4l2_m2m_ioctl_decoder_cmd(file, fh, dc); ++ if (ret < 0) ++ return ret; ++ ++ if (dc->cmd == V4L2_DEC_CMD_STOP && ++ v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) ++ v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); ++ ++ if (dc->cmd == V4L2_DEC_CMD_START && ++ v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) + vb2_clear_last_buffer_dequeued(&ctx->fh.m2m_ctx->cap_q_ctx.q); +- } +- spin_unlock(ctx->lock); +- return ret; ++ ++ return 0; + } + + static int vicodec_enum_framesizes(struct file *file, void *fh, +@@ -1480,23 +1442,21 @@ static void vicodec_buf_queue(struct vb2_buffer *vb) + .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, + }; + +- if (vb2_is_streaming(vq_cap)) { +- if (!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type) && +- ctx->next_is_last) { +- unsigned int i; ++ if (!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type) && ++ vb2_is_streaming(vb->vb2_queue) && ++ v4l2_m2m_dst_buf_is_last(ctx->fh.m2m_ctx)) { ++ unsigned int i; + +- for (i = 0; i < vb->num_planes; i++) +- vb->planes[i].bytesused = 0; +- vbuf->flags = V4L2_BUF_FLAG_LAST; +- vbuf->field = V4L2_FIELD_NONE; +- vbuf->sequence = get_q_data(ctx, vb->vb2_queue->type)->sequence++; +- vb2_buffer_done(vb, VB2_BUF_STATE_DONE); +- ctx->is_draining = false; +- ctx->has_stopped = true; +- ctx->next_is_last = false; +- v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); +- return; +- } ++ for (i = 0; i < vb->num_planes; i++) ++ vb->planes[i].bytesused = 0; ++ ++ vbuf->field = V4L2_FIELD_NONE; ++ vbuf->sequence = ++ get_q_data(ctx, vb->vb2_queue->type)->sequence++; ++ ++ v4l2_m2m_last_buffer_done(ctx->fh.m2m_ctx, vbuf); ++ v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); ++ return; + } + + /* buf_queue handles only the first source change event */ +@@ -1609,8 +1569,7 @@ static int vicodec_start_streaming(struct vb2_queue *q, + chroma_div = info->width_div * info->height_div; + q_data->sequence = 0; + +- if (V4L2_TYPE_IS_OUTPUT(q->type)) +- ctx->last_src_buf = NULL; ++ v4l2_m2m_start_streaming(ctx->fh.m2m_ctx, q); + + state->gop_cnt = 0; + +@@ -1689,29 +1648,12 @@ static void vicodec_stop_streaming(struct vb2_queue *q) + + vicodec_return_bufs(q, VB2_BUF_STATE_ERROR); + +- if (V4L2_TYPE_IS_OUTPUT(q->type)) { +- if (ctx->is_draining) { +- struct vb2_v4l2_buffer *next_dst_buf; +- +- spin_lock(ctx->lock); +- ctx->last_src_buf = NULL; +- next_dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); +- if (!next_dst_buf) { +- ctx->next_is_last = true; +- } else { +- next_dst_buf->flags |= V4L2_BUF_FLAG_LAST; +- vb2_buffer_done(&next_dst_buf->vb2_buf, VB2_BUF_STATE_DONE); +- ctx->is_draining = false; +- ctx->has_stopped = true; +- v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); +- } +- spin_unlock(ctx->lock); +- } +- } else { +- ctx->is_draining = false; +- ctx->has_stopped = false; +- ctx->next_is_last = false; +- } ++ v4l2_m2m_stop_streaming(ctx->fh.m2m_ctx, q); ++ ++ if (V4L2_TYPE_IS_OUTPUT(q->type) && ++ v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) ++ v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event); ++ + if (!ctx->is_enc && V4L2_TYPE_IS_OUTPUT(q->type)) + ctx->first_source_change_sent = false; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0107-TEMP-snd-meson-activate-HDMI-audio-path.patch b/packages/linux/patches/amlogic/amlogic-0107-TEMP-snd-meson-activate-HDMI-audio-path.patch deleted file mode 100644 index cc32e9e2c5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0107-TEMP-snd-meson-activate-HDMI-audio-path.patch +++ /dev/null @@ -1,55 +0,0 @@ -From ddf985c49597a68dbef89d17c928237f8d78f897 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Fri, 7 Jul 2017 17:39:21 +0200 -Subject: [PATCH 107/187] TEMP: snd: meson: activate HDMI audio path - -Signed-off-by: Jerome Brunet ---- - sound/soc/meson-gx/aiu-i2s.c | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/sound/soc/meson-gx/aiu-i2s.c b/sound/soc/meson-gx/aiu-i2s.c -index 63d7821c2c72..c6bfd5d8c808 100644 ---- a/sound/soc/meson-gx/aiu-i2s.c -+++ b/sound/soc/meson-gx/aiu-i2s.c -@@ -334,8 +334,19 @@ static int meson_aiu_i2s_dma_new(struct snd_soc_pcm_runtime *rtd) - #define AIU_CLK_CTRL_ALRCLK_RIGHT_J (2 << 8) - #define AIU_CLK_CTRL_MORE_I2S_DIV_MASK GENMASK(5, 0) - #define AIU_CLK_CTRL_MORE_I2S_DIV(div) (((div) - 1) << 0) -+#define AIU_CLK_CTRL_MORE_HDMI_TX_SEL_MASK BIT(6) -+#define AIU_CLK_CTRL_MORE_HDMI_TX_I958_CLK (0 << 6) -+#define AIU_CLK_CTRL_MORE_HDMI_TX_INT_CLK (1 << 6) - #define AIU_CODEC_DAC_LRCLK_CTRL_DIV_MASK GENMASK(11, 0) - #define AIU_CODEC_DAC_LRCLK_CTRL_DIV(div) (((div) - 1) << 0) -+#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_MASK GENMASK(1, 0) -+#define AIU_HDMI_CLK_DATA_CTRL_CLK_DISABLE (0 << 0) -+#define AIU_HDMI_CLK_DATA_CTRL_CLK_PCM (1 << 0) -+#define AIU_HDMI_CLK_DATA_CTRL_CLK_I2S (2 << 0) -+#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_MASK GENMASK(5, 4) -+#define AIU_HDMI_CLK_DATA_CTRL_DATA_MUTE (0 << 4) -+#define AIU_HDMI_CLK_DATA_CTRL_DATA_PCM (1 << 4) -+#define AIU_HDMI_CLK_DATA_CTRL_DATA_I2S (2 << 4) - #define AIU_I2S_DAC_CFG_PAYLOAD_SIZE_MASK GENMASK(1, 0) - #define AIU_I2S_DAC_CFG_AOCLK_32 (0 << 0) - #define AIU_I2S_DAC_CFG_AOCLK_48 (2 << 0) -@@ -499,6 +510,17 @@ static int meson_aiu_i2s_dai_hw_params(struct snd_pcm_substream *substream, - return ret; - } - -+ /* Quick and dirty hack for HDMI */ -+ regmap_update_bits(priv->core->aiu, AIU_HDMI_CLK_DATA_CTRL, -+ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_MASK | -+ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_MASK, -+ AIU_HDMI_CLK_DATA_CTRL_CLK_I2S | -+ AIU_HDMI_CLK_DATA_CTRL_DATA_I2S); -+ -+ regmap_update_bits(priv->core->aiu, AIU_CLK_CTRL_MORE, -+ AIU_CLK_CTRL_MORE_HDMI_TX_SEL_MASK, -+ AIU_CLK_CTRL_MORE_HDMI_TX_INT_CLK); -+ - return 0; - } - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0108-FROMLIST-media-meson-vdec-bring-up-to-compliance.patch b/packages/linux/patches/amlogic/amlogic-0108-FROMLIST-media-meson-vdec-bring-up-to-compliance.patch new file mode 100644 index 0000000000..7d8c950bfa --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0108-FROMLIST-media-meson-vdec-bring-up-to-compliance.patch @@ -0,0 +1,742 @@ +From 394dd80b59761cec3cfbc097897c6d55f2ad8662 Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Mon, 7 Oct 2019 16:59:08 +0200 +Subject: [PATCH 108/146] FROMLIST: media: meson: vdec: bring up to compliance + +Add all the necessary bits to pass v4l2-compliance in stateful decoding +mode. + +Mostly includes tracking the state of the decoder, allowing the OUTPUT +queue to stream while the CAPTURE queue is inactive, handling resolution +change events, draining with V4L2_DEC_CMD_STOP, copying more metadata +from the src buffers to the dst buffers, etc. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/esparser.c | 58 +++++------- + drivers/staging/media/meson/vdec/vdec.c | 90 ++++++++++++------- + drivers/staging/media/meson/vdec/vdec.h | 14 ++- + .../staging/media/meson/vdec/vdec_helpers.c | 88 +++++++++--------- + .../staging/media/meson/vdec/vdec_helpers.h | 6 +- + .../staging/media/meson/vdec/vdec_platform.c | 10 +++ + 6 files changed, 149 insertions(+), 117 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c +index 95102a4bdc62..adc5c1e81a4c 100644 +--- a/drivers/staging/media/meson/vdec/esparser.c ++++ b/drivers/staging/media/meson/vdec/esparser.c +@@ -79,22 +79,28 @@ static irqreturn_t esparser_isr(int irq, void *dev) + * Also append a start code 000001ff at the end to trigger + * the ESPARSER interrupt. + */ +-static u32 esparser_pad_start_code(struct vb2_buffer *vb) ++static u32 esparser_pad_start_code(struct amvdec_core *core, struct vb2_buffer *vb) + { + u32 payload_size = vb2_get_plane_payload(vb, 0); + u32 pad_size = 0; +- u8 *vaddr = vb2_plane_vaddr(vb, 0) + payload_size; ++ u8 *vaddr = vb2_plane_vaddr(vb, 0); + + if (payload_size < ESPARSER_MIN_PACKET_SIZE) { + pad_size = ESPARSER_MIN_PACKET_SIZE - payload_size; +- memset(vaddr, 0, pad_size); ++ memset(vaddr + payload_size, 0, pad_size); + } + +- memset(vaddr + pad_size, 0, SEARCH_PATTERN_LEN); +- vaddr[pad_size] = 0x00; +- vaddr[pad_size + 1] = 0x00; +- vaddr[pad_size + 2] = 0x01; +- vaddr[pad_size + 3] = 0xff; ++ if ((payload_size + pad_size + SEARCH_PATTERN_LEN) > ++ vb2_plane_size(vb, 0)) { ++ dev_warn(core->dev, "%s: unable to pad start code\n", __func__); ++ return pad_size; ++ } ++ ++ memset(vaddr + payload_size + pad_size, 0, SEARCH_PATTERN_LEN); ++ vaddr[payload_size + pad_size] = 0x00; ++ vaddr[payload_size + pad_size + 1] = 0x00; ++ vaddr[payload_size + pad_size + 2] = 0x01; ++ vaddr[payload_size + pad_size + 3] = 0xff; + + return pad_size; + } +@@ -180,31 +186,27 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + int ret; + struct vb2_buffer *vb = &vbuf->vb2_buf; + struct amvdec_core *core = sess->core; +- struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; +- u32 num_dst_bufs = 0; + u32 payload_size = vb2_get_plane_payload(vb, 0); + dma_addr_t phy = vb2_dma_contig_plane_dma_addr(vb, 0); + u32 offset; + u32 pad_size; + +- if (codec_ops->num_pending_bufs) +- num_dst_bufs = codec_ops->num_pending_bufs(sess); +- +- num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); +- +- if (esparser_vififo_get_free_space(sess) < payload_size || +- atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs) ++ if (esparser_vififo_get_free_space(sess) < payload_size) + return -EAGAIN; + + v4l2_m2m_src_buf_remove_by_buf(sess->m2m_ctx, vbuf); + + offset = esparser_get_offset(sess); + +- amvdec_add_ts_reorder(sess, vb->timestamp, offset); +- dev_dbg(core->dev, "esparser: ts = %llu pld_size = %u offset = %08X\n", +- vb->timestamp, payload_size, offset); ++ amvdec_add_ts(sess, vb->timestamp, vbuf->timecode, offset, vbuf->flags); ++ dev_dbg(core->dev, "esparser: ts = %llu pld_size = %u offset = %08X flags = %08X\n", ++ vb->timestamp, payload_size, offset, vbuf->flags); ++ ++ vbuf->flags = 0; ++ vbuf->field = V4L2_FIELD_NONE; ++ vbuf->sequence = sess->sequence_out++; + +- pad_size = esparser_pad_start_code(vb); ++ pad_size = esparser_pad_start_code(core, vb); + ret = esparser_write_data(core, phy, payload_size + pad_size); + + if (ret <= 0) { +@@ -216,19 +218,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + return 0; + } + +- /* We need to wait until we parse the first keyframe. +- * All buffers prior to the first keyframe must be dropped. +- */ +- if (!sess->keyframe_found) +- usleep_range(1000, 2000); +- +- if (sess->keyframe_found) +- atomic_inc(&sess->esparser_queued_bufs); +- else +- amvdec_remove_ts(sess, vb->timestamp); +- +- vbuf->flags = 0; +- vbuf->field = V4L2_FIELD_NONE; ++ atomic_inc(&sess->esparser_queued_bufs); + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); + + return 0; +diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c +index 5c5dabed2f09..92f0258868b1 100644 +--- a/drivers/staging/media/meson/vdec/vdec.c ++++ b/drivers/staging/media/meson/vdec/vdec.c +@@ -168,7 +168,10 @@ static void process_num_buffers(struct vb2_queue *q, + { + const struct amvdec_format *fmt_out = sess->fmt_out; + unsigned int buffers_total = q->num_buffers + *num_buffers; ++ u32 min_buf_capture = v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture); + ++ if (q->num_buffers + *num_buffers < min_buf_capture) ++ *num_buffers = min_buf_capture - q->num_buffers; + if (is_reqbufs && buffers_total < fmt_out->min_buffers) + *num_buffers = fmt_out->min_buffers - q->num_buffers; + if (buffers_total > fmt_out->max_buffers) +@@ -193,7 +196,8 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, + if (*num_planes) { + switch (q->type) { + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: +- if (*num_planes != 1 || sizes[0] < output_size) ++ if (*num_planes != 1 || ++ sizes[0] < sess->src_buffer_size) + return -EINVAL; + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: +@@ -224,7 +228,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, + + switch (q->type) { + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: +- sizes[0] = amvdec_get_output_size(sess); ++ sizes[0] = sess->src_buffer_size; + *num_planes = 1; + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: +@@ -250,6 +254,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, + return -EINVAL; + } + ++ sess->changed_format = 1; + return 0; + } + +@@ -261,10 +266,11 @@ static void vdec_vb2_buf_queue(struct vb2_buffer *vb) + + v4l2_m2m_buf_queue(m2m_ctx, vbuf); + +- if (!sess->streamon_out || !sess->streamon_cap) ++ if (!sess->streamon_out) + return; + +- if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && ++ if (sess->streamon_cap && ++ vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && + vdec_codec_needs_recycle(sess)) + vdec_queue_recycle(sess, vb); + +@@ -289,16 +295,22 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) + else + sess->streamon_cap = 1; + +- if (!sess->streamon_out || !sess->streamon_cap) ++ if (!sess->streamon_out) + return 0; + + if (sess->status == STATUS_NEEDS_RESUME && +- q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { ++ q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && ++ sess->changed_format) { + codec_ops->resume(sess); + sess->status = STATUS_RUNNING; + return 0; + } + ++ if (sess->status == STATUS_RUNNING || ++ sess->status == STATUS_NEEDS_RESUME || ++ sess->status == STATUS_INIT) ++ return 0; ++ + sess->vififo_size = SIZE_VIFIFO; + sess->vififo_vaddr = + dma_alloc_coherent(sess->core->dev, sess->vififo_size, +@@ -323,13 +335,14 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) + goto vififo_free; + + sess->sequence_cap = 0; ++ sess->sequence_out = 0; + if (vdec_codec_needs_recycle(sess)) + sess->recycle_thread = kthread_run(vdec_recycle_thread, sess, + "vdec_recycle"); + +- sess->status = STATUS_RUNNING; ++ sess->status = STATUS_INIT; + core->cur_sess = sess; +- ++ schedule_work(&sess->esparser_queue_work); + return 0; + + vififo_free: +@@ -386,6 +399,7 @@ static void vdec_stop_streaming(struct vb2_queue *q) + struct vb2_v4l2_buffer *buf; + + if (sess->status == STATUS_RUNNING || ++ sess->status == STATUS_INIT || + (sess->status == STATUS_NEEDS_RESUME && + (!sess->streamon_out || !sess->streamon_cap))) { + if (vdec_codec_needs_recycle(sess)) +@@ -476,20 +490,34 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size, + struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; + struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; + const struct amvdec_format *fmts = sess->core->platform->formats; +- const struct amvdec_format *fmt_out; ++ const struct amvdec_format *fmt_out = NULL; ++ u32 output_size = 0; + + memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); + memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); + +- if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { ++ switch (f->type) { ++ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: + fmt_out = find_format(fmts, size, pixmp->pixelformat); + if (!fmt_out) { + pixmp->pixelformat = V4L2_PIX_FMT_MPEG2; + fmt_out = find_format(fmts, size, pixmp->pixelformat); + } ++ break; ++ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: ++ fmt_out = sess->fmt_out; ++ break; ++ default: ++ return NULL; ++ } + +- pfmt[0].sizeimage = +- get_output_size(pixmp->width, pixmp->height); ++ pixmp->width = clamp(pixmp->width, (u32)256, fmt_out->max_width); ++ pixmp->height = clamp(pixmp->height, (u32)144, fmt_out->max_height); ++ output_size = get_output_size(pixmp->width, pixmp->height); ++ ++ if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { ++ if (!pfmt[0].sizeimage) ++ pfmt[0].sizeimage = sess->src_buffer_size; + pfmt[0].bytesperline = 0; + pixmp->num_planes = 1; + } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { +@@ -499,35 +527,25 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size, + + memset(pfmt[1].reserved, 0, sizeof(pfmt[1].reserved)); + if (pixmp->pixelformat == V4L2_PIX_FMT_NV12M) { +- pfmt[0].sizeimage = +- get_output_size(pixmp->width, pixmp->height); ++ pfmt[0].sizeimage = output_size; + pfmt[0].bytesperline = ALIGN(pixmp->width, 64); + +- pfmt[1].sizeimage = +- get_output_size(pixmp->width, pixmp->height) / 2; ++ pfmt[1].sizeimage = output_size / 2; + pfmt[1].bytesperline = ALIGN(pixmp->width, 64); + pixmp->num_planes = 2; + } else if (pixmp->pixelformat == V4L2_PIX_FMT_YUV420M) { +- pfmt[0].sizeimage = +- get_output_size(pixmp->width, pixmp->height); ++ pfmt[0].sizeimage = output_size; + pfmt[0].bytesperline = ALIGN(pixmp->width, 64); + +- pfmt[1].sizeimage = +- get_output_size(pixmp->width, pixmp->height) / 4; ++ pfmt[1].sizeimage = output_size / 4; + pfmt[1].bytesperline = ALIGN(pixmp->width, 64) / 2; + +- pfmt[2].sizeimage = +- get_output_size(pixmp->width, pixmp->height) / 4; ++ pfmt[2].sizeimage = output_size / 2; + pfmt[2].bytesperline = ALIGN(pixmp->width, 64) / 2; + pixmp->num_planes = 3; + } +- } else { +- return NULL; + } + +- pixmp->width = clamp(pixmp->width, (u32)256, fmt_out->max_width); +- pixmp->height = clamp(pixmp->height, (u32)144, fmt_out->max_height); +- + if (pixmp->field == V4L2_FIELD_ANY) + pixmp->field = V4L2_FIELD_NONE; + +@@ -586,6 +604,8 @@ static int vdec_s_fmt(struct file *file, void *fh, struct v4l2_format *f) + orig_pixmp = *pixmp; + + fmt_out = vdec_try_fmt_common(sess, num_formats, f); ++ if (!fmt_out) ++ return -EINVAL; + + if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + pixfmt_out = pixmp->pixelformat; +@@ -610,6 +630,7 @@ static int vdec_s_fmt(struct file *file, void *fh, struct v4l2_format *f) + sess->ycbcr_enc = pixmp->ycbcr_enc; + sess->quantization = pixmp->quantization; + sess->xfer_func = pixmp->xfer_func; ++ sess->src_buffer_size = pixmp->plane_fmt[0].sizeimage; + } + + memset(&format, 0, sizeof(format)); +@@ -701,29 +722,31 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) + if (!(sess->streamon_out & sess->streamon_cap)) + return 0; + +- /* Currently not handled since we do not support dynamic resolution +- * for MPEG2. We consider both queues streaming to mean that the +- * decoding session is started +- */ +- if (cmd->cmd == V4L2_DEC_CMD_START) ++ if (cmd->cmd == V4L2_DEC_CMD_START) { ++ v4l2_m2m_clear_state(sess->m2m_ctx); ++ sess->should_stop = 0; + return 0; ++ } + + /* Should not happen */ + if (cmd->cmd != V4L2_DEC_CMD_STOP) + return -EINVAL; + + dev_dbg(dev, "Received V4L2_DEC_CMD_STOP\n"); ++ + sess->should_stop = 1; + +- vdec_wait_inactive(sess); ++ v4l2_m2m_mark_stopped(sess->m2m_ctx); + + if (codec_ops->drain) { ++ vdec_wait_inactive(sess); + codec_ops->drain(sess); + } else if (codec_ops->eos_sequence) { + u32 len; + const u8 *data = codec_ops->eos_sequence(&len); + + esparser_queue_eos(sess->core, data, len); ++ vdec_wait_inactive(sess); + } + + return ret; +@@ -883,6 +906,7 @@ static int vdec_open(struct file *file) + sess->height = 720; + sess->pixelaspect.numerator = 1; + sess->pixelaspect.denominator = 1; ++ sess->src_buffer_size = SZ_1M; + + INIT_LIST_HEAD(&sess->timestamps); + INIT_LIST_HEAD(&sess->bufs_recycle); +diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h +index 0faa1ec4858e..f95445ac0658 100644 +--- a/drivers/staging/media/meson/vdec/vdec.h ++++ b/drivers/staging/media/meson/vdec/vdec.h +@@ -29,13 +29,19 @@ struct amvdec_buffer { + * struct amvdec_timestamp - stores a src timestamp along with a VIFIFO offset + * + * @list: used to make lists out of this struct +- * @ts: timestamp ++ * @tc: timecode from the v4l2 buffer ++ * @ts: timestamp from the VB2 buffer + * @offset: offset in the VIFIFO where the associated packet was written ++ * @flags: flags from the v4l2 buffer ++ * @used_count: times this timestamp was checked for a match with a dst buffer + */ + struct amvdec_timestamp { + struct list_head list; ++ struct v4l2_timecode tc; + u64 ts; + u32 offset; ++ u32 flags; ++ u32 used_count; + }; + + struct amvdec_session; +@@ -165,6 +171,7 @@ struct amvdec_format { + + enum amvdec_status { + STATUS_STOPPED, ++ STATUS_INIT, + STATUS_RUNNING, + STATUS_NEEDS_RESUME, + }; +@@ -180,6 +187,7 @@ enum amvdec_status { + * @ctrl_min_buf_capture: V4L2 control V4L2_CID_MIN_BUFFERS_FOR_CAPTURE + * @fmt_out: vdec pixel format for the OUTPUT queue + * @pixfmt_cap: V4L2 pixel format for the CAPTURE queue ++ * @src_buffer_size: size in bytes of the OUTPUT buffers' only plane + * @width: current picture width + * @height: current picture height + * @colorspace: current colorspace +@@ -221,6 +229,7 @@ struct amvdec_session { + + const struct amvdec_format *fmt_out; + u32 pixfmt_cap; ++ u32 src_buffer_size; + + u32 width; + u32 height; +@@ -235,10 +244,11 @@ struct amvdec_session { + struct work_struct esparser_queue_work; + + unsigned int streamon_cap, streamon_out; +- unsigned int sequence_cap; ++ unsigned int sequence_cap, sequence_out; + unsigned int should_stop; + unsigned int keyframe_found; + unsigned int num_dst_bufs; ++ unsigned int changed_format; + + u8 canvas_alloc[MAX_CANVAS]; + u32 canvas_num; +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index f16948bdbf2f..a4970ec1bf2e 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -200,33 +200,23 @@ int amvdec_set_canvases(struct amvdec_session *sess, + } + EXPORT_SYMBOL_GPL(amvdec_set_canvases); + +-void amvdec_add_ts_reorder(struct amvdec_session *sess, u64 ts, u32 offset) ++void amvdec_add_ts(struct amvdec_session *sess, u64 ts, ++ struct v4l2_timecode tc, u32 offset, u32 vbuf_flags) + { +- struct amvdec_timestamp *new_ts, *tmp; ++ struct amvdec_timestamp *new_ts; + unsigned long flags; + +- new_ts = kmalloc(sizeof(*new_ts), GFP_KERNEL); ++ new_ts = kzalloc(sizeof(*new_ts), GFP_KERNEL); + new_ts->ts = ts; ++ new_ts->tc = tc; + new_ts->offset = offset; ++ new_ts->flags = vbuf_flags; + + spin_lock_irqsave(&sess->ts_spinlock, flags); +- +- if (list_empty(&sess->timestamps)) +- goto add_tail; +- +- list_for_each_entry(tmp, &sess->timestamps, list) { +- if (ts <= tmp->ts) { +- list_add_tail(&new_ts->list, &tmp->list); +- goto unlock; +- } +- } +- +-add_tail: + list_add_tail(&new_ts->list, &sess->timestamps); +-unlock: + spin_unlock_irqrestore(&sess->ts_spinlock, flags); + } +-EXPORT_SYMBOL_GPL(amvdec_add_ts_reorder); ++EXPORT_SYMBOL_GPL(amvdec_add_ts); + + void amvdec_remove_ts(struct amvdec_session *sess, u64 ts) + { +@@ -251,8 +241,8 @@ EXPORT_SYMBOL_GPL(amvdec_remove_ts); + + static void dst_buf_done(struct amvdec_session *sess, + struct vb2_v4l2_buffer *vbuf, +- u32 field, +- u64 timestamp) ++ u32 field, u64 timestamp, ++ struct v4l2_timecode timecode, u32 flags) + { + struct device *dev = sess->core->dev_dec; + u32 output_size = amvdec_get_output_size(sess); +@@ -271,19 +261,23 @@ static void dst_buf_done(struct amvdec_session *sess, + + vbuf->vb2_buf.timestamp = timestamp; + vbuf->sequence = sess->sequence_cap++; ++ vbuf->flags = flags; ++ vbuf->timecode = timecode; + + if (sess->should_stop && +- atomic_read(&sess->esparser_queued_bufs) <= 2) { ++ atomic_read(&sess->esparser_queued_bufs) <= 1) { + const struct v4l2_event ev = { .type = V4L2_EVENT_EOS }; + +- dev_dbg(dev, "Signaling EOS\n"); ++ dev_dbg(dev, "Signaling EOS, sequence_cap = %u\n", ++ sess->sequence_cap - 1); + v4l2_event_queue_fh(&sess->fh, &ev); + vbuf->flags |= V4L2_BUF_FLAG_LAST; + } else if (sess->should_stop) + dev_dbg(dev, "should_stop, %u bufs remain\n", + atomic_read(&sess->esparser_queued_bufs)); + +- dev_dbg(dev, "Buffer %u done\n", vbuf->vb2_buf.index); ++ dev_dbg(dev, "Buffer %u done, ts = %llu, flags = %08X\n", ++ vbuf->vb2_buf.index, timestamp, flags); + vbuf->field = field; + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); + +@@ -297,7 +291,9 @@ void amvdec_dst_buf_done(struct amvdec_session *sess, + struct device *dev = sess->core->dev_dec; + struct amvdec_timestamp *tmp; + struct list_head *timestamps = &sess->timestamps; ++ struct v4l2_timecode timecode; + u64 timestamp; ++ u32 vbuf_flags; + unsigned long flags; + + spin_lock_irqsave(&sess->ts_spinlock, flags); +@@ -312,11 +308,13 @@ void amvdec_dst_buf_done(struct amvdec_session *sess, + + tmp = list_first_entry(timestamps, struct amvdec_timestamp, list); + timestamp = tmp->ts; ++ timecode = tmp->tc; ++ vbuf_flags = tmp->flags; + list_del(&tmp->list); + kfree(tmp); + spin_unlock_irqrestore(&sess->ts_spinlock, flags); + +- dst_buf_done(sess, vbuf, field, timestamp); ++ dst_buf_done(sess, vbuf, field, timestamp, timecode, vbuf_flags); + atomic_dec(&sess->esparser_queued_bufs); + } + EXPORT_SYMBOL_GPL(amvdec_dst_buf_done); +@@ -328,48 +326,43 @@ void amvdec_dst_buf_done_offset(struct amvdec_session *sess, + struct device *dev = sess->core->dev_dec; + struct amvdec_timestamp *match = NULL; + struct amvdec_timestamp *tmp, *n; ++ struct v4l2_timecode timecode = { 0 }; + u64 timestamp = 0; ++ u32 vbuf_flags = 0; + unsigned long flags; + + spin_lock_irqsave(&sess->ts_spinlock, flags); + + /* Look for our vififo offset to get the corresponding timestamp. */ + list_for_each_entry_safe(tmp, n, &sess->timestamps, list) { +- s64 delta = (s64)offset - tmp->offset; +- +- /* Offsets reported by codecs usually differ slightly, +- * so we need some wiggle room. +- * 4KiB being the minimum packet size, there is no risk here. +- */ +- if (delta > (-1 * (s32)SZ_4K) && delta < SZ_4K) { +- match = tmp; ++ if (tmp->offset > offset) { ++ /* ++ * Delete any record that remained unused for 32 match ++ * checks ++ */ ++ if (tmp->used_count++ >= 32) { ++ list_del(&tmp->list); ++ kfree(tmp); ++ } + break; + } + +- if (!allow_drop) +- continue; +- +- /* Delete any timestamp entry that appears before our target +- * (not all src packets/timestamps lead to a frame) +- */ +- if (delta > 0 || delta < -1 * (s32)sess->vififo_size) { +- atomic_dec(&sess->esparser_queued_bufs); +- list_del(&tmp->list); +- kfree(tmp); +- } ++ match = tmp; + } + + if (!match) { +- dev_dbg(dev, "Buffer %u done but can't match offset (%08X)\n", ++ dev_err(dev, "Buffer %u done but can't match offset (%08X)\n", + vbuf->vb2_buf.index, offset); + } else { + timestamp = match->ts; ++ timecode = match->tc; ++ vbuf_flags = match->flags; + list_del(&match->list); + kfree(match); + } + spin_unlock_irqrestore(&sess->ts_spinlock, flags); + +- dst_buf_done(sess, vbuf, field, timestamp); ++ dst_buf_done(sess, vbuf, field, timestamp, timecode, vbuf_flags); + if (match) + atomic_dec(&sess->esparser_queued_bufs); + } +@@ -420,16 +413,19 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width, + + v4l2_ctrl_s_ctrl(sess->ctrl_min_buf_capture, dpb_size); + +- /* Check if the capture queue is already configured well for our ++ /* ++ * Check if the capture queue is already configured well for our + * usecase. If so, keep decoding with it and do not send the event + */ +- if (sess->width == width && ++ if (sess->streamon_cap && ++ sess->width == width && + sess->height == height && + dpb_size <= sess->num_dst_bufs) { + sess->fmt_out->codec_ops->resume(sess); + return; + } + ++ sess->changed_format = 0; + sess->width = width; + sess->height = height; + sess->status = STATUS_NEEDS_RESUME; +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h +index a455a9ee1cc2..165e6293ffba 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.h ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.h +@@ -44,13 +44,15 @@ void amvdec_dst_buf_done_offset(struct amvdec_session *sess, + u32 offset, u32 field, bool allow_drop); + + /** +- * amvdec_add_ts_reorder() - Add a timestamp to the list in chronological order ++ * amvdec_add_ts() - Add a timestamp to the list + * + * @sess: current session + * @ts: timestamp to add + * @offset: offset in the VIFIFO where the associated packet was written ++ * @flags the vb2_v4l2_buffer flags + */ +-void amvdec_add_ts_reorder(struct amvdec_session *sess, u64 ts, u32 offset); ++void amvdec_add_ts(struct amvdec_session *sess, u64 ts, ++ struct v4l2_timecode tc, u32 offset, u32 flags); + void amvdec_remove_ts(struct amvdec_session *sess, u64 ts); + + /** +diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c +index ea39f8209ec7..066d4a055894 100644 +--- a/drivers/staging/media/meson/vdec/vdec_platform.c ++++ b/drivers/staging/media/meson/vdec/vdec_platform.c +@@ -21,6 +21,7 @@ static const struct amvdec_format vdec_formats_gxbb[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG2, + .min_buffers = 8, +@@ -31,6 +32,7 @@ static const struct amvdec_format vdec_formats_gxbb[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, + }; + +@@ -45,6 +47,7 @@ static const struct amvdec_format vdec_formats_gxl[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG2, + .min_buffers = 8, +@@ -55,6 +58,7 @@ static const struct amvdec_format vdec_formats_gxl[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, + }; + +@@ -69,6 +73,7 @@ static const struct amvdec_format vdec_formats_gxm[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG2, + .min_buffers = 8, +@@ -79,6 +84,7 @@ static const struct amvdec_format vdec_formats_gxm[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, + }; + +@@ -93,6 +99,7 @@ static const struct amvdec_format vdec_formats_g12a[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG2, + .min_buffers = 8, +@@ -103,6 +110,7 @@ static const struct amvdec_format vdec_formats_g12a[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, + }; + +@@ -117,6 +125,7 @@ static const struct amvdec_format vdec_formats_sm1[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG2, + .min_buffers = 8, +@@ -127,6 +136,7 @@ static const struct amvdec_format vdec_formats_sm1[] = { + .codec_ops = &codec_mpeg12_ops, + .firmware_path = "meson/vdec/gxl_mpeg12.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED, + }, + }; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0108-TEMP-ARM64-dts-meson-gx-add-sound-dai-cells-to-HDMI-.patch b/packages/linux/patches/amlogic/amlogic-0108-TEMP-ARM64-dts-meson-gx-add-sound-dai-cells-to-HDMI-.patch deleted file mode 100644 index 09f3a846d0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0108-TEMP-ARM64-dts-meson-gx-add-sound-dai-cells-to-HDMI-.patch +++ /dev/null @@ -1,39 +0,0 @@ -From be6fb16becbf949eefa7a8cec9d9c4f511f7509e Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Wed, 20 Sep 2017 18:01:26 +0200 -Subject: [PATCH 108/187] TEMP: ARM64: dts: meson-gx: add sound-dai-cells to - HDMI node - -Signed-off-by: Jerome Brunet ---- - arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 1 + - arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -index 7316e8b171f2..30dbc3753045 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -@@ -330,6 +330,7 @@ - <&clkc CLKID_CLK81>, - <&clkc CLKID_GCLK_VENCI_INT0>; - clock-names = "isfr", "iahb", "venci"; -+ #sound-dai-cells = <0>; - }; - - &sysctrl { -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -index 2fa1cc8ea0b0..a76e5b603da9 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -@@ -280,6 +280,7 @@ - <&clkc CLKID_CLK81>, - <&clkc CLKID_GCLK_VENCI_INT0>; - clock-names = "isfr", "iahb", "venci"; -+ #sound-dai-cells = <0>; - }; - - &sysctrl { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0118-TEMP-media-meson-vdec-add-H.264-decoding-support.patch b/packages/linux/patches/amlogic/amlogic-0109-FROMLIST-media-meson-vdec-add-H.264-decoding-support.patch similarity index 82% rename from packages/linux/patches/amlogic/amlogic-0118-TEMP-media-meson-vdec-add-H.264-decoding-support.patch rename to packages/linux/patches/amlogic/amlogic-0109-FROMLIST-media-meson-vdec-add-H.264-decoding-support.patch index b06b111beb..f645ea078b 100644 --- a/packages/linux/patches/amlogic/amlogic-0118-TEMP-media-meson-vdec-add-H.264-decoding-support.patch +++ b/packages/linux/patches/amlogic/amlogic-0109-FROMLIST-media-meson-vdec-add-H.264-decoding-support.patch @@ -1,17 +1,19 @@ -From 455d1723dce03949afcec7cdcb9af63885e05b38 Mon Sep 17 00:00:00 2001 +From 7a3c513748adda914edc321d0f5d2b0d54d0aa04 Mon Sep 17 00:00:00 2001 From: Maxime Jourdan -Date: Wed, 29 Aug 2018 15:42:56 +0200 -Subject: [PATCH 118/187] TEMP: media: meson: vdec: add H.264 decoding support +Date: Mon, 7 Oct 2019 16:59:09 +0200 +Subject: [PATCH 109/146] FROMLIST: media: meson: vdec: add H.264 decoding + support -Add support for V4L2_PIX_FMT_H264 +Add support for the H264 compressed format (V4L2_PIX_FMT_H264). Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong --- drivers/staging/media/meson/vdec/Makefile | 2 +- - drivers/staging/media/meson/vdec/codec_h264.c | 478 ++++++++++++++++++ - drivers/staging/media/meson/vdec/codec_h264.h | 13 + - .../staging/media/meson/vdec/vdec_platform.c | 31 ++ - 4 files changed, 523 insertions(+), 1 deletion(-) + drivers/staging/media/meson/vdec/codec_h264.c | 482 ++++++++++++++++++ + drivers/staging/media/meson/vdec/codec_h264.h | 14 + + .../staging/media/meson/vdec/vdec_platform.c | 61 +++ + 4 files changed, 558 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/meson/vdec/codec_h264.c create mode 100644 drivers/staging/media/meson/vdec/codec_h264.h @@ -29,13 +31,14 @@ index 6bea129084b7..711d990c760e 100644 obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o diff --git a/drivers/staging/media/meson/vdec/codec_h264.c b/drivers/staging/media/meson/vdec/codec_h264.c new file mode 100644 -index 000000000000..6ac0115afaa3 +index 000000000000..4528a6a01c3d --- /dev/null +++ b/drivers/staging/media/meson/vdec/codec_h264.c -@@ -0,0 +1,478 @@ +@@ -0,0 +1,482 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* -+ * Copyright (C) 2018 Maxime Jourdan ++ * Copyright (C) 2019 BayLibre, SAS ++ * Author: Maxime Jourdan + */ + +#include @@ -48,7 +51,8 @@ index 000000000000..6ac0115afaa3 +#define SIZE_WORKSPACE 0x1ee000 +#define SIZE_SEI (8 * SZ_1K) + -+/* Offset added by the firmware which must be substracted ++/* ++ * Offset added by the firmware which must be substracted + * from the workspace phyaddr + */ +#define WORKSPACE_BUF_OFFSET 0x1000000 @@ -89,11 +93,12 @@ index 000000000000..6ac0115afaa3 +#define AR_PRESENT_FLAG BIT(0) +#define AR_EXTEND 0xff + -+/* Buffer to send to the ESPARSER to signal End Of Stream for H.264. ++/* ++ * Buffer to send to the ESPARSER to signal End Of Stream for H.264. + * This is a 16x16 encoded picture that will trigger drain firmware-side. + * There is no known alternative. + */ -+static const u8 eos_sequence[SZ_1K] = { ++static const u8 eos_sequence[SZ_4K] = { + 0x00, 0x00, 0x00, 0x01, 0x06, 0x05, 0xff, 0xe4, 0xdc, 0x45, 0xe9, 0xbd, + 0xe6, 0xd9, 0x48, 0xb7, 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef, + 0x78, 0x32, 0x36, 0x34, 0x20, 0x2d, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, @@ -143,7 +148,8 @@ index 000000000000..6ac0115afaa3 + 0xe1, 0xfc, 0x62, 0xda, 0xf1, 0xfb, 0xa2, 0xdb, 0xd6, 0xbe, 0x5c, 0xd7, + 0x24, 0xa3, 0xf5, 0xb9, 0x2f, 0x57, 0x16, 0x49, 0x75, 0x47, 0x77, 0x09, + 0x5c, 0xa1, 0xb4, 0xc3, 0x4f, 0x60, 0x2b, 0xb0, 0x0c, 0xc8, 0xd6, 0x66, -+ 0xba, 0x9b, 0x82, 0x29, 0x33, 0x92, 0x26, 0x99, 0x31, 0x1c, 0x7f, 0x9b ++ 0xba, 0x9b, 0x82, 0x29, 0x33, 0x92, 0x26, 0x99, 0x31, 0x1c, 0x7f, 0x9b, ++ 0x00, 0x00, 0x01, 0x0ff, +}; + +static const u8 *codec_h264_eos_sequence(u32 *len) @@ -183,7 +189,8 @@ index 000000000000..6ac0115afaa3 + +static void codec_h264_recycle(struct amvdec_core *core, u32 buf_idx) +{ -+ /* Tell the decoder he can recycle this buffer. ++ /* ++ * Tell the firmware it can recycle this buffer. + * AV_SCRATCH_8 serves the same purpose. + */ + if (!amvdec_read_dos(core, AV_SCRATCH_7)) @@ -192,33 +199,32 @@ index 000000000000..6ac0115afaa3 + amvdec_write_dos(core, AV_SCRATCH_8, buf_idx + 1); +} + -+static int codec_h264_start(struct amvdec_session *sess) { ++static int codec_h264_start(struct amvdec_session *sess) ++{ + u32 workspace_offset; + struct amvdec_core *core = sess->core; + struct codec_h264 *h264 = sess->priv; + + /* Allocate some memory for the H.264 decoder's state */ -+ h264->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, -+ &h264->workspace_paddr, GFP_KERNEL); -+ if (!h264->workspace_vaddr) { -+ dev_err(core->dev, "Failed to alloc H.264 Workspace\n"); ++ h264->workspace_vaddr = ++ dma_alloc_coherent(core->dev, SIZE_WORKSPACE, ++ &h264->workspace_paddr, GFP_KERNEL); ++ if (!h264->workspace_vaddr) + return -ENOMEM; -+ } + + /* Allocate some memory for the H.264 SEI dump */ + h264->sei_vaddr = dma_alloc_coherent(core->dev, SIZE_SEI, + &h264->sei_paddr, GFP_KERNEL); -+ if (!h264->sei_vaddr) { -+ dev_err(core->dev, "Failed to alloc H.264 SEI\n"); ++ if (!h264->sei_vaddr) + return -ENOMEM; -+ } + + amvdec_write_dos_bits(core, POWER_CTL_VLD, BIT(9) | BIT(6)); + + workspace_offset = h264->workspace_paddr - WORKSPACE_BUF_OFFSET; + amvdec_write_dos(core, AV_SCRATCH_1, workspace_offset); + amvdec_write_dos(core, AV_SCRATCH_G, h264->ext_fw_paddr); -+ amvdec_write_dos(core, AV_SCRATCH_I, h264->sei_paddr - workspace_offset); ++ amvdec_write_dos(core, AV_SCRATCH_I, h264->sei_paddr - ++ workspace_offset); + + /* Enable "error correction" */ + amvdec_write_dos(core, AV_SCRATCH_F, @@ -270,7 +276,6 @@ index 000000000000..6ac0115afaa3 + h264->ext_fw_vaddr = dma_alloc_coherent(core->dev, SIZE_EXT_FW, + &h264->ext_fw_paddr, GFP_KERNEL); + if (!h264->ext_fw_vaddr) { -+ dev_err(core->dev, "Failed to alloc H.264 extended fw\n"); + kfree(h264); + return -ENOMEM; + } @@ -300,6 +305,7 @@ index 000000000000..6ac0115afaa3 + + if (ar_idc == AR_EXTEND) { + u32 ar_info = amvdec_read_dos(core, AV_SCRATCH_3); ++ + sess->pixelaspect.numerator = ar_info & 0xffff; + sess->pixelaspect.denominator = (ar_info >> 16) & 0xffff; + return; @@ -320,8 +326,7 @@ index 000000000000..6ac0115afaa3 + amvdec_set_canvases(sess, (u32[]){ ANC0_CANVAS_ADDR, 0 }, + (u32[]){ 24, 0 }); + -+ dev_dbg(core->dev, -+ "max_refs = %u; actual_dpb_size = %u\n", ++ dev_dbg(core->dev, "max_refs = %u; actual_dpb_size = %u\n", + h264->max_refs, sess->num_dst_bufs); + + /* Align to a multiple of 4 macroblocks */ @@ -333,8 +338,6 @@ index 000000000000..6ac0115afaa3 + h264->ref_vaddr = dma_alloc_coherent(core->dev, h264->ref_size, + &h264->ref_paddr, GFP_KERNEL); + if (!h264->ref_vaddr) { -+ dev_err(core->dev, "Failed to alloc refs (%u)\n", -+ h264->ref_size); + amvdec_abort(sess); + return; + } @@ -349,7 +352,8 @@ index 000000000000..6ac0115afaa3 + ((h264->max_refs - 1) << 8)); +} + -+/* Configure the H.264 decoder when the parser detected a parameter set change ++/** ++ * Configure the H.264 decoder when the parser detected a parameter set change + */ +static void codec_h264_src_change(struct amvdec_session *sess) +{ @@ -379,15 +383,16 @@ index 000000000000..6ac0115afaa3 + frame_width = h264->mb_width * 16 - crop_right; + frame_height = h264->mb_height * 16 - crop_bottom; + -+ dev_info(core->dev, "frame: %ux%u; crop: %u %u\n", -+ frame_width, frame_height, crop_right, crop_bottom); ++ dev_dbg(core->dev, "frame: %ux%u; crop: %u %u\n", ++ frame_width, frame_height, crop_right, crop_bottom); + + codec_h264_set_par(sess); + amvdec_src_change(sess, frame_width, frame_height, h264->max_refs + 5); +} + +/** -+ * The offset is split in half in 2 different registers ++ * The bitstream offset is split in half in 2 different registers. ++ * Fetch its MSB here, which location depends on the frame number. + */ +static u32 get_offset_msb(struct amvdec_core *core, int frame_num) +{ @@ -412,7 +417,7 @@ index 000000000000..6ac0115afaa3 + num_frames = (status >> 8) & 0xff; + if (error_count) { + dev_warn(core->dev, -+ "decoder error(s) happened, count %d\n", error_count); ++ "decoder error(s) happened, count %d\n", error_count); + amvdec_write_dos(core, AV_SCRATCH_D, 0); + } + @@ -424,7 +429,8 @@ index 000000000000..6ac0115afaa3 + u32 offset = (frame_status >> OFFSET_BIT) & OFFSET_MASK; + u32 field = V4L2_FIELD_NONE; + -+ /* A buffer decode error means it was decoded, ++ /* ++ * A buffer decode error means it was decoded, + * but part of the picture will have artifacts. + * Typical reason is a temporarily corrupted bitstream + */ @@ -513,13 +519,14 @@ index 000000000000..6ac0115afaa3 +}; diff --git a/drivers/staging/media/meson/vdec/codec_h264.h b/drivers/staging/media/meson/vdec/codec_h264.h new file mode 100644 -index 000000000000..9211a11b452c +index 000000000000..7cb4fb86ff36 --- /dev/null +++ b/drivers/staging/media/meson/vdec/codec_h264.h -@@ -0,0 +1,13 @@ +@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* -+ * Copyright (C) 2018 Maxime Jourdan ++ * Copyright (C) 2019 BayLibre, SAS ++ * Author: Maxime Jourdan + */ + +#ifndef __MESON_VDEC_CODEC_H264_H_ @@ -531,10 +538,10 @@ index 000000000000..9211a11b452c + +#endif diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -index 824dbc7f46f5..579d3e48f0b2 100644 +index 066d4a055894..e9356a46828f 100644 --- a/drivers/staging/media/meson/vdec/vdec_platform.c +++ b/drivers/staging/media/meson/vdec/vdec_platform.c -@@ -9,9 +9,20 @@ +@@ -9,9 +9,22 @@ #include "vdec_1.h" #include "codec_mpeg12.h" @@ -549,13 +556,15 @@ index 824dbc7f46f5..579d3e48f0b2 100644 + .max_height = 1080, + .vdec_ops = &vdec_1_ops, + .codec_ops = &codec_h264_ops, -+ .firmware_path = "meson/gxbb/vh264_mc", ++ .firmware_path = "meson/vdec/gxbb_h264.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { .pixfmt = V4L2_PIX_FMT_MPEG1, .min_buffers = 8, .max_buffers = 8, -@@ -36,6 +47,16 @@ static const struct amvdec_format vdec_formats_gxbb[] = { +@@ -38,6 +51,18 @@ static const struct amvdec_format vdec_formats_gxbb[] = { static const struct amvdec_format vdec_formats_gxl[] = { { @@ -566,13 +575,15 @@ index 824dbc7f46f5..579d3e48f0b2 100644 + .max_height = 2160, + .vdec_ops = &vdec_1_ops, + .codec_ops = &codec_h264_ops, -+ .firmware_path = "meson/gxl/vh264_mc", ++ .firmware_path = "meson/vdec/gxl_h264.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { .pixfmt = V4L2_PIX_FMT_MPEG1, .min_buffers = 8, .max_buffers = 8, -@@ -60,6 +81,16 @@ static const struct amvdec_format vdec_formats_gxl[] = { +@@ -64,6 +89,18 @@ static const struct amvdec_format vdec_formats_gxl[] = { static const struct amvdec_format vdec_formats_gxm[] = { { @@ -583,8 +594,48 @@ index 824dbc7f46f5..579d3e48f0b2 100644 + .max_height = 2160, + .vdec_ops = &vdec_1_ops, + .codec_ops = &codec_h264_ops, -+ .firmware_path = "meson/gxm/vh264_mc", ++ .firmware_path = "meson/vdec/gxm_h264.bin", + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_MPEG1, + .min_buffers = 8, + .max_buffers = 8, +@@ -90,6 +127,18 @@ static const struct amvdec_format vdec_formats_gxm[] = { + + static const struct amvdec_format vdec_formats_g12a[] = { + { ++ .pixfmt = V4L2_PIX_FMT_H264, ++ .min_buffers = 2, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_1_ops, ++ .codec_ops = &codec_h264_ops, ++ .firmware_path = "meson/vdec/g12a_h264.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_MPEG1, + .min_buffers = 8, + .max_buffers = 8, +@@ -116,6 +165,18 @@ static const struct amvdec_format vdec_formats_g12a[] = { + + static const struct amvdec_format vdec_formats_sm1[] = { + { ++ .pixfmt = V4L2_PIX_FMT_H264, ++ .min_buffers = 2, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_1_ops, ++ .codec_ops = &codec_h264_ops, ++ .firmware_path = "meson/vdec/g12a_h264.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { .pixfmt = V4L2_PIX_FMT_MPEG1, .min_buffers = 8, diff --git a/packages/linux/patches/amlogic/amlogic-0109-TEMP-ARM64-dts-meson-activate-hdmi-audio-HDMI-enable.patch b/packages/linux/patches/amlogic/amlogic-0109-TEMP-ARM64-dts-meson-activate-hdmi-audio-HDMI-enable.patch deleted file mode 100644 index 433d5ee3d0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0109-TEMP-ARM64-dts-meson-activate-hdmi-audio-HDMI-enable.patch +++ /dev/null @@ -1,685 +0,0 @@ -From 17072407a46c9136c7b046adc3e96d661f6e7223 Mon Sep 17 00:00:00 2001 -From: Jerome Brunet -Date: Wed, 20 Sep 2017 18:10:08 +0200 -Subject: [PATCH 109/187] TEMP: ARM64: dts: meson: activate hdmi audio HDMI - enabled boards - -This patch activate audio over HDMI on selected boards - -Please note that this audio support is based on WIP changes -This should be considered as preview and it does not reflect -the audio I expect to see merged - -Signed-off-by: Jerome Brunet -Signed-off-by: Neil Armstrong ---- - .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 37 +++++++++++++++++++ - .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 37 +++++++++++++++++++ - .../dts/amlogic/meson-gxbb-nexbox-a95x.dts | 37 +++++++++++++++++++ - .../boot/dts/amlogic/meson-gxbb-odroidc2.dts | 37 +++++++++++++++++++ - .../boot/dts/amlogic/meson-gxbb-p20x.dtsi | 37 +++++++++++++++++++ - .../boot/dts/amlogic/meson-gxbb-wetek.dtsi | 37 +++++++++++++++++++ - .../amlogic/meson-gxl-s905x-khadas-vim.dts | 37 +++++++++++++++++++ - .../amlogic/meson-gxl-s905x-libretech-cc.dts | 37 +++++++++++++++++++ - .../amlogic/meson-gxl-s905x-nexbox-a95x.dts | 37 +++++++++++++++++++ - .../boot/dts/amlogic/meson-gxl-s905x-p212.dts | 37 +++++++++++++++++++ - .../dts/amlogic/meson-gxm-khadas-vim2.dts | 37 +++++++++++++++++++ - .../boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 37 +++++++++++++++++++ - 12 files changed, 444 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -index a9b778571cf5..05673221dcc3 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -@@ -102,6 +102,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -111,6 +140,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts -index c34c1c90ccb6..e555612a6612 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts -@@ -88,6 +88,35 @@ - clock-names = "ext_clock"; - }; - -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ - vcc1v8: regulator-vcc1v8 { - compatible = "regulator-fixed"; - regulator-name = "VCC1.8V"; -@@ -131,6 +160,14 @@ - }; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cec_AO { - status = "okay"; - pinctrl-0 = <&ao_cec_pins>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts -index b636912a2715..905e4bb70df9 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts -@@ -119,6 +119,35 @@ - clock-names = "ext_clock"; - }; - -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ - cvbs-connector { - compatible = "composite-video-connector"; - -@@ -154,6 +183,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - ðmac { - status = "okay"; - pinctrl-0 = <ð_rmii_pins>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -index 9972b1515da6..2facdf49f8ff 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -@@ -110,6 +110,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -119,6 +148,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - ðmac { - status = "okay"; - pinctrl-0 = <ð_rgmii_pins>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi -index e8f925871edf..3245859f7d2a 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi -@@ -113,6 +113,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -122,6 +151,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi -index 4c539881fbb7..6b7ac033ce22 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi -@@ -112,6 +112,43 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+}; -+ -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; - }; - - &cec_AO { -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -index 5499e8de5c74..bf3453f549dc 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -@@ -65,6 +65,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -74,6 +103,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &hdmi_tx { - status = "okay"; - pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -index 4b8ce738e213..969ee02e7429 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -@@ -84,6 +84,35 @@ - regulator-always-on; - }; - -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ - vcc_3v3: regulator-vcc_3v3 { - compatible = "regulator-fixed"; - regulator-name = "VCC_3V3"; -@@ -132,6 +161,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts -index 26907ac82930..93e1fbbe9438 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts -@@ -102,6 +102,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -111,6 +140,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts -index 2602940c2077..78c3060c5d56 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts -@@ -32,6 +32,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -41,6 +70,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -index 989d33ac6eae..f560eca12067 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -@@ -82,6 +82,35 @@ - }; - }; - -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ - pwmleds { - compatible = "pwm-leds"; - -@@ -198,6 +227,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cpu0 { - #cooling-cells = <2>; - }; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts -index c2bd4dbbf38c..b6519bbdaadb 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts -@@ -75,6 +75,35 @@ - }; - }; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; - }; - - &cec_AO { -@@ -84,6 +113,14 @@ - hdmi-phandle = <&hdmi_tx>; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0110-FROMLIST-media-meson-vdec-align-stride-on-32-bytes.patch b/packages/linux/patches/amlogic/amlogic-0110-FROMLIST-media-meson-vdec-align-stride-on-32-bytes.patch new file mode 100644 index 0000000000..93246482bd --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0110-FROMLIST-media-meson-vdec-align-stride-on-32-bytes.patch @@ -0,0 +1,77 @@ +From 9161e4a4818559fcacbe729957a98ddd554c846c Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 4 Dec 2019 10:40:13 +0100 +Subject: [PATCH 110/146] FROMLIST: media: meson: vdec: align stride on 32 + bytes + +The HEVC/VP9 aligns the plane stride on 32, so align the planes stride +for all codecs to 32 to satisfy HEVC/VP9 decoding using the "HEVC" HW. + +This fixes VP9 decoding of streams with following (not limited) widths: +- 264 + -288 +- 350 +- 352 +- 472 +- 480 +- 528 +- 600 +- 720 +- 800 +- 848 +- 1440 + +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/vdec.c | 10 +++++----- + drivers/staging/media/meson/vdec/vdec_helpers.c | 4 ++-- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c +index 92f0258868b1..bfca4c82aa56 100644 +--- a/drivers/staging/media/meson/vdec/vdec.c ++++ b/drivers/staging/media/meson/vdec/vdec.c +@@ -528,20 +528,20 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size, + memset(pfmt[1].reserved, 0, sizeof(pfmt[1].reserved)); + if (pixmp->pixelformat == V4L2_PIX_FMT_NV12M) { + pfmt[0].sizeimage = output_size; +- pfmt[0].bytesperline = ALIGN(pixmp->width, 64); ++ pfmt[0].bytesperline = ALIGN(pixmp->width, 32); + + pfmt[1].sizeimage = output_size / 2; +- pfmt[1].bytesperline = ALIGN(pixmp->width, 64); ++ pfmt[1].bytesperline = ALIGN(pixmp->width, 32); + pixmp->num_planes = 2; + } else if (pixmp->pixelformat == V4L2_PIX_FMT_YUV420M) { + pfmt[0].sizeimage = output_size; +- pfmt[0].bytesperline = ALIGN(pixmp->width, 64); ++ pfmt[0].bytesperline = ALIGN(pixmp->width, 32); + + pfmt[1].sizeimage = output_size / 4; +- pfmt[1].bytesperline = ALIGN(pixmp->width, 64) / 2; ++ pfmt[1].bytesperline = ALIGN(pixmp->width, 32) / 2; + + pfmt[2].sizeimage = output_size / 2; +- pfmt[2].bytesperline = ALIGN(pixmp->width, 64) / 2; ++ pfmt[2].bytesperline = ALIGN(pixmp->width, 32) / 2; + pixmp->num_planes = 3; + } + } +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index a4970ec1bf2e..3f7929c54dc6 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -154,8 +154,8 @@ int amvdec_set_canvases(struct amvdec_session *sess, + { + struct v4l2_m2m_buffer *buf; + u32 pixfmt = sess->pixfmt_cap; +- u32 width = ALIGN(sess->width, 64); +- u32 height = ALIGN(sess->height, 64); ++ u32 width = ALIGN(sess->width, 32); ++ u32 height = ALIGN(sess->height, 32); + u32 reg_cur = reg_base[0]; + u32 reg_num_cur = 0; + u32 reg_base_cur = 0; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0111-FROMLIST-media-meson-vdec-add-helpers-for-lossless-f.patch b/packages/linux/patches/amlogic/amlogic-0111-FROMLIST-media-meson-vdec-add-helpers-for-lossless-f.patch new file mode 100644 index 0000000000..21f431c470 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0111-FROMLIST-media-meson-vdec-add-helpers-for-lossless-f.patch @@ -0,0 +1,73 @@ +From 09c3c7a5c19c353272145a47b679356eadb5bc7c Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Sun, 21 Oct 2018 15:15:26 +0200 +Subject: [PATCH 111/146] FROMLIST: media: meson: vdec: add helpers for + lossless framebuffer compression buffers + +Add helpers to support the lossless framebuffer compression format that +will be used in HEVC & VP9 decoders when decoding 10bit content for +downsampling to 8bit NV12 and later proper compressed buffer support. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + .../staging/media/meson/vdec/vdec_helpers.c | 27 +++++++++++++++++++ + .../staging/media/meson/vdec/vdec_helpers.h | 4 +++ + 2 files changed, 31 insertions(+) + +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index 3f7929c54dc6..caec0fb60338 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -50,6 +50,33 @@ void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val) + } + EXPORT_SYMBOL_GPL(amvdec_write_parser); + ++/* 4 KiB per 64x32 block */ ++u32 amvdec_am21c_body_size(u32 width, u32 height) ++{ ++ u32 width_64 = ALIGN(width, 64) / 64; ++ u32 height_32 = ALIGN(height, 32) / 32; ++ ++ return SZ_4K * width_64 * height_32; ++} ++EXPORT_SYMBOL_GPL(amvdec_am21c_body_size); ++ ++/* 32 bytes per 128x64 block */ ++u32 amvdec_am21c_head_size(u32 width, u32 height) ++{ ++ u32 width_128 = ALIGN(width, 128) / 128; ++ u32 height_64 = ALIGN(height, 64) / 64; ++ ++ return 32 * width_128 * height_64; ++} ++EXPORT_SYMBOL_GPL(amvdec_am21c_head_size); ++ ++u32 amvdec_am21c_size(u32 width, u32 height) ++{ ++ return ALIGN(amvdec_am21c_body_size(width, height) + ++ amvdec_am21c_head_size(width, height), SZ_64K); ++} ++EXPORT_SYMBOL_GPL(amvdec_am21c_size); ++ + static int canvas_alloc(struct amvdec_session *sess, u8 *canvas_id) + { + int ret; +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h +index 165e6293ffba..cfaed52ab526 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.h ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.h +@@ -27,6 +27,10 @@ void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val); + u32 amvdec_read_parser(struct amvdec_core *core, u32 reg); + void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val); + ++u32 amvdec_am21c_body_size(u32 width, u32 height); ++u32 amvdec_am21c_head_size(u32 width, u32 height); ++u32 amvdec_am21c_size(u32 width, u32 height); ++ + /** + * amvdec_dst_buf_done_idx() - Signal that a buffer is done decoding + * +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0111-TEMP-fix-chmap_idx.patch b/packages/linux/patches/amlogic/amlogic-0111-TEMP-fix-chmap_idx.patch deleted file mode 100644 index 9762d8f0f3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0111-TEMP-fix-chmap_idx.patch +++ /dev/null @@ -1,26 +0,0 @@ -From de51342b266db75c82aabe89cef2eaa1a7a7212e Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 23 Dec 2018 02:24:38 +0100 -Subject: [PATCH 111/187] TEMP: fix chmap_idx - ---- - sound/soc/codecs/hdmi-codec.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c -index 0bf1c8cad108..bc300bb123e0 100644 ---- a/sound/soc/codecs/hdmi-codec.c -+++ b/sound/soc/codecs/hdmi-codec.c -@@ -369,7 +369,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - struct hdmi_codec_priv *hcp = info->private_data; - -- map = info->chmap[hcp->chmap_idx].map; -+ if (hcp->chmap_idx != HDMI_CODEC_CHMAP_IDX_UNKNOWN) -+ map = info->chmap[hcp->chmap_idx].map; - - for (i = 0; i < info->max_channels; i++) { - if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN) --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0112-FROMLIST-media-meson-vdec-add-common-HEVC-decoder-su.patch b/packages/linux/patches/amlogic/amlogic-0112-FROMLIST-media-meson-vdec-add-common-HEVC-decoder-su.patch new file mode 100644 index 0000000000..c0a11880d3 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0112-FROMLIST-media-meson-vdec-add-common-HEVC-decoder-su.patch @@ -0,0 +1,893 @@ +From 9842aec2ae55857deaee9f7eb994be6cc8d54590 Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Wed, 29 Aug 2018 18:48:35 +0200 +Subject: [PATCH 112/146] FROMLIST: media: meson: vdec: add common HEVC decoder + support + +Add support for the HEVC & VP9 common decoder support, handling +Amlogic GXBB, GXL, G12A and SM1 platforms. + +This handles the "HEVC" hw decoder used for HEVC and VP9, and will be +using in the new H264 multi-instance decoder for G12A & SM1 platforms. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/Makefile | 4 +- + .../media/meson/vdec/codec_hevc_common.c | 286 ++++++++++++++++++ + .../media/meson/vdec/codec_hevc_common.h | 77 +++++ + drivers/staging/media/meson/vdec/hevc_regs.h | 211 +++++++++++++ + drivers/staging/media/meson/vdec/vdec_hevc.c | 231 ++++++++++++++ + drivers/staging/media/meson/vdec/vdec_hevc.h | 13 + + 6 files changed, 820 insertions(+), 2 deletions(-) + create mode 100644 drivers/staging/media/meson/vdec/codec_hevc_common.c + create mode 100644 drivers/staging/media/meson/vdec/codec_hevc_common.h + create mode 100644 drivers/staging/media/meson/vdec/hevc_regs.h + create mode 100644 drivers/staging/media/meson/vdec/vdec_hevc.c + create mode 100644 drivers/staging/media/meson/vdec/vdec_hevc.h + +diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile +index 711d990c760e..f55b6e625034 100644 +--- a/drivers/staging/media/meson/vdec/Makefile ++++ b/drivers/staging/media/meson/vdec/Makefile +@@ -2,7 +2,7 @@ + # Makefile for Amlogic meson video decoder driver + + meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o +-meson-vdec-objs += vdec_1.o +-meson-vdec-objs += codec_mpeg12.o codec_h264.o ++meson-vdec-objs += vdec_1.o vdec_hevc.o ++meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o + + obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c +new file mode 100644 +index 000000000000..335bcba062ac +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c +@@ -0,0 +1,286 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ */ ++ ++#include ++#include ++ ++#include "codec_hevc_common.h" ++#include "vdec_helpers.h" ++#include "hevc_regs.h" ++ ++#define MMU_COMPRESS_HEADER_SIZE 0x48000 ++#define MMU_MAP_SIZE 0x4800 ++ ++/* Configure decode head read mode */ ++void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) ++{ ++ struct amvdec_core *core = sess->core; ++ u32 body_size = amvdec_am21c_body_size(sess->width, sess->height); ++ u32 head_size = amvdec_am21c_head_size(sess->width, sess->height); ++ ++ if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { ++ /* Enable 2-plane reference read mode */ ++ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(31)); ++ return; ++ } ++ ++ if (codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, is_10bit)) ++ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(4)); ++ else ++ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0); ++ ++ if (core->platform->revision < VDEC_REVISION_SM1) ++ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL2, body_size / 32); ++ amvdec_write_dos(core, HEVC_CM_BODY_LENGTH, body_size); ++ amvdec_write_dos(core, HEVC_CM_HEADER_OFFSET, body_size); ++ amvdec_write_dos(core, HEVC_CM_HEADER_LENGTH, head_size); ++} ++EXPORT_SYMBOL_GPL(codec_hevc_setup_decode_head); ++ ++static void codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, ++ struct codec_hevc_common *comm, ++ int is_10bit) ++{ ++ struct amvdec_core *core = sess->core; ++ struct v4l2_m2m_buffer *buf; ++ u32 buf_num = v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); ++ dma_addr_t buf_y_paddr = 0; ++ dma_addr_t buf_uv_paddr = 0; ++ u32 idx = 0; ++ u32 val; ++ int i; ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 0); ++ ++ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { ++ struct vb2_buffer *vb = &buf->vb.vb2_buf; ++ ++ idx = vb->index; ++ ++ if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) ++ buf_y_paddr = comm->fbc_buffer_paddr[idx]; ++ else ++ buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); ++ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { ++ val = buf_y_paddr | (idx << 8) | 1; ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, ++ val); ++ } else { ++ buf_uv_paddr = vb2_dma_contig_plane_dma_addr(vb, 1); ++ val = buf_y_paddr | ((idx * 2) << 8) | 1; ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, ++ val); ++ val = buf_uv_paddr | ((idx * 2 + 1) << 8) | 1; ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, ++ val); ++ } ++ } ++ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) ++ val = buf_y_paddr | (idx << 8) | 1; ++ else ++ val = buf_y_paddr | ((idx * 2) << 8) | 1; ++ ++ /* Fill the remaining unused slots with the last buffer's Y addr */ ++ for (i = buf_num; i < MAX_REF_PIC_NUM; ++i) ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 1); ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); ++ for (i = 0; i < 32; ++i) ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); ++} ++ ++static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, ++ struct codec_hevc_common *comm, ++ int is_10bit) ++{ ++ struct amvdec_core *core = sess->core; ++ struct v4l2_m2m_buffer *buf; ++ u32 revision = core->platform->revision; ++ u32 pixfmt_cap = sess->pixfmt_cap; ++ int i; ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, ++ BIT(2) | BIT(1)); ++ ++ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { ++ struct vb2_buffer *vb = &buf->vb.vb2_buf; ++ dma_addr_t buf_y_paddr = 0; ++ dma_addr_t buf_uv_paddr = 0; ++ u32 idx = vb->index; ++ ++ if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit)) ++ buf_y_paddr = comm->mmu_header_paddr[idx]; ++ else if (codec_hevc_use_downsample(pixfmt_cap, is_10bit)) ++ buf_y_paddr = comm->fbc_buffer_paddr[idx]; ++ else ++ buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, ++ buf_y_paddr >> 5); ++ ++ if (!codec_hevc_use_fbc(pixfmt_cap, is_10bit)) { ++ buf_uv_paddr = vb2_dma_contig_plane_dma_addr(vb, 1); ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, ++ buf_uv_paddr >> 5); ++ } ++ } ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 1); ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); ++ for (i = 0; i < 32; ++i) ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); ++} ++ ++void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm) ++{ ++ struct device *dev = sess->core->dev; ++ u32 am21_size = amvdec_am21c_size(sess->width, sess->height); ++ int i; ++ ++ for (i = 0; i < MAX_REF_PIC_NUM; ++i) { ++ if (comm->fbc_buffer_vaddr[i]) { ++ dma_free_coherent(dev, am21_size, ++ comm->fbc_buffer_vaddr[i], ++ comm->fbc_buffer_paddr[i]); ++ comm->fbc_buffer_vaddr[i] = NULL; ++ } ++ } ++} ++EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers); ++ ++static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm) ++{ ++ struct device *dev = sess->core->dev; ++ struct v4l2_m2m_buffer *buf; ++ u32 am21_size = amvdec_am21c_size(sess->width, sess->height); ++ ++ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { ++ u32 idx = buf->vb.vb2_buf.index; ++ dma_addr_t paddr; ++ void *vaddr = dma_alloc_coherent(dev, am21_size, &paddr, ++ GFP_KERNEL); ++ if (!vaddr) { ++ dev_err(dev, "Couldn't allocate FBC buffer %u\n", idx); ++ codec_hevc_free_fbc_buffers(sess, comm); ++ return -ENOMEM; ++ } ++ ++ comm->fbc_buffer_vaddr[idx] = vaddr; ++ comm->fbc_buffer_paddr[idx] = paddr; ++ } ++ ++ return 0; ++} ++ ++void codec_hevc_free_mmu_headers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm) ++{ ++ struct device *dev = sess->core->dev; ++ int i; ++ ++ for (i = 0; i < MAX_REF_PIC_NUM; ++i) { ++ if (comm->mmu_header_vaddr[i]) { ++ dma_free_coherent(dev, MMU_COMPRESS_HEADER_SIZE, ++ comm->mmu_header_vaddr[i], ++ comm->mmu_header_paddr[i]); ++ comm->mmu_header_vaddr[i] = NULL; ++ } ++ } ++ ++ if (comm->mmu_map_vaddr) { ++ dma_free_coherent(dev, MMU_MAP_SIZE, ++ comm->mmu_map_vaddr, ++ comm->mmu_map_paddr); ++ comm->mmu_map_vaddr = NULL; ++ } ++} ++EXPORT_SYMBOL_GPL(codec_hevc_free_mmu_headers); ++ ++static int codec_hevc_alloc_mmu_headers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm) ++{ ++ struct device *dev = sess->core->dev; ++ struct v4l2_m2m_buffer *buf; ++ ++ comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE, ++ &comm->mmu_map_paddr, ++ GFP_KERNEL); ++ if (!comm->mmu_map_vaddr) ++ return -ENOMEM; ++ ++ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { ++ u32 idx = buf->vb.vb2_buf.index; ++ dma_addr_t paddr; ++ void *vaddr = dma_alloc_coherent(dev, MMU_COMPRESS_HEADER_SIZE, ++ &paddr, GFP_KERNEL); ++ if (!vaddr) { ++ dev_err(dev, "Couldn't allocate MMU header %u\n", idx); ++ codec_hevc_free_mmu_headers(sess, comm); ++ return -ENOMEM; ++ } ++ ++ comm->mmu_header_vaddr[idx] = vaddr; ++ comm->mmu_header_paddr[idx] = paddr; ++ } ++ ++ return 0; ++} ++ ++int codec_hevc_setup_buffers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm, ++ int is_10bit) ++{ ++ struct amvdec_core *core = sess->core; ++ int ret; ++ ++ if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { ++ ret = codec_hevc_alloc_fbc_buffers(sess, comm); ++ if (ret) ++ return ret; ++ } ++ ++ if (codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, is_10bit)) { ++ ret = codec_hevc_alloc_mmu_headers(sess, comm); ++ if (ret) { ++ codec_hevc_free_fbc_buffers(sess, comm); ++ return ret; ++ } ++ } ++ ++ if (core->platform->revision == VDEC_REVISION_GXBB) ++ codec_hevc_setup_buffers_gxbb(sess, comm, is_10bit); ++ else ++ codec_hevc_setup_buffers_gxl(sess, comm, is_10bit); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers); ++ ++void codec_hevc_fill_mmu_map(struct amvdec_session *sess, ++ struct codec_hevc_common *comm, ++ struct vb2_buffer *vb) ++{ ++ u32 size = amvdec_am21c_size(sess->width, sess->height); ++ u32 nb_pages = size / PAGE_SIZE; ++ u32 *mmu_map = comm->mmu_map_vaddr; ++ u32 first_page; ++ u32 i; ++ ++ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) ++ first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT; ++ else ++ first_page = vb2_dma_contig_plane_dma_addr(vb, 0) >> PAGE_SHIFT; ++ ++ for (i = 0; i < nb_pages; ++i) ++ mmu_map[i] = first_page + i; ++} ++EXPORT_SYMBOL_GPL(codec_hevc_fill_mmu_map); +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.h b/drivers/staging/media/meson/vdec/codec_hevc_common.h +new file mode 100644 +index 000000000000..de16d2e43061 +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.h +@@ -0,0 +1,77 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2018 BayLibre, SAS ++ * Author: Maxime Jourdan ++ */ ++ ++#ifndef __MESON_VDEC_HEVC_COMMON_H_ ++#define __MESON_VDEC_HEVC_COMMON_H_ ++ ++#include "vdec.h" ++ ++#define PARSER_CMD_SKIP_CFG_0 0x0000090b ++#define PARSER_CMD_SKIP_CFG_1 0x1b14140f ++#define PARSER_CMD_SKIP_CFG_2 0x001b1910 ++static const u16 vdec_hevc_parser_cmd[] = { ++ 0x0401, 0x8401, 0x0800, 0x0402, ++ 0x9002, 0x1423, 0x8CC3, 0x1423, ++ 0x8804, 0x9825, 0x0800, 0x04FE, ++ 0x8406, 0x8411, 0x1800, 0x8408, ++ 0x8409, 0x8C2A, 0x9C2B, 0x1C00, ++ 0x840F, 0x8407, 0x8000, 0x8408, ++ 0x2000, 0xA800, 0x8410, 0x04DE, ++ 0x840C, 0x840D, 0xAC00, 0xA000, ++ 0x08C0, 0x08E0, 0xA40E, 0xFC00, ++ 0x7C00 ++}; ++ ++#define MAX_REF_PIC_NUM 24 ++ ++struct codec_hevc_common { ++ void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; ++ dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; ++ ++ void *mmu_header_vaddr[MAX_REF_PIC_NUM]; ++ dma_addr_t mmu_header_paddr[MAX_REF_PIC_NUM]; ++ ++ void *mmu_map_vaddr; ++ dma_addr_t mmu_map_paddr; ++}; ++ ++/* Returns 1 if we must use framebuffer compression */ ++static inline int codec_hevc_use_fbc(u32 pixfmt, int is_10bit) ++{ ++ /* TOFIX: Handle Amlogic Compressed buffer for 8bit also */ ++ return is_10bit; ++} ++ ++/* Returns 1 if we are decoding 10-bit but outputting 8-bit NV12 */ ++static inline int codec_hevc_use_downsample(u32 pixfmt, int is_10bit) ++{ ++ return is_10bit; ++} ++ ++/* Returns 1 if we are decoding using the IOMMU */ ++static inline int codec_hevc_use_mmu(u32 revision, u32 pixfmt, int is_10bit) ++{ ++ return revision >= VDEC_REVISION_G12A && ++ codec_hevc_use_fbc(pixfmt, is_10bit); ++} ++ ++/** ++ * Configure decode head read mode ++ */ ++void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit); ++ ++void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm); ++ ++int codec_hevc_setup_buffers(struct amvdec_session *sess, ++ struct codec_hevc_common *comm, ++ int is_10bit); ++ ++void codec_hevc_fill_mmu_map(struct amvdec_session *sess, ++ struct codec_hevc_common *comm, ++ struct vb2_buffer *vb); ++ ++#endif +diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h +new file mode 100644 +index 000000000000..55c1a80b955a +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/hevc_regs.h +@@ -0,0 +1,211 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. ++ */ ++ ++#ifndef __MESON_VDEC_HEVC_REGS_H_ ++#define __MESON_VDEC_HEVC_REGS_H_ ++ ++#define HEVC_ASSIST_MMU_MAP_ADDR 0xc024 ++ ++#define HEVC_ASSIST_MBOX1_CLR_REG 0xc1d4 ++#define HEVC_ASSIST_MBOX1_MASK 0xc1d8 ++ ++#define HEVC_ASSIST_SCRATCH_0 0xc300 ++#define HEVC_ASSIST_SCRATCH_1 0xc304 ++#define HEVC_ASSIST_SCRATCH_2 0xc308 ++#define HEVC_ASSIST_SCRATCH_3 0xc30c ++#define HEVC_ASSIST_SCRATCH_4 0xc310 ++#define HEVC_ASSIST_SCRATCH_5 0xc314 ++#define HEVC_ASSIST_SCRATCH_6 0xc318 ++#define HEVC_ASSIST_SCRATCH_7 0xc31c ++#define HEVC_ASSIST_SCRATCH_8 0xc320 ++#define HEVC_ASSIST_SCRATCH_9 0xc324 ++#define HEVC_ASSIST_SCRATCH_A 0xc328 ++#define HEVC_ASSIST_SCRATCH_B 0xc32c ++#define HEVC_ASSIST_SCRATCH_C 0xc330 ++#define HEVC_ASSIST_SCRATCH_D 0xc334 ++#define HEVC_ASSIST_SCRATCH_E 0xc338 ++#define HEVC_ASSIST_SCRATCH_F 0xc33c ++#define HEVC_ASSIST_SCRATCH_G 0xc340 ++#define HEVC_ASSIST_SCRATCH_H 0xc344 ++#define HEVC_ASSIST_SCRATCH_I 0xc348 ++#define HEVC_ASSIST_SCRATCH_J 0xc34c ++#define HEVC_ASSIST_SCRATCH_K 0xc350 ++#define HEVC_ASSIST_SCRATCH_L 0xc354 ++#define HEVC_ASSIST_SCRATCH_M 0xc358 ++#define HEVC_ASSIST_SCRATCH_N 0xc35c ++ ++#define HEVC_PARSER_VERSION 0xc400 ++#define HEVC_STREAM_CONTROL 0xc404 ++#define HEVC_STREAM_START_ADDR 0xc408 ++#define HEVC_STREAM_END_ADDR 0xc40c ++#define HEVC_STREAM_WR_PTR 0xc410 ++#define HEVC_STREAM_RD_PTR 0xc414 ++#define HEVC_STREAM_LEVEL 0xc418 ++#define HEVC_STREAM_FIFO_CTL 0xc41c ++#define HEVC_SHIFT_CONTROL 0xc420 ++#define HEVC_SHIFT_STARTCODE 0xc424 ++#define HEVC_SHIFT_EMULATECODE 0xc428 ++#define HEVC_SHIFT_STATUS 0xc42c ++#define HEVC_SHIFTED_DATA 0xc430 ++#define HEVC_SHIFT_BYTE_COUNT 0xc434 ++#define HEVC_SHIFT_COMMAND 0xc438 ++#define HEVC_ELEMENT_RESULT 0xc43c ++#define HEVC_CABAC_CONTROL 0xc440 ++#define HEVC_PARSER_SLICE_INFO 0xc444 ++#define HEVC_PARSER_CMD_WRITE 0xc448 ++#define HEVC_PARSER_CORE_CONTROL 0xc44c ++#define HEVC_PARSER_CMD_FETCH 0xc450 ++#define HEVC_PARSER_CMD_STATUS 0xc454 ++#define HEVC_PARSER_LCU_INFO 0xc458 ++#define HEVC_PARSER_HEADER_INFO 0xc45c ++#define HEVC_PARSER_INT_CONTROL 0xc480 ++#define HEVC_PARSER_INT_STATUS 0xc484 ++#define HEVC_PARSER_IF_CONTROL 0xc488 ++#define HEVC_PARSER_PICTURE_SIZE 0xc48c ++#define HEVC_PARSER_LCU_START 0xc490 ++#define HEVC_PARSER_HEADER_INFO2 0xc494 ++#define HEVC_PARSER_QUANT_READ 0xc498 ++#define HEVC_PARSER_RESERVED_27 0xc49c ++#define HEVC_PARSER_CMD_SKIP_0 0xc4a0 ++#define HEVC_PARSER_CMD_SKIP_1 0xc4a4 ++#define HEVC_PARSER_CMD_SKIP_2 0xc4a8 ++#define HEVC_SAO_IF_STATUS 0xc4c0 ++#define HEVC_SAO_IF_DATA_Y 0xc4c4 ++#define HEVC_SAO_IF_DATA_U 0xc4c8 ++#define HEVC_SAO_IF_DATA_V 0xc4cc ++#define HEVC_STREAM_SWAP_ADDR 0xc4d0 ++#define HEVC_STREAM_SWAP_CTRL 0xc4d4 ++#define HEVC_IQIT_IF_WAIT_CNT 0xc4d8 ++#define HEVC_MPRED_IF_WAIT_CNT 0xc4dc ++#define HEVC_SAO_IF_WAIT_CNT 0xc4e0 ++ ++#define HEVC_MPRED_VERSION 0xc800 ++#define HEVC_MPRED_CTRL0 0xc804 ++ #define MPRED_CTRL0_NEW_PIC BIT(2) ++ #define MPRED_CTRL0_NEW_TILE BIT(3) ++ #define MPRED_CTRL0_NEW_SLI_SEG BIT(4) ++ #define MPRED_CTRL0_TMVP BIT(5) ++ #define MPRED_CTRL0_LDC BIT(6) ++ #define MPRED_CTRL0_COL_FROM_L0 BIT(7) ++ #define MPRED_CTRL0_ABOVE_EN BIT(9) ++ #define MPRED_CTRL0_MV_WR_EN BIT(10) ++ #define MPRED_CTRL0_MV_RD_EN BIT(11) ++ #define MPRED_CTRL0_BUF_LINEAR BIT(13) ++#define HEVC_MPRED_CTRL1 0xc808 ++#define HEVC_MPRED_INT_EN 0xc80c ++#define HEVC_MPRED_INT_STATUS 0xc810 ++#define HEVC_MPRED_PIC_SIZE 0xc814 ++#define HEVC_MPRED_PIC_SIZE_LCU 0xc818 ++#define HEVC_MPRED_TILE_START 0xc81c ++#define HEVC_MPRED_TILE_SIZE_LCU 0xc820 ++#define HEVC_MPRED_REF_NUM 0xc824 ++#define HEVC_MPRED_REF_EN_L0 0xc830 ++#define HEVC_MPRED_REF_EN_L1 0xc834 ++#define HEVC_MPRED_COLREF_EN_L0 0xc838 ++#define HEVC_MPRED_COLREF_EN_L1 0xc83c ++#define HEVC_MPRED_AXI_WCTRL 0xc840 ++#define HEVC_MPRED_AXI_RCTRL 0xc844 ++#define HEVC_MPRED_ABV_START_ADDR 0xc848 ++#define HEVC_MPRED_MV_WR_START_ADDR 0xc84c ++#define HEVC_MPRED_MV_RD_START_ADDR 0xc850 ++#define HEVC_MPRED_MV_WPTR 0xc854 ++#define HEVC_MPRED_MV_RPTR 0xc858 ++#define HEVC_MPRED_MV_WR_ROW_JUMP 0xc85c ++#define HEVC_MPRED_MV_RD_ROW_JUMP 0xc860 ++#define HEVC_MPRED_CURR_LCU 0xc864 ++#define HEVC_MPRED_ABV_WPTR 0xc868 ++#define HEVC_MPRED_ABV_RPTR 0xc86c ++#define HEVC_MPRED_CTRL2 0xc870 ++#define HEVC_MPRED_CTRL3 0xc874 ++#define HEVC_MPRED_L0_REF00_POC 0xc880 ++#define HEVC_MPRED_L1_REF00_POC 0xc8c0 ++ ++#define HEVC_MPRED_CUR_POC 0xc980 ++#define HEVC_MPRED_COL_POC 0xc984 ++#define HEVC_MPRED_MV_RD_END_ADDR 0xc988 ++ ++#define HEVC_MSP 0xcc00 ++#define HEVC_MPSR 0xcc04 ++#define HEVC_MCPU_INTR_MSK 0xcc10 ++#define HEVC_MCPU_INTR_REQ 0xcc14 ++#define HEVC_CPSR 0xcc84 ++ ++#define HEVC_IMEM_DMA_CTRL 0xcd00 ++#define HEVC_IMEM_DMA_ADR 0xcd04 ++#define HEVC_IMEM_DMA_COUNT 0xcd08 ++ ++#define HEVCD_IPP_TOP_CNTL 0xd000 ++#define HEVCD_IPP_LINEBUFF_BASE 0xd024 ++#define HEVCD_IPP_AXIIF_CONFIG 0xd02c ++ ++#define HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR 0xd180 ++#define HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR 0xd184 ++#define HEVCD_MPP_ANC2AXI_TBL_DATA 0xd190 ++ ++#define HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR 0xd300 ++#define HEVCD_MPP_ANC_CANVAS_DATA_ADDR 0xd304 ++#define HEVCD_MPP_DECOMP_CTL1 0xd308 ++#define HEVCD_MPP_DECOMP_CTL2 0xd30c ++#define HEVCD_MCRCC_CTL1 0xd3c0 ++#define HEVCD_MCRCC_CTL2 0xd3c4 ++#define HEVCD_MCRCC_CTL3 0xd3c8 ++ ++#define HEVC_DBLK_CFG0 0xd400 ++#define HEVC_DBLK_CFG1 0xd404 ++#define HEVC_DBLK_CFG2 0xd408 ++#define HEVC_DBLK_CFG3 0xd40c ++#define HEVC_DBLK_CFG4 0xd410 ++#define HEVC_DBLK_CFG5 0xd414 ++#define HEVC_DBLK_CFG6 0xd418 ++#define HEVC_DBLK_CFG7 0xd41c ++#define HEVC_DBLK_CFG8 0xd420 ++#define HEVC_DBLK_CFG9 0xd424 ++#define HEVC_DBLK_CFGA 0xd428 ++#define HEVC_DBLK_STS0 0xd42c ++#define HEVC_DBLK_STS1 0xd430 ++#define HEVC_DBLK_CFGE 0xd438 ++ ++#define HEVC_SAO_VERSION 0xd800 ++#define HEVC_SAO_CTRL0 0xd804 ++#define HEVC_SAO_CTRL1 0xd808 ++#define HEVC_SAO_PIC_SIZE 0xd814 ++#define HEVC_SAO_PIC_SIZE_LCU 0xd818 ++#define HEVC_SAO_TILE_START 0xd81c ++#define HEVC_SAO_TILE_SIZE_LCU 0xd820 ++#define HEVC_SAO_Y_START_ADDR 0xd82c ++#define HEVC_SAO_Y_LENGTH 0xd830 ++#define HEVC_SAO_C_START_ADDR 0xd834 ++#define HEVC_SAO_C_LENGTH 0xd838 ++#define HEVC_SAO_Y_WPTR 0xd83c ++#define HEVC_SAO_C_WPTR 0xd840 ++#define HEVC_SAO_ABV_START_ADDR 0xd844 ++#define HEVC_SAO_VB_WR_START_ADDR 0xd848 ++#define HEVC_SAO_VB_RD_START_ADDR 0xd84c ++#define HEVC_SAO_ABV_WPTR 0xd850 ++#define HEVC_SAO_ABV_RPTR 0xd854 ++#define HEVC_SAO_VB_WPTR 0xd858 ++#define HEVC_SAO_VB_RPTR 0xd85c ++#define HEVC_SAO_CTRL2 0xd880 ++#define HEVC_SAO_CTRL3 0xd884 ++#define HEVC_SAO_CTRL4 0xd888 ++#define HEVC_SAO_CTRL5 0xd88c ++#define HEVC_SAO_CTRL6 0xd890 ++#define HEVC_SAO_CTRL7 0xd894 ++#define HEVC_CM_BODY_START_ADDR 0xd898 ++#define HEVC_CM_BODY_LENGTH 0xd89c ++#define HEVC_CM_HEADER_START_ADDR 0xd8a0 ++#define HEVC_CM_HEADER_LENGTH 0xd8a4 ++#define HEVC_CM_HEADER_OFFSET 0xd8ac ++#define HEVC_SAO_MMU_VH0_ADDR 0xd8e8 ++#define HEVC_SAO_MMU_VH1_ADDR 0xd8ec ++ ++#define HEVC_IQIT_CLK_RST_CTRL 0xdc00 ++#define HEVC_IQIT_SCALELUT_WR_ADDR 0xdc08 ++#define HEVC_IQIT_SCALELUT_RD_ADDR 0xdc0c ++#define HEVC_IQIT_SCALELUT_DATA 0xdc10 ++ ++#define HEVC_PSCALE_CTRL 0xe444 ++ ++#endif +diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c +new file mode 100644 +index 000000000000..af41215e106c +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/vdec_hevc.c +@@ -0,0 +1,231 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ * ++ * VDEC_HEVC is a video decoding block that allows decoding of ++ * HEVC, VP9 ++ */ ++ ++#include ++#include ++ ++#include "vdec_1.h" ++#include "vdec_helpers.h" ++#include "hevc_regs.h" ++#include "dos_regs.h" ++ ++/* AO Registers */ ++#define AO_RTI_GEN_PWR_SLEEP0 0xe8 ++#define AO_RTI_GEN_PWR_ISO0 0xec ++ #define GEN_PWR_VDEC_HEVC (BIT(7) | BIT(6)) ++ #define GEN_PWR_VDEC_HEVC_SM1 (BIT(2)) ++ ++#define MC_SIZE (4096 * 4) ++ ++static int vdec_hevc_load_firmware(struct amvdec_session *sess, ++ const char *fwname) ++{ ++ struct amvdec_core *core = sess->core; ++ struct device *dev = core->dev_dec; ++ const struct firmware *fw; ++ static void *mc_addr; ++ static dma_addr_t mc_addr_map; ++ int ret; ++ u32 i = 100; ++ ++ ret = request_firmware(&fw, fwname, dev); ++ if (ret < 0) { ++ dev_err(dev, "Unable to request firmware %s\n", fwname); ++ return ret; ++ } ++ ++ if (fw->size < MC_SIZE) { ++ dev_err(dev, "Firmware size %zu is too small. Expected %u.\n", ++ fw->size, MC_SIZE); ++ ret = -EINVAL; ++ goto release_firmware; ++ } ++ ++ mc_addr = dma_alloc_coherent(core->dev, MC_SIZE, &mc_addr_map, ++ GFP_KERNEL); ++ if (!mc_addr) { ++ dev_err(dev, "Failed allocating memory for firmware loading\n"); ++ ret = -ENOMEM; ++ goto release_firmware; ++ } ++ ++ memcpy(mc_addr, fw->data, MC_SIZE); ++ ++ amvdec_write_dos(core, HEVC_MPSR, 0); ++ amvdec_write_dos(core, HEVC_CPSR, 0); ++ ++ amvdec_write_dos(core, HEVC_IMEM_DMA_ADR, mc_addr_map); ++ amvdec_write_dos(core, HEVC_IMEM_DMA_COUNT, MC_SIZE / 4); ++ amvdec_write_dos(core, HEVC_IMEM_DMA_CTRL, (0x8000 | (7 << 16))); ++ ++ while (i && (readl(core->dos_base + HEVC_IMEM_DMA_CTRL) & 0x8000)) ++ i--; ++ ++ if (i == 0) { ++ dev_err(dev, "Firmware load fail (DMA hang?)\n"); ++ ret = -ENODEV; ++ } ++ ++ dma_free_coherent(core->dev, MC_SIZE, mc_addr, mc_addr_map); ++release_firmware: ++ release_firmware(fw); ++ return ret; ++} ++ ++static void vdec_hevc_stbuf_init(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ ++ amvdec_write_dos(core, HEVC_STREAM_CONTROL, ++ amvdec_read_dos(core, HEVC_STREAM_CONTROL) & ~1); ++ amvdec_write_dos(core, HEVC_STREAM_START_ADDR, sess->vififo_paddr); ++ amvdec_write_dos(core, HEVC_STREAM_END_ADDR, ++ sess->vififo_paddr + sess->vififo_size); ++ amvdec_write_dos(core, HEVC_STREAM_RD_PTR, sess->vififo_paddr); ++ amvdec_write_dos(core, HEVC_STREAM_WR_PTR, sess->vififo_paddr); ++} ++ ++/* VDEC_HEVC specific ESPARSER configuration */ ++static void vdec_hevc_conf_esparser(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ ++ /* set vififo_vbuf_rp_sel=>vdec_hevc */ ++ amvdec_write_dos(core, DOS_GEN_CTRL0, 3 << 1); ++ amvdec_write_dos(core, HEVC_STREAM_CONTROL, ++ amvdec_read_dos(core, HEVC_STREAM_CONTROL) | BIT(3)); ++ amvdec_write_dos(core, HEVC_STREAM_CONTROL, ++ amvdec_read_dos(core, HEVC_STREAM_CONTROL) | 1); ++ amvdec_write_dos(core, HEVC_STREAM_FIFO_CTL, ++ amvdec_read_dos(core, HEVC_STREAM_FIFO_CTL) | BIT(29)); ++} ++ ++static u32 vdec_hevc_vififo_level(struct amvdec_session *sess) ++{ ++ return readl_relaxed(sess->core->dos_base + HEVC_STREAM_LEVEL); ++} ++ ++static int vdec_hevc_stop(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; ++ ++ /* Disable interrupt */ ++ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_MASK, 0); ++ /* Disable firmware processor */ ++ amvdec_write_dos(core, HEVC_MPSR, 0); ++ ++ if (sess->priv) ++ codec_ops->stop(sess); ++ ++ /* Enable VDEC_HEVC Isolation */ ++ if (core->platform->revision == VDEC_REVISION_SM1) ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_ISO0, ++ GEN_PWR_VDEC_HEVC_SM1, ++ GEN_PWR_VDEC_HEVC_SM1); ++ else ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_ISO0, ++ 0xc00, 0xc00); ++ ++ /* VDEC_HEVC Memories */ ++ amvdec_write_dos(core, DOS_MEM_PD_HEVC, 0xffffffffUL); ++ ++ if (core->platform->revision == VDEC_REVISION_SM1) ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, ++ GEN_PWR_VDEC_HEVC_SM1, ++ GEN_PWR_VDEC_HEVC_SM1); ++ else ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, ++ GEN_PWR_VDEC_HEVC, GEN_PWR_VDEC_HEVC); ++ ++ clk_disable_unprepare(core->vdec_hevc_clk); ++ if (core->platform->revision == VDEC_REVISION_G12A || ++ core->platform->revision == VDEC_REVISION_SM1) ++ clk_disable_unprepare(core->vdec_hevcf_clk); ++ ++ return 0; ++} ++ ++static int vdec_hevc_start(struct amvdec_session *sess) ++{ ++ int ret; ++ struct amvdec_core *core = sess->core; ++ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; ++ ++ if (core->platform->revision == VDEC_REVISION_G12A || ++ core->platform->revision == VDEC_REVISION_SM1) { ++ clk_set_rate(core->vdec_hevcf_clk, 666666666); ++ ret = clk_prepare_enable(core->vdec_hevcf_clk); ++ if (ret) ++ return ret; ++ } ++ ++ clk_set_rate(core->vdec_hevc_clk, 666666666); ++ ret = clk_prepare_enable(core->vdec_hevc_clk); ++ if (ret) ++ return ret; ++ ++ if (core->platform->revision == VDEC_REVISION_SM1) ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, ++ GEN_PWR_VDEC_HEVC_SM1, 0); ++ else ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, ++ GEN_PWR_VDEC_HEVC, 0); ++ udelay(10); ++ ++ /* Reset VDEC_HEVC*/ ++ amvdec_write_dos(core, DOS_SW_RESET3, 0xffffffff); ++ amvdec_write_dos(core, DOS_SW_RESET3, 0x00000000); ++ ++ amvdec_write_dos(core, DOS_GCLK_EN3, 0xffffffff); ++ ++ /* VDEC_HEVC Memories */ ++ amvdec_write_dos(core, DOS_MEM_PD_HEVC, 0x00000000); ++ ++ /* Remove VDEC_HEVC Isolation */ ++ if (core->platform->revision == VDEC_REVISION_SM1) ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_ISO0, ++ GEN_PWR_VDEC_HEVC_SM1, 0); ++ else ++ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_ISO0, ++ 0xc00, 0); ++ ++ amvdec_write_dos(core, DOS_SW_RESET3, 0xffffffff); ++ amvdec_write_dos(core, DOS_SW_RESET3, 0x00000000); ++ ++ vdec_hevc_stbuf_init(sess); ++ ++ ret = vdec_hevc_load_firmware(sess, sess->fmt_out->firmware_path); ++ if (ret) ++ goto stop; ++ ++ ret = codec_ops->start(sess); ++ if (ret) ++ goto stop; ++ ++ amvdec_write_dos(core, DOS_SW_RESET3, BIT(12) | BIT(11)); ++ amvdec_write_dos(core, DOS_SW_RESET3, 0); ++ amvdec_read_dos(core, DOS_SW_RESET3); ++ ++ amvdec_write_dos(core, HEVC_MPSR, 1); ++ /* Let the firmware settle */ ++ udelay(10); ++ ++ return 0; ++ ++stop: ++ vdec_hevc_stop(sess); ++ return ret; ++} ++ ++struct amvdec_ops vdec_hevc_ops = { ++ .start = vdec_hevc_start, ++ .stop = vdec_hevc_stop, ++ .conf_esparser = vdec_hevc_conf_esparser, ++ .vififo_level = vdec_hevc_vififo_level, ++}; +diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.h b/drivers/staging/media/meson/vdec/vdec_hevc.h +new file mode 100644 +index 000000000000..cd576a73a966 +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/vdec_hevc.h +@@ -0,0 +1,13 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ */ ++ ++#ifndef __MESON_VDEC_VDEC_HEVC_H_ ++#define __MESON_VDEC_VDEC_HEVC_H_ ++ ++#include "vdec.h" ++ ++extern struct amvdec_ops vdec_hevc_ops; ++ ++#endif +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0113-FROMLIST-media-meson-vdec-add-VP9-input-support.patch b/packages/linux/patches/amlogic/amlogic-0113-FROMLIST-media-meson-vdec-add-VP9-input-support.patch new file mode 100644 index 0000000000..2c8e6d4c9b --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0113-FROMLIST-media-meson-vdec-add-VP9-input-support.patch @@ -0,0 +1,216 @@ +From 0852fcb597702d7b90feafa1ede9e358c8dc0fad Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Thu, 17 Jan 2019 16:59:11 +0100 +Subject: [PATCH 113/146] FROMLIST: media: meson: vdec: add VP9 input support + +Amlogic VP9 decoder requires an additional 16-byte payload before every +frame header. + +The source buffer is updated in-place, then given to the Parser FIFO DMA. + +The FIFO DMA copies the blocks into the 16MiB parser ring buffer, then parses +and copies the slice into the decoder "workspace". + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/esparser.c | 150 +++++++++++++++++++- + 1 file changed, 146 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c +index adc5c1e81a4c..4a9aad3fafeb 100644 +--- a/drivers/staging/media/meson/vdec/esparser.c ++++ b/drivers/staging/media/meson/vdec/esparser.c +@@ -52,6 +52,7 @@ + #define PARSER_VIDEO_HOLE 0x90 + + #define SEARCH_PATTERN_LEN 512 ++#define VP9_HEADER_SIZE 16 + + static DECLARE_WAIT_QUEUE_HEAD(wq); + static int search_done; +@@ -74,14 +75,121 @@ static irqreturn_t esparser_isr(int irq, void *dev) + return IRQ_HANDLED; + } + ++/** ++ * VP9 frame headers need to be appended by a 16-byte long ++ * Amlogic custom header ++ */ ++static int vp9_update_header(struct amvdec_core *core, struct vb2_buffer *buf) ++{ ++ u8 *dp; ++ u8 marker; ++ int dsize; ++ int num_frames, cur_frame; ++ int cur_mag, mag, mag_ptr; ++ int frame_size[8], tot_frame_size[8]; ++ int total_datasize = 0; ++ int new_frame_size; ++ unsigned char *old_header = NULL; ++ ++ dp = (uint8_t *)vb2_plane_vaddr(buf, 0); ++ dsize = vb2_get_plane_payload(buf, 0); ++ ++ if (dsize == vb2_plane_size(buf, 0)) { ++ dev_warn(core->dev, "%s: unable to update header\n", __func__); ++ return 0; ++ } ++ ++ marker = dp[dsize - 1]; ++ if ((marker & 0xe0) == 0xc0) { ++ num_frames = (marker & 0x7) + 1; ++ mag = ((marker >> 3) & 0x3) + 1; ++ mag_ptr = dsize - mag * num_frames - 2; ++ if (dp[mag_ptr] != marker) ++ return 0; ++ ++ mag_ptr++; ++ for (cur_frame = 0; cur_frame < num_frames; cur_frame++) { ++ frame_size[cur_frame] = 0; ++ for (cur_mag = 0; cur_mag < mag; cur_mag++) { ++ frame_size[cur_frame] |= ++ (dp[mag_ptr] << (cur_mag * 8)); ++ mag_ptr++; ++ } ++ if (cur_frame == 0) ++ tot_frame_size[cur_frame] = ++ frame_size[cur_frame]; ++ else ++ tot_frame_size[cur_frame] = ++ tot_frame_size[cur_frame - 1] + ++ frame_size[cur_frame]; ++ total_datasize += frame_size[cur_frame]; ++ } ++ } else { ++ num_frames = 1; ++ frame_size[0] = dsize; ++ tot_frame_size[0] = dsize; ++ total_datasize = dsize; ++ } ++ ++ new_frame_size = total_datasize + num_frames * VP9_HEADER_SIZE; ++ ++ if (new_frame_size >= vb2_plane_size(buf, 0)) { ++ dev_warn(core->dev, "%s: unable to update header\n", __func__); ++ return 0; ++ } ++ ++ for (cur_frame = num_frames - 1; cur_frame >= 0; cur_frame--) { ++ int framesize = frame_size[cur_frame]; ++ int framesize_header = framesize + 4; ++ int oldframeoff = tot_frame_size[cur_frame] - framesize; ++ int outheaderoff = oldframeoff + cur_frame * VP9_HEADER_SIZE; ++ u8 *fdata = dp + outheaderoff; ++ u8 *old_framedata = dp + oldframeoff; ++ ++ memmove(fdata + VP9_HEADER_SIZE, old_framedata, framesize); ++ ++ fdata[0] = (framesize_header >> 24) & 0xff; ++ fdata[1] = (framesize_header >> 16) & 0xff; ++ fdata[2] = (framesize_header >> 8) & 0xff; ++ fdata[3] = (framesize_header >> 0) & 0xff; ++ fdata[4] = ((framesize_header >> 24) & 0xff) ^ 0xff; ++ fdata[5] = ((framesize_header >> 16) & 0xff) ^ 0xff; ++ fdata[6] = ((framesize_header >> 8) & 0xff) ^ 0xff; ++ fdata[7] = ((framesize_header >> 0) & 0xff) ^ 0xff; ++ fdata[8] = 0; ++ fdata[9] = 0; ++ fdata[10] = 0; ++ fdata[11] = 1; ++ fdata[12] = 'A'; ++ fdata[13] = 'M'; ++ fdata[14] = 'L'; ++ fdata[15] = 'V'; ++ ++ if (!old_header) { ++ /* nothing */ ++ } else if (old_header > fdata + 16 + framesize) { ++ dev_dbg(core->dev, "%s: data has gaps, setting to 0\n", ++ __func__); ++ memset(fdata + 16 + framesize, 0, ++ (old_header - fdata + 16 + framesize)); ++ } else if (old_header < fdata + 16 + framesize) { ++ dev_err(core->dev, "%s: data overwritten\n", __func__); ++ } ++ old_header = fdata; ++ } ++ ++ return new_frame_size; ++} ++ + /* Pad the packet to at least 4KiB bytes otherwise the VDEC unit won't trigger + * ISRs. + * Also append a start code 000001ff at the end to trigger + * the ESPARSER interrupt. + */ +-static u32 esparser_pad_start_code(struct amvdec_core *core, struct vb2_buffer *vb) ++static u32 esparser_pad_start_code(struct amvdec_core *core, ++ struct vb2_buffer *vb, ++ u32 payload_size) + { +- u32 payload_size = vb2_get_plane_payload(vb, 0); + u32 pad_size = 0; + u8 *vaddr = vb2_plane_vaddr(vb, 0); + +@@ -186,13 +294,35 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + int ret; + struct vb2_buffer *vb = &vbuf->vb2_buf; + struct amvdec_core *core = sess->core; ++ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; + u32 payload_size = vb2_get_plane_payload(vb, 0); + dma_addr_t phy = vb2_dma_contig_plane_dma_addr(vb, 0); ++ u32 num_dst_bufs = 0; + u32 offset; + u32 pad_size; + +- if (esparser_vififo_get_free_space(sess) < payload_size) ++ /* ++ * When max ref frame is held by VP9, this should be -= 3 to prevent a ++ * shortage of CAPTURE buffers on the decoder side. ++ * For the future, a good enhancement of the way this is handled could ++ * be to notify new capture buffers to the decoding modules, so that ++ * they could pause when there is no capture buffer available and ++ * resume on this notification. ++ */ ++ if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9) { ++ if (codec_ops->num_pending_bufs) ++ num_dst_bufs = codec_ops->num_pending_bufs(sess); ++ ++ num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); ++ if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9) ++ num_dst_bufs -= 3; ++ ++ if (esparser_vififo_get_free_space(sess) < payload_size || ++ atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs) ++ return -EAGAIN; ++ } else if (esparser_vififo_get_free_space(sess) < payload_size) { + return -EAGAIN; ++ } + + v4l2_m2m_src_buf_remove_by_buf(sess->m2m_ctx, vbuf); + +@@ -206,7 +336,19 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + vbuf->field = V4L2_FIELD_NONE; + vbuf->sequence = sess->sequence_out++; + +- pad_size = esparser_pad_start_code(core, vb); ++ if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9) { ++ payload_size = vp9_update_header(core, vb); ++ ++ /* If unable to alter buffer to add headers */ ++ if (payload_size == 0) { ++ amvdec_remove_ts(sess, vb->timestamp); ++ v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); ++ ++ return 0; ++ } ++ } ++ ++ pad_size = esparser_pad_start_code(core, vb, payload_size); + ret = esparser_write_data(core, phy, payload_size + pad_size); + + if (ret <= 0) { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0113-TEMP-multi-channel-GX-audio-hack.patch b/packages/linux/patches/amlogic/amlogic-0113-TEMP-multi-channel-GX-audio-hack.patch deleted file mode 100644 index b5f59d6e3e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0113-TEMP-multi-channel-GX-audio-hack.patch +++ /dev/null @@ -1,197 +0,0 @@ -From 7b572f6ef91ca25e9b6cc459aaa71220827aadb5 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 1 Jun 2019 16:42:33 +0000 -Subject: [PATCH 113/187] TEMP: multi-channel GX audio hack - ---- - .../drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 2 + - sound/soc/codecs/hdmi-codec.c | 24 +++++++- - sound/soc/meson-gx/aiu-i2s.c | 56 ++++++++++++++++++- - 3 files changed, 79 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index 1d15cf9b6821..63ca25dfc129 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -57,6 +57,8 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; - conf0 = (HDMI_AUD_CONF0_I2S_SELECT | HDMI_AUD_CONF0_I2S_EN0); - -+ dev_info(dev, "channels=%d sample_width=%d sample_rate=%d\n", hparms->channels, hparms->sample_width, hparms->sample_rate); -+ - /* Enable the required i2s lanes */ - switch (hparms->channels) { - case 7 ... 8: -diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c -index 3b253589a012..608c3638741f 100644 ---- a/sound/soc/codecs/hdmi-codec.c -+++ b/sound/soc/codecs/hdmi-codec.c -@@ -257,6 +257,28 @@ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { - .mask = FL | FR | LFE | FLC | FRC }, - { .ca_id = 0x14, .n_ch = 8, - .mask = FL | FR | FLC | FRC }, -+ { .ca_id = 0x0b, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | RL | RR }, -+ { .ca_id = 0x0a, .n_ch = 8, -+ .mask = FL | FR | FC | RL | RR }, -+ { .ca_id = 0x09, .n_ch = 8, -+ .mask = FL | FR | LFE | RL | RR }, -+ { .ca_id = 0x08, .n_ch = 8, -+ .mask = FL | FR | RL | RR }, -+ { .ca_id = 0x07, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | RC }, -+ { .ca_id = 0x06, .n_ch = 8, -+ .mask = FL | FR | FC | RC }, -+ { .ca_id = 0x05, .n_ch = 8, -+ .mask = FL | FR | LFE | RC }, -+ { .ca_id = 0x04, .n_ch = 8, -+ .mask = FL | FR | RC }, -+ { .ca_id = 0x03, .n_ch = 8, -+ .mask = FL | FR | LFE | FC }, -+ { .ca_id = 0x02, .n_ch = 8, -+ .mask = FL | FR | FC }, -+ { .ca_id = 0x01, .n_ch = 8, -+ .mask = FL | FR | LFE }, - }; - - struct hdmi_codec_priv { -@@ -439,7 +461,7 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, - }; - int ret, idx; - -- dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, -+ dev_info(dai->dev, "%s() width %d rate %d channels %d\n", __func__, - params_width(params), params_rate(params), - params_channels(params)); - -diff --git a/sound/soc/meson-gx/aiu-i2s.c b/sound/soc/meson-gx/aiu-i2s.c -index c6bfd5d8c808..ef800b53ab95 100644 ---- a/sound/soc/meson-gx/aiu-i2s.c -+++ b/sound/soc/meson-gx/aiu-i2s.c -@@ -86,6 +86,7 @@ static struct snd_pcm_hardware meson_aiu_i2s_dma_hw = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_PAUSE), - - .formats = (SNDRV_PCM_FMTBIT_S16_LE | -@@ -137,10 +138,22 @@ static void __dma_enable(struct meson_aiu_i2s *priv, bool enable) - { - unsigned int en_mask = (AIU_MEM_I2S_CONTROL_FILL_EN | - AIU_MEM_I2S_CONTROL_EMPTY_EN); -+ unsigned int val; -+ -+ pr_info("%s: enable=%d\n", __func__, enable); -+ -+ if (enable) { -+ regmap_write(priv->core->aiu, AIU_RST_SOFT, AIU_RST_SOFT_I2S_FAST_DOMAIN); -+ regmap_read(priv->core->aiu, AIU_I2S_SYNC, &val); -+ } - - regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, en_mask, - enable ? en_mask : 0); - -+ if (!enable) { -+ regmap_write(priv->core->aiu, AIU_RST_SOFT, AIU_RST_SOFT_I2S_FAST_DOMAIN); -+ regmap_read(priv->core->aiu, AIU_I2S_SYNC, &val); -+ } - } - - static int meson_aiu_i2s_dma_trigger(struct snd_pcm_substream *substream, int cmd) -@@ -167,6 +180,8 @@ static int meson_aiu_i2s_dma_trigger(struct snd_pcm_substream *substream, int cm - - static void __dma_init_mem(struct meson_aiu_i2s *priv) - { -+ pr_info("%s\n", __func__); -+ - regmap_update_bits(priv->core->aiu, AIU_MEM_I2S_CONTROL, - AIU_MEM_I2S_CONTROL_INIT, - AIU_MEM_I2S_CONTROL_INIT); -@@ -199,6 +214,9 @@ static int meson_aiu_i2s_dma_hw_params(struct snd_pcm_substream *substream, - int ret; - u32 burst_num, mem_ctl; - dma_addr_t end_ptr; -+ unsigned int val; -+ -+ pr_info("%s: physical_width=%d buffer_bytes=%d period_bytes=%d\n", __func__, params_physical_width(params), params_buffer_bytes(params), params_period_bytes(params)); - - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) -@@ -229,6 +247,10 @@ static int meson_aiu_i2s_dma_hw_params(struct snd_pcm_substream *substream, - AIU_MEM_I2S_MASKS_CH_MEM(0xff) | - AIU_MEM_I2S_MASKS_IRQ_BLOCK(burst_num)); - -+ regmap_write(priv->core->aiu, AIU_RST_SOFT, -+ AIU_RST_SOFT_I2S_FAST_DOMAIN); -+ regmap_read(priv->core->aiu, AIU_I2S_SYNC, &val); -+ - return 0; - } - -@@ -247,6 +269,16 @@ static irqreturn_t meson_aiu_i2s_dma_irq_block(int irq, void *dev_id) - return IRQ_HANDLED; - } - -+static const unsigned int channels_2_8[] = { -+ 2, 8 -+}; -+ -+static const struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = { -+ .count = ARRAY_SIZE(channels_2_8), -+ .list = channels_2_8, -+ .mask = 0, -+}; -+ - static int meson_aiu_i2s_dma_open(struct snd_pcm_substream *substream) - { - struct meson_aiu_i2s *priv = meson_aiu_i2s_dma_priv(substream); -@@ -254,6 +286,10 @@ static int meson_aiu_i2s_dma_open(struct snd_pcm_substream *substream) - - snd_soc_set_runtime_hwparams(substream, &meson_aiu_i2s_dma_hw); - -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_CHANNELS, -+ &hw_constraints_2_8_channels); -+ - /* - * Make sure the buffer and period size are multiple of the DMA burst - * size -@@ -359,9 +395,20 @@ static int meson_aiu_i2s_dma_new(struct snd_soc_pcm_runtime *rtd) - - static void __hold(struct meson_aiu_i2s *priv, bool enable) - { -+ unsigned int val; -+ pr_info("%s: enable=%d\n", __func__, enable); -+ -+ if (enable) { - regmap_update_bits(priv->core->aiu, AIU_I2S_MISC, -- AIU_I2S_MISC_HOLD_EN, -- enable ? AIU_I2S_MISC_HOLD_EN : 0); -+ AIU_I2S_MISC_HOLD_EN | BIT(4), -+ AIU_I2S_MISC_HOLD_EN); -+ } else { -+ regmap_write(priv->core->aiu, AIU_I2S_MUTE_SWAP, 0xFF); -+ regmap_update_bits(priv->core->aiu, AIU_I2S_MISC, -+ AIU_I2S_MISC_HOLD_EN | BIT(4), -+ BIT(4)); -+ regmap_read(priv->core->aiu, AIU_I2S_SYNC, &val); -+ } - } - - static void __divider_enable(struct meson_aiu_i2s *priv, bool enable) -@@ -479,6 +526,11 @@ static int __setup_desc(struct meson_aiu_i2s *priv, unsigned int width, - return -EINVAL; - } - -+ pr_info("%s: width=%d channels=%d desc=%u\n", __func__, width, channels, desc); -+ -+ regmap_write(priv->core->aiu, AIU_I2S_SOURCE_DESC, -+ AIU_I2S_SOURCE_DESC_MODE_SPLIT); -+ - regmap_update_bits(priv->core->aiu, AIU_I2S_SOURCE_DESC, - AIU_I2S_SOURCE_DESC_MODE_8CH | - AIU_I2S_SOURCE_DESC_MODE_24BIT | --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0114-FROMLIST-media-meson-vdec-add-VP9-decoder-support.patch b/packages/linux/patches/amlogic/amlogic-0114-FROMLIST-media-meson-vdec-add-VP9-decoder-support.patch new file mode 100644 index 0000000000..09291e06ef --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0114-FROMLIST-media-meson-vdec-add-VP9-decoder-support.patch @@ -0,0 +1,2348 @@ +From f2421a193094a89b7aab30873c6e9501efa4ec42 Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Thu, 17 Jan 2019 17:00:11 +0100 +Subject: [PATCH 114/146] FROMLIST: media: meson: vdec: add VP9 decoder support + +This adds VP9 decoding for the Amlogic GXL, G12A & SM1 SoCs, using +the commong "HEVC" HW decoder. + +For G12A & SM1, it uses the IOMMU support from the firmware. + +For 10bit decoding, the firmware can only decode in the proprietary +Amlogic Framebuffer Compression format, but can output in 8bit NV12 +buffer while writing the decoded frame. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/Makefile | 2 +- + drivers/staging/media/meson/vdec/codec_vp9.c | 2138 +++++++++++++++++ + drivers/staging/media/meson/vdec/codec_vp9.h | 13 + + drivers/staging/media/meson/vdec/hevc_regs.h | 7 + + drivers/staging/media/meson/vdec/vdec.c | 5 + + .../staging/media/meson/vdec/vdec_helpers.c | 4 + + .../staging/media/meson/vdec/vdec_platform.c | 38 + + 7 files changed, 2206 insertions(+), 1 deletion(-) + create mode 100644 drivers/staging/media/meson/vdec/codec_vp9.c + create mode 100644 drivers/staging/media/meson/vdec/codec_vp9.h + +diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile +index f55b6e625034..6e726af84ac9 100644 +--- a/drivers/staging/media/meson/vdec/Makefile ++++ b/drivers/staging/media/meson/vdec/Makefile +@@ -3,6 +3,6 @@ + + meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o + meson-vdec-objs += vdec_1.o vdec_hevc.o +-meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o ++meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o codec_vp9.o + + obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +new file mode 100644 +index 000000000000..e7ffbc6dd892 +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -0,0 +1,2138 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. ++ */ ++ ++#include ++#include ++ ++#include "dos_regs.h" ++#include "hevc_regs.h" ++#include "vdec_helpers.h" ++#include "codec_hevc_common.h" ++ ++/* HEVC reg mapping */ ++#define VP9_DEC_STATUS_REG HEVC_ASSIST_SCRATCH_0 ++ #define VP9_10B_DECODE_SLICE 5 ++ #define VP9_HEAD_PARSER_DONE 0xf0 ++#define VP9_RPM_BUFFER HEVC_ASSIST_SCRATCH_1 ++#define VP9_SHORT_TERM_RPS HEVC_ASSIST_SCRATCH_2 ++#define VP9_ADAPT_PROB_REG HEVC_ASSIST_SCRATCH_3 ++#define VP9_MMU_MAP_BUFFER HEVC_ASSIST_SCRATCH_4 ++#define VP9_PPS_BUFFER HEVC_ASSIST_SCRATCH_5 ++#define VP9_SAO_UP HEVC_ASSIST_SCRATCH_6 ++#define VP9_STREAM_SWAP_BUFFER HEVC_ASSIST_SCRATCH_7 ++#define VP9_STREAM_SWAP_BUFFER2 HEVC_ASSIST_SCRATCH_8 ++#define VP9_PROB_SWAP_BUFFER HEVC_ASSIST_SCRATCH_9 ++#define VP9_COUNT_SWAP_BUFFER HEVC_ASSIST_SCRATCH_A ++#define VP9_SEG_MAP_BUFFER HEVC_ASSIST_SCRATCH_B ++#define VP9_SCALELUT HEVC_ASSIST_SCRATCH_D ++#define VP9_WAIT_FLAG HEVC_ASSIST_SCRATCH_E ++#define LMEM_DUMP_ADR HEVC_ASSIST_SCRATCH_F ++#define NAL_SEARCH_CTL HEVC_ASSIST_SCRATCH_I ++#define VP9_DECODE_MODE HEVC_ASSIST_SCRATCH_J ++ #define DECODE_MODE_SINGLE 0 ++#define DECODE_STOP_POS HEVC_ASSIST_SCRATCH_K ++#define HEVC_DECODE_COUNT HEVC_ASSIST_SCRATCH_M ++#define HEVC_DECODE_SIZE HEVC_ASSIST_SCRATCH_N ++ ++/* VP9 Constants */ ++#define LCU_SIZE 64 ++#define MAX_REF_PIC_NUM 24 ++#define REFS_PER_FRAME 3 ++#define REF_FRAMES 8 ++#define MV_MEM_UNIT 0x240 ++#define ADAPT_PROB_SIZE 0xf80 ++ ++enum FRAME_TYPE { ++ KEY_FRAME = 0, ++ INTER_FRAME = 1, ++ FRAME_TYPES, ++}; ++ ++/* VP9 Workspace layout */ ++#define MPRED_MV_BUF_SIZE 0x120000 ++ ++#define IPP_SIZE 0x4000 ++#define SAO_ABV_SIZE 0x30000 ++#define SAO_VB_SIZE 0x30000 ++#define SH_TM_RPS_SIZE 0x800 ++#define VPS_SIZE 0x800 ++#define SPS_SIZE 0x800 ++#define PPS_SIZE 0x2000 ++#define SAO_UP_SIZE 0x2800 ++#define SWAP_BUF_SIZE 0x800 ++#define SWAP_BUF2_SIZE 0x800 ++#define SCALELUT_SIZE 0x8000 ++#define DBLK_PARA_SIZE 0x80000 ++#define DBLK_DATA_SIZE 0x80000 ++#define SEG_MAP_SIZE 0xd800 ++#define PROB_SIZE 0x5000 ++#define COUNT_SIZE 0x3000 ++#define MMU_VBH_SIZE 0x5000 ++#define MPRED_ABV_SIZE 0x10000 ++#define MPRED_MV_SIZE (MPRED_MV_BUF_SIZE * MAX_REF_PIC_NUM) ++#define RPM_BUF_SIZE 0x100 ++#define LMEM_SIZE 0x800 ++ ++#define IPP_OFFSET 0x00 ++#define SAO_ABV_OFFSET (IPP_OFFSET + IPP_SIZE) ++#define SAO_VB_OFFSET (SAO_ABV_OFFSET + SAO_ABV_SIZE) ++#define SH_TM_RPS_OFFSET (SAO_VB_OFFSET + SAO_VB_SIZE) ++#define VPS_OFFSET (SH_TM_RPS_OFFSET + SH_TM_RPS_SIZE) ++#define SPS_OFFSET (VPS_OFFSET + VPS_SIZE) ++#define PPS_OFFSET (SPS_OFFSET + SPS_SIZE) ++#define SAO_UP_OFFSET (PPS_OFFSET + PPS_SIZE) ++#define SWAP_BUF_OFFSET (SAO_UP_OFFSET + SAO_UP_SIZE) ++#define SWAP_BUF2_OFFSET (SWAP_BUF_OFFSET + SWAP_BUF_SIZE) ++#define SCALELUT_OFFSET (SWAP_BUF2_OFFSET + SWAP_BUF2_SIZE) ++#define DBLK_PARA_OFFSET (SCALELUT_OFFSET + SCALELUT_SIZE) ++#define DBLK_DATA_OFFSET (DBLK_PARA_OFFSET + DBLK_PARA_SIZE) ++#define SEG_MAP_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) ++#define PROB_OFFSET (SEG_MAP_OFFSET + SEG_MAP_SIZE) ++#define COUNT_OFFSET (PROB_OFFSET + PROB_SIZE) ++#define MMU_VBH_OFFSET (COUNT_OFFSET + COUNT_SIZE) ++#define MPRED_ABV_OFFSET (MMU_VBH_OFFSET + MMU_VBH_SIZE) ++#define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) ++#define RPM_OFFSET (MPRED_MV_OFFSET + MPRED_MV_SIZE) ++#define LMEM_OFFSET (RPM_OFFSET + RPM_BUF_SIZE) ++ ++#define SIZE_WORKSPACE ALIGN(LMEM_OFFSET + LMEM_SIZE, 64 * SZ_1K) ++ ++#define NONE -1 ++#define INTRA_FRAME 0 ++#define LAST_FRAME 1 ++#define GOLDEN_FRAME 2 ++#define ALTREF_FRAME 3 ++#define MAX_REF_FRAMES 4 ++ ++/* ++ * Defines, declarations, sub-functions for vp9 de-block loop ++ filter Thr/Lvl table update ++ * - struct segmentation is for loop filter only (removed something) ++ * - function "vp9_loop_filter_init" and "vp9_loop_filter_frame_init" will ++ be instantiated in C_Entry ++ * - vp9_loop_filter_init run once before decoding start ++ * - vp9_loop_filter_frame_init run before every frame decoding start ++ * - set video format to VP9 is in vp9_loop_filter_init ++ */ ++#define MAX_LOOP_FILTER 63 ++#define MAX_REF_LF_DELTAS 4 ++#define MAX_MODE_LF_DELTAS 2 ++#define SEGMENT_DELTADATA 0 ++#define SEGMENT_ABSDATA 1 ++#define MAX_SEGMENTS 8 ++ ++/* VP9 PROB processing defines */ ++#define VP9_PARTITION_START 0 ++#define VP9_PARTITION_SIZE_STEP (3 * 4) ++#define VP9_PARTITION_ONE_SIZE (4 * VP9_PARTITION_SIZE_STEP) ++#define VP9_PARTITION_KEY_START 0 ++#define VP9_PARTITION_P_START VP9_PARTITION_ONE_SIZE ++#define VP9_PARTITION_SIZE (2 * VP9_PARTITION_ONE_SIZE) ++#define VP9_SKIP_START (VP9_PARTITION_START + VP9_PARTITION_SIZE) ++#define VP9_SKIP_SIZE 4 /* only use 3*/ ++#define VP9_TX_MODE_START (VP9_SKIP_START + VP9_SKIP_SIZE) ++#define VP9_TX_MODE_8_0_OFFSET 0 ++#define VP9_TX_MODE_8_1_OFFSET 1 ++#define VP9_TX_MODE_16_0_OFFSET 2 ++#define VP9_TX_MODE_16_1_OFFSET 4 ++#define VP9_TX_MODE_32_0_OFFSET 6 ++#define VP9_TX_MODE_32_1_OFFSET 9 ++#define VP9_TX_MODE_SIZE 12 ++#define VP9_COEF_START (VP9_TX_MODE_START + VP9_TX_MODE_SIZE) ++#define VP9_COEF_BAND_0_OFFSET 0 ++#define VP9_COEF_BAND_1_OFFSET (VP9_COEF_BAND_0_OFFSET + 3 * 3 + 1) ++#define VP9_COEF_BAND_2_OFFSET (VP9_COEF_BAND_1_OFFSET + 6 * 3) ++#define VP9_COEF_BAND_3_OFFSET (VP9_COEF_BAND_2_OFFSET + 6 * 3) ++#define VP9_COEF_BAND_4_OFFSET (VP9_COEF_BAND_3_OFFSET + 6 * 3) ++#define VP9_COEF_BAND_5_OFFSET (VP9_COEF_BAND_4_OFFSET + 6 * 3) ++#define VP9_COEF_SIZE_ONE_SET 100 /* ((3 + 5 * 6) * 3 + 1 padding)*/ ++#define VP9_COEF_4X4_START (VP9_COEF_START + 0 * VP9_COEF_SIZE_ONE_SET) ++#define VP9_COEF_8X8_START (VP9_COEF_START + 4 * VP9_COEF_SIZE_ONE_SET) ++#define VP9_COEF_16X16_START (VP9_COEF_START + 8 * VP9_COEF_SIZE_ONE_SET) ++#define VP9_COEF_32X32_START (VP9_COEF_START + 12 * VP9_COEF_SIZE_ONE_SET) ++#define VP9_COEF_SIZE_PLANE (2 * VP9_COEF_SIZE_ONE_SET) ++#define VP9_COEF_SIZE (4 * 2 * 2 * VP9_COEF_SIZE_ONE_SET) ++#define VP9_INTER_MODE_START (VP9_COEF_START + VP9_COEF_SIZE) ++#define VP9_INTER_MODE_SIZE 24 /* only use 21 (# * 7)*/ ++#define VP9_INTERP_START (VP9_INTER_MODE_START + VP9_INTER_MODE_SIZE) ++#define VP9_INTERP_SIZE 8 ++#define VP9_INTRA_INTER_START (VP9_INTERP_START + VP9_INTERP_SIZE) ++#define VP9_INTRA_INTER_SIZE 4 ++#define VP9_INTERP_INTRA_INTER_START VP9_INTERP_START ++#define VP9_INTERP_INTRA_INTER_SIZE (VP9_INTERP_SIZE + VP9_INTRA_INTER_SIZE) ++#define VP9_COMP_INTER_START \ ++ (VP9_INTERP_INTRA_INTER_START + VP9_INTERP_INTRA_INTER_SIZE) ++#define VP9_COMP_INTER_SIZE 5 ++#define VP9_COMP_REF_START (VP9_COMP_INTER_START + VP9_COMP_INTER_SIZE) ++#define VP9_COMP_REF_SIZE 5 ++#define VP9_SINGLE_REF_START (VP9_COMP_REF_START + VP9_COMP_REF_SIZE) ++#define VP9_SINGLE_REF_SIZE 10 ++#define VP9_REF_MODE_START VP9_COMP_INTER_START ++#define VP9_REF_MODE_SIZE \ ++ (VP9_COMP_INTER_SIZE + VP9_COMP_REF_SIZE + VP9_SINGLE_REF_SIZE) ++#define VP9_IF_Y_MODE_START (VP9_REF_MODE_START + VP9_REF_MODE_SIZE) ++#define VP9_IF_Y_MODE_SIZE 36 ++#define VP9_IF_UV_MODE_START (VP9_IF_Y_MODE_START + VP9_IF_Y_MODE_SIZE) ++#define VP9_IF_UV_MODE_SIZE 92 /* only use 90*/ ++#define VP9_MV_JOINTS_START (VP9_IF_UV_MODE_START + VP9_IF_UV_MODE_SIZE) ++#define VP9_MV_JOINTS_SIZE 3 ++#define VP9_MV_SIGN_0_START (VP9_MV_JOINTS_START + VP9_MV_JOINTS_SIZE) ++#define VP9_MV_SIGN_0_SIZE 1 ++#define VP9_MV_CLASSES_0_START (VP9_MV_SIGN_0_START + VP9_MV_SIGN_0_SIZE) ++#define VP9_MV_CLASSES_0_SIZE 10 ++#define VP9_MV_CLASS0_0_START \ ++ (VP9_MV_CLASSES_0_START + VP9_MV_CLASSES_0_SIZE) ++#define VP9_MV_CLASS0_0_SIZE 1 ++#define VP9_MV_BITS_0_START (VP9_MV_CLASS0_0_START + VP9_MV_CLASS0_0_SIZE) ++#define VP9_MV_BITS_0_SIZE 10 ++#define VP9_MV_SIGN_1_START (VP9_MV_BITS_0_START + VP9_MV_BITS_0_SIZE) ++#define VP9_MV_SIGN_1_SIZE 1 ++#define VP9_MV_CLASSES_1_START \ ++ (VP9_MV_SIGN_1_START + VP9_MV_SIGN_1_SIZE) ++#define VP9_MV_CLASSES_1_SIZE 10 ++#define VP9_MV_CLASS0_1_START \ ++ (VP9_MV_CLASSES_1_START + VP9_MV_CLASSES_1_SIZE) ++#define VP9_MV_CLASS0_1_SIZE 1 ++#define VP9_MV_BITS_1_START \ ++ (VP9_MV_CLASS0_1_START + VP9_MV_CLASS0_1_SIZE) ++#define VP9_MV_BITS_1_SIZE 10 ++#define VP9_MV_CLASS0_FP_0_START \ ++ (VP9_MV_BITS_1_START + VP9_MV_BITS_1_SIZE) ++#define VP9_MV_CLASS0_FP_0_SIZE 9 ++#define VP9_MV_CLASS0_FP_1_START \ ++ (VP9_MV_CLASS0_FP_0_START + VP9_MV_CLASS0_FP_0_SIZE) ++#define VP9_MV_CLASS0_FP_1_SIZE 9 ++#define VP9_MV_CLASS0_HP_0_START \ ++ (VP9_MV_CLASS0_FP_1_START + VP9_MV_CLASS0_FP_1_SIZE) ++#define VP9_MV_CLASS0_HP_0_SIZE 2 ++#define VP9_MV_CLASS0_HP_1_START \ ++ (VP9_MV_CLASS0_HP_0_START + VP9_MV_CLASS0_HP_0_SIZE) ++#define VP9_MV_CLASS0_HP_1_SIZE 2 ++#define VP9_MV_START VP9_MV_JOINTS_START ++#define VP9_MV_SIZE 72 /*only use 69*/ ++ ++#define VP9_TOTAL_SIZE (VP9_MV_START + VP9_MV_SIZE) ++ ++/* VP9 COUNT mem processing defines */ ++#define VP9_COEF_COUNT_START 0 ++#define VP9_COEF_COUNT_BAND_0_OFFSET 0 ++#define VP9_COEF_COUNT_BAND_1_OFFSET \ ++ (VP9_COEF_COUNT_BAND_0_OFFSET + 3 * 5) ++#define VP9_COEF_COUNT_BAND_2_OFFSET \ ++ (VP9_COEF_COUNT_BAND_1_OFFSET + 6 * 5) ++#define VP9_COEF_COUNT_BAND_3_OFFSET \ ++ (VP9_COEF_COUNT_BAND_2_OFFSET + 6 * 5) ++#define VP9_COEF_COUNT_BAND_4_OFFSET \ ++ (VP9_COEF_COUNT_BAND_3_OFFSET + 6 * 5) ++#define VP9_COEF_COUNT_BAND_5_OFFSET \ ++ (VP9_COEF_COUNT_BAND_4_OFFSET + 6 * 5) ++#define VP9_COEF_COUNT_SIZE_ONE_SET 165 /* ((3 + 5 * 6) * 5 */ ++#define VP9_COEF_COUNT_4X4_START \ ++ (VP9_COEF_COUNT_START + 0 * VP9_COEF_COUNT_SIZE_ONE_SET) ++#define VP9_COEF_COUNT_8X8_START \ ++ (VP9_COEF_COUNT_START + 4 * VP9_COEF_COUNT_SIZE_ONE_SET) ++#define VP9_COEF_COUNT_16X16_START \ ++ (VP9_COEF_COUNT_START + 8 * VP9_COEF_COUNT_SIZE_ONE_SET) ++#define VP9_COEF_COUNT_32X32_START \ ++ (VP9_COEF_COUNT_START + 12 * VP9_COEF_COUNT_SIZE_ONE_SET) ++#define VP9_COEF_COUNT_SIZE_PLANE (2 * VP9_COEF_COUNT_SIZE_ONE_SET) ++#define VP9_COEF_COUNT_SIZE (4 * 2 * 2 * VP9_COEF_COUNT_SIZE_ONE_SET) ++ ++#define VP9_INTRA_INTER_COUNT_START \ ++ (VP9_COEF_COUNT_START + VP9_COEF_COUNT_SIZE) ++#define VP9_INTRA_INTER_COUNT_SIZE (4 * 2) ++#define VP9_COMP_INTER_COUNT_START \ ++ (VP9_INTRA_INTER_COUNT_START + VP9_INTRA_INTER_COUNT_SIZE) ++#define VP9_COMP_INTER_COUNT_SIZE (5 * 2) ++#define VP9_COMP_REF_COUNT_START \ ++ (VP9_COMP_INTER_COUNT_START + VP9_COMP_INTER_COUNT_SIZE) ++#define VP9_COMP_REF_COUNT_SIZE (5 * 2) ++#define VP9_SINGLE_REF_COUNT_START \ ++ (VP9_COMP_REF_COUNT_START + VP9_COMP_REF_COUNT_SIZE) ++#define VP9_SINGLE_REF_COUNT_SIZE (10 * 2) ++#define VP9_TX_MODE_COUNT_START \ ++ (VP9_SINGLE_REF_COUNT_START + VP9_SINGLE_REF_COUNT_SIZE) ++#define VP9_TX_MODE_COUNT_SIZE (12 * 2) ++#define VP9_SKIP_COUNT_START \ ++ (VP9_TX_MODE_COUNT_START + VP9_TX_MODE_COUNT_SIZE) ++#define VP9_SKIP_COUNT_SIZE (3 * 2) ++#define VP9_MV_SIGN_0_COUNT_START \ ++ (VP9_SKIP_COUNT_START + VP9_SKIP_COUNT_SIZE) ++#define VP9_MV_SIGN_0_COUNT_SIZE (1 * 2) ++#define VP9_MV_SIGN_1_COUNT_START \ ++ (VP9_MV_SIGN_0_COUNT_START + VP9_MV_SIGN_0_COUNT_SIZE) ++#define VP9_MV_SIGN_1_COUNT_SIZE (1 * 2) ++#define VP9_MV_BITS_0_COUNT_START \ ++ (VP9_MV_SIGN_1_COUNT_START + VP9_MV_SIGN_1_COUNT_SIZE) ++#define VP9_MV_BITS_0_COUNT_SIZE (10 * 2) ++#define VP9_MV_BITS_1_COUNT_START \ ++ (VP9_MV_BITS_0_COUNT_START + VP9_MV_BITS_0_COUNT_SIZE) ++#define VP9_MV_BITS_1_COUNT_SIZE (10 * 2) ++#define VP9_MV_CLASS0_HP_0_COUNT_START \ ++ (VP9_MV_BITS_1_COUNT_START + VP9_MV_BITS_1_COUNT_SIZE) ++#define VP9_MV_CLASS0_HP_0_COUNT_SIZE (2 * 2) ++#define VP9_MV_CLASS0_HP_1_COUNT_START \ ++ (VP9_MV_CLASS0_HP_0_COUNT_START + VP9_MV_CLASS0_HP_0_COUNT_SIZE) ++#define VP9_MV_CLASS0_HP_1_COUNT_SIZE (2 * 2) ++ ++/* Start merge_tree */ ++#define VP9_INTER_MODE_COUNT_START \ ++ (VP9_MV_CLASS0_HP_1_COUNT_START + VP9_MV_CLASS0_HP_1_COUNT_SIZE) ++#define VP9_INTER_MODE_COUNT_SIZE (7 * 4) ++#define VP9_IF_Y_MODE_COUNT_START \ ++ (VP9_INTER_MODE_COUNT_START + VP9_INTER_MODE_COUNT_SIZE) ++#define VP9_IF_Y_MODE_COUNT_SIZE (10 * 4) ++#define VP9_IF_UV_MODE_COUNT_START \ ++ (VP9_IF_Y_MODE_COUNT_START + VP9_IF_Y_MODE_COUNT_SIZE) ++#define VP9_IF_UV_MODE_COUNT_SIZE (10 * 10) ++#define VP9_PARTITION_P_COUNT_START \ ++ (VP9_IF_UV_MODE_COUNT_START + VP9_IF_UV_MODE_COUNT_SIZE) ++#define VP9_PARTITION_P_COUNT_SIZE (4 * 4 * 4) ++#define VP9_INTERP_COUNT_START \ ++ (VP9_PARTITION_P_COUNT_START + VP9_PARTITION_P_COUNT_SIZE) ++#define VP9_INTERP_COUNT_SIZE (4 * 3) ++#define VP9_MV_JOINTS_COUNT_START \ ++ (VP9_INTERP_COUNT_START + VP9_INTERP_COUNT_SIZE) ++#define VP9_MV_JOINTS_COUNT_SIZE (1 * 4) ++#define VP9_MV_CLASSES_0_COUNT_START \ ++ (VP9_MV_JOINTS_COUNT_START + VP9_MV_JOINTS_COUNT_SIZE) ++#define VP9_MV_CLASSES_0_COUNT_SIZE (1 * 11) ++#define VP9_MV_CLASS0_0_COUNT_START \ ++ (VP9_MV_CLASSES_0_COUNT_START + VP9_MV_CLASSES_0_COUNT_SIZE) ++#define VP9_MV_CLASS0_0_COUNT_SIZE (1 * 2) ++#define VP9_MV_CLASSES_1_COUNT_START \ ++ (VP9_MV_CLASS0_0_COUNT_START + VP9_MV_CLASS0_0_COUNT_SIZE) ++#define VP9_MV_CLASSES_1_COUNT_SIZE (1 * 11) ++#define VP9_MV_CLASS0_1_COUNT_START \ ++ (VP9_MV_CLASSES_1_COUNT_START + VP9_MV_CLASSES_1_COUNT_SIZE) ++#define VP9_MV_CLASS0_1_COUNT_SIZE (1 * 2) ++#define VP9_MV_CLASS0_FP_0_COUNT_START \ ++ (VP9_MV_CLASS0_1_COUNT_START + VP9_MV_CLASS0_1_COUNT_SIZE) ++#define VP9_MV_CLASS0_FP_0_COUNT_SIZE (3 * 4) ++#define VP9_MV_CLASS0_FP_1_COUNT_START \ ++ (VP9_MV_CLASS0_FP_0_COUNT_START + VP9_MV_CLASS0_FP_0_COUNT_SIZE) ++#define VP9_MV_CLASS0_FP_1_COUNT_SIZE (3 * 4) ++ ++#define DC_PRED 0 /* Average of above and left pixels */ ++#define V_PRED 1 /* Vertical */ ++#define H_PRED 2 /* Horizontal */ ++#define D45_PRED 3 /* Directional 45 deg = round(arctan(1/1) * 180/pi) */ ++#define D135_PRED 4 /* Directional 135 deg = 180 - 45 */ ++#define D117_PRED 5 /* Directional 117 deg = 180 - 63 */ ++#define D153_PRED 6 /* Directional 153 deg = 180 - 27 */ ++#define D207_PRED 7 /* Directional 207 deg = 180 + 27 */ ++#define D63_PRED 8 /* Directional 63 deg = round(arctan(2/1) * 180/pi) */ ++#define TM_PRED 9 /* True-motion */ ++ ++#define ROUND_POWER_OF_TWO(value, num) (((value) + (1 << ((num) - 1))) >> (num)) ++ ++#define MODE_MV_COUNT_SAT 20 ++static const int count_to_update_factor[MODE_MV_COUNT_SAT + 1] = { ++ 0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64, ++ 70, 76, 83, 89, 96, 102, 108, 115, 121, 128 ++}; ++ ++union rpm_param { ++ struct { ++ u16 data[RPM_BUF_SIZE]; ++ } l; ++ struct { ++ u16 profile; ++ u16 show_existing_frame; ++ u16 frame_to_show_idx; ++ u16 frame_type; /*1 bit*/ ++ u16 show_frame; /*1 bit*/ ++ u16 error_resilient_mode; /*1 bit*/ ++ u16 intra_only; /*1 bit*/ ++ u16 display_size_present; /*1 bit*/ ++ u16 reset_frame_context; ++ u16 refresh_frame_flags; ++ u16 width; ++ u16 height; ++ u16 display_width; ++ u16 display_height; ++ u16 ref_info; ++ u16 same_frame_size; ++ u16 mode_ref_delta_enabled; ++ u16 ref_deltas[4]; ++ u16 mode_deltas[2]; ++ u16 filter_level; ++ u16 sharpness_level; ++ u16 bit_depth; ++ u16 seg_quant_info[8]; ++ u16 seg_enabled; ++ u16 seg_abs_delta; ++ /* bit 15: feature enabled; bit 8, sign; bit[5:0], data */ ++ u16 seg_lf_info[8]; ++ } p; ++}; ++ ++enum SEG_LVL_FEATURES { ++ SEG_LVL_ALT_Q = 0, /* Use alternate Quantizer */ ++ SEG_LVL_ALT_LF = 1, /* Use alternate loop filter value */ ++ SEG_LVL_REF_FRAME = 2, /* Optional Segment reference frame */ ++ SEG_LVL_SKIP = 3, /* Optional Segment (0,0) + skip mode */ ++ SEG_LVL_MAX = 4 /* Number of features supported */ ++}; ++ ++struct segmentation { ++ u8 enabled; ++ u8 update_map; ++ u8 update_data; ++ u8 abs_delta; ++ u8 temporal_update; ++ s16 feature_data[MAX_SEGMENTS][SEG_LVL_MAX]; ++ unsigned int feature_mask[MAX_SEGMENTS]; ++}; ++ ++struct loop_filter_thresh { ++ u8 mblim; ++ u8 lim; ++ u8 hev_thr; ++}; ++ ++struct loop_filter_info_n { ++ struct loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1]; ++ u8 lvl[MAX_SEGMENTS][MAX_REF_FRAMES][MAX_MODE_LF_DELTAS]; ++}; ++ ++struct loopfilter { ++ int filter_level; ++ ++ int sharpness_level; ++ int last_sharpness_level; ++ ++ u8 mode_ref_delta_enabled; ++ u8 mode_ref_delta_update; ++ ++ /*0 = Intra, Last, GF, ARF*/ ++ signed char ref_deltas[MAX_REF_LF_DELTAS]; ++ signed char last_ref_deltas[MAX_REF_LF_DELTAS]; ++ ++ /*0 = ZERO_MV, MV*/ ++ signed char mode_deltas[MAX_MODE_LF_DELTAS]; ++ signed char last_mode_deltas[MAX_MODE_LF_DELTAS]; ++}; ++ ++struct vp9_frame { ++ struct list_head list; ++ struct vb2_v4l2_buffer *vbuf; ++ int index; ++ int intra_only; ++ int show; ++ int type; ++ int done; ++ unsigned int width; ++ unsigned int height; ++}; ++ ++struct codec_vp9 { ++ /* VP9 context lock */ ++ struct mutex lock; ++ ++ /* Common part with the HEVC decoder */ ++ struct codec_hevc_common common; ++ ++ /* Buffer for the VP9 Workspace */ ++ void *workspace_vaddr; ++ dma_addr_t workspace_paddr; ++ ++ /* Contains many information parsed from the bitstream */ ++ union rpm_param rpm_param; ++ ++ /* Whether we detected the bitstream as 10-bit */ ++ int is_10bit; ++ ++ /* Coded resolution reported by the hardware */ ++ u32 width, height; ++ ++ /* All ref frames used by the HW at a given time */ ++ struct list_head ref_frames_list; ++ u32 frames_num; ++ ++ /* In case of downsampling (decoding with FBC but outputting in NV12M), ++ * we need to allocate additional buffers for FBC. ++ */ ++ void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; ++ dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; ++ ++ int ref_frame_map[REF_FRAMES]; ++ int next_ref_frame_map[REF_FRAMES]; ++ struct vp9_frame *frame_refs[REFS_PER_FRAME]; ++ ++ u32 lcu_total; ++ ++ /* loop filter */ ++ int default_filt_lvl; ++ struct loop_filter_info_n lfi; ++ struct loopfilter lf; ++ struct segmentation seg_4lf; ++ ++ struct vp9_frame *cur_frame; ++ struct vp9_frame *prev_frame; ++}; ++ ++static int div_r32(s64 m, int n) ++{ ++ s64 qu = div_s64(m, n); ++ ++ return (int)qu; ++} ++ ++static int clip_prob(int p) ++{ ++ return clamp_val(p, 1, 255); ++} ++ ++static int segfeature_active(struct segmentation *seg, int segment_id, ++ enum SEG_LVL_FEATURES feature_id) ++{ ++ return seg->enabled && ++ (seg->feature_mask[segment_id] & (1 << feature_id)); ++} ++ ++static int get_segdata(struct segmentation *seg, int segment_id, ++ enum SEG_LVL_FEATURES feature_id) ++{ ++ return seg->feature_data[segment_id][feature_id]; ++} ++ ++static void vp9_update_sharpness(struct loop_filter_info_n *lfi, ++ int sharpness_lvl) ++{ ++ int lvl; ++ ++ /* For each possible value for the loop filter fill out limits*/ ++ for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++) { ++ /* Set loop filter parameters that control sharpness.*/ ++ int block_inside_limit = lvl >> ((sharpness_lvl > 0) + ++ (sharpness_lvl > 4)); ++ ++ if (sharpness_lvl > 0) { ++ if (block_inside_limit > (9 - sharpness_lvl)) ++ block_inside_limit = (9 - sharpness_lvl); ++ } ++ ++ if (block_inside_limit < 1) ++ block_inside_limit = 1; ++ ++ lfi->lfthr[lvl].lim = (u8)block_inside_limit; ++ lfi->lfthr[lvl].mblim = (u8)(2 * (lvl + 2) + ++ block_inside_limit); ++ } ++} ++ ++/* Instantiate this function once when decode is started */ ++static void ++vp9_loop_filter_init(struct amvdec_core *core, struct codec_vp9 *vp9) ++{ ++ struct loop_filter_info_n *lfi = &vp9->lfi; ++ struct loopfilter *lf = &vp9->lf; ++ struct segmentation *seg_4lf = &vp9->seg_4lf; ++ int i; ++ ++ memset(lfi, 0, sizeof(struct loop_filter_info_n)); ++ memset(lf, 0, sizeof(struct loopfilter)); ++ memset(seg_4lf, 0, sizeof(struct segmentation)); ++ lf->sharpness_level = 0; ++ vp9_update_sharpness(lfi, lf->sharpness_level); ++ lf->last_sharpness_level = lf->sharpness_level; ++ ++ for (i = 0; i < 32; i++) { ++ unsigned int thr; ++ ++ thr = ((lfi->lfthr[i * 2 + 1].lim & 0x3f) << 8) | ++ (lfi->lfthr[i * 2 + 1].mblim & 0xff); ++ thr = (thr << 16) | ((lfi->lfthr[i * 2].lim & 0x3f) << 8) | ++ (lfi->lfthr[i * 2].mblim & 0xff); ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFG9, thr); ++ } ++ ++ if (core->platform->revision >= VDEC_REVISION_SM1) ++ amvdec_write_dos(core, HEVC_DBLK_CFGB, ++ (0x3 << 14) | /* dw fifo thres r and b */ ++ (0x3 << 12) | /* dw fifo thres r or b */ ++ (0x3 << 10) | /* dw fifo thres not r/b */ ++ BIT(0)); /* VP9 video format */ ++ else if (core->platform->revision >= VDEC_REVISION_G12A) ++ /* VP9 video format */ ++ amvdec_write_dos(core, HEVC_DBLK_CFGB, (0x54 << 8) | BIT(0)); ++ else ++ amvdec_write_dos(core, HEVC_DBLK_CFGB, 0x40400001); ++} ++ ++static void ++vp9_loop_filter_frame_init(struct amvdec_core *core, struct segmentation *seg, ++ struct loop_filter_info_n *lfi, ++ struct loopfilter *lf, int default_filt_lvl) ++{ ++ int i; ++ int seg_id; ++ ++ /* ++ * n_shift is the multiplier for lf_deltas ++ * the multiplier is: ++ * - 1 for when filter_lvl is between 0 and 31 ++ * - 2 when filter_lvl is between 32 and 63 ++ */ ++ const int scale = 1 << (default_filt_lvl >> 5); ++ ++ /* update limits if sharpness has changed */ ++ if (lf->last_sharpness_level != lf->sharpness_level) { ++ vp9_update_sharpness(lfi, lf->sharpness_level); ++ lf->last_sharpness_level = lf->sharpness_level; ++ ++ /* Write to register */ ++ for (i = 0; i < 32; i++) { ++ unsigned int thr; ++ ++ thr = ((lfi->lfthr[i * 2 + 1].lim & 0x3f) << 8) | ++ (lfi->lfthr[i * 2 + 1].mblim & 0xff); ++ thr = (thr << 16) | ++ ((lfi->lfthr[i * 2].lim & 0x3f) << 8) | ++ (lfi->lfthr[i * 2].mblim & 0xff); ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFG9, thr); ++ } ++ } ++ ++ for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) { ++ int lvl_seg = default_filt_lvl; ++ ++ if (segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) { ++ const int data = get_segdata(seg, seg_id, ++ SEG_LVL_ALT_LF); ++ lvl_seg = clamp_t(int, ++ seg->abs_delta == SEGMENT_ABSDATA ? ++ data : default_filt_lvl + data, ++ 0, MAX_LOOP_FILTER); ++ } ++ ++ if (!lf->mode_ref_delta_enabled) { ++ /* ++ * We could get rid of this if we assume that deltas ++ * are set to zero when not in use. ++ * encoder always uses deltas ++ */ ++ memset(lfi->lvl[seg_id], lvl_seg, ++ sizeof(lfi->lvl[seg_id])); ++ } else { ++ int ref, mode; ++ const int intra_lvl = ++ lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale; ++ lfi->lvl[seg_id][INTRA_FRAME][0] = ++ clamp_val(intra_lvl, 0, MAX_LOOP_FILTER); ++ ++ for (ref = LAST_FRAME; ref < MAX_REF_FRAMES; ++ref) { ++ for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++ ++mode) { ++ const int inter_lvl = ++ lvl_seg + ++ lf->ref_deltas[ref] * scale + ++ lf->mode_deltas[mode] * scale; ++ lfi->lvl[seg_id][ref][mode] = ++ clamp_val(inter_lvl, 0, ++ MAX_LOOP_FILTER); ++ } ++ } ++ } ++ } ++ ++ for (i = 0; i < 16; i++) { ++ unsigned int level; ++ ++ level = ((lfi->lvl[i >> 1][3][i & 1] & 0x3f) << 24) | ++ ((lfi->lvl[i >> 1][2][i & 1] & 0x3f) << 16) | ++ ((lfi->lvl[i >> 1][1][i & 1] & 0x3f) << 8) | ++ (lfi->lvl[i >> 1][0][i & 1] & 0x3f); ++ if (!default_filt_lvl) ++ level = 0; ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFGA, level); ++ } ++} ++ ++static void codec_vp9_flush_output(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ struct vp9_frame *tmp, *n; ++ ++ mutex_lock(&vp9->lock); ++ list_for_each_entry_safe(tmp, n, &vp9->ref_frames_list, list) { ++ if (!tmp->done) { ++ if (tmp->show) ++ amvdec_dst_buf_done(sess, tmp->vbuf, ++ V4L2_FIELD_NONE); ++ else ++ v4l2_m2m_buf_queue(sess->m2m_ctx, tmp->vbuf); ++ ++ vp9->frames_num--; ++ } ++ ++ list_del(&tmp->list); ++ kfree(tmp); ++ } ++ mutex_unlock(&vp9->lock); ++} ++ ++static u32 codec_vp9_num_pending_bufs(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ ++ if (!vp9) ++ return 0; ++ ++ return vp9->frames_num; ++} ++ ++static int codec_vp9_alloc_workspace(struct amvdec_core *core, ++ struct codec_vp9 *vp9) ++{ ++ /* Allocate some memory for the VP9 decoder's state */ ++ vp9->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, ++ &vp9->workspace_paddr, ++ GFP_KERNEL); ++ if (!vp9->workspace_vaddr) { ++ dev_err(core->dev, "Failed to allocate VP9 Workspace\n"); ++ return -ENOMEM; ++ } ++ ++ memset(vp9->workspace_vaddr, 0, SIZE_WORKSPACE); ++ ++ return 0; ++} ++ ++static void codec_vp9_setup_workspace(struct amvdec_session *sess, ++ struct codec_vp9 *vp9) ++{ ++ struct amvdec_core *core = sess->core; ++ u32 revision = core->platform->revision; ++ dma_addr_t wkaddr = vp9->workspace_paddr; ++ ++ amvdec_write_dos(core, HEVCD_IPP_LINEBUFF_BASE, wkaddr + IPP_OFFSET); ++ amvdec_write_dos(core, VP9_RPM_BUFFER, wkaddr + RPM_OFFSET); ++ amvdec_write_dos(core, VP9_SHORT_TERM_RPS, wkaddr + SH_TM_RPS_OFFSET); ++ amvdec_write_dos(core, VP9_PPS_BUFFER, wkaddr + PPS_OFFSET); ++ amvdec_write_dos(core, VP9_SAO_UP, wkaddr + SAO_UP_OFFSET); ++ ++ amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER, ++ wkaddr + SWAP_BUF_OFFSET); ++ amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER2, ++ wkaddr + SWAP_BUF2_OFFSET); ++ amvdec_write_dos(core, VP9_SCALELUT, wkaddr + SCALELUT_OFFSET); ++ ++ if (core->platform->revision >= VDEC_REVISION_G12A) ++ amvdec_write_dos(core, HEVC_DBLK_CFGE, ++ wkaddr + DBLK_PARA_OFFSET); ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); ++ amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); ++ amvdec_write_dos(core, VP9_SEG_MAP_BUFFER, wkaddr + SEG_MAP_OFFSET); ++ amvdec_write_dos(core, VP9_PROB_SWAP_BUFFER, wkaddr + PROB_OFFSET); ++ amvdec_write_dos(core, VP9_COUNT_SWAP_BUFFER, wkaddr + COUNT_OFFSET); ++ amvdec_write_dos(core, LMEM_DUMP_ADR, wkaddr + LMEM_OFFSET); ++ ++ if (codec_hevc_use_mmu(revision, sess->pixfmt_cap, vp9->is_10bit)) { ++ amvdec_write_dos(core, HEVC_SAO_MMU_VH0_ADDR, ++ wkaddr + MMU_VBH_OFFSET); ++ amvdec_write_dos(core, HEVC_SAO_MMU_VH1_ADDR, ++ wkaddr + MMU_VBH_OFFSET + (MMU_VBH_SIZE / 2)); ++ ++ if (revision >= VDEC_REVISION_G12A) ++ amvdec_write_dos(core, HEVC_ASSIST_MMU_MAP_ADDR, ++ vp9->common.mmu_map_paddr); ++ else ++ amvdec_write_dos(core, VP9_MMU_MAP_BUFFER, ++ vp9->common.mmu_map_paddr); ++ } ++} ++ ++static int codec_vp9_start(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_vp9 *vp9; ++ u32 val; ++ int i; ++ int ret; ++ ++ vp9 = kzalloc(sizeof(*vp9), GFP_KERNEL); ++ if (!vp9) ++ return -ENOMEM; ++ ++ ret = codec_vp9_alloc_workspace(core, vp9); ++ if (ret) ++ goto free_vp9; ++ ++ codec_vp9_setup_workspace(sess, vp9); ++ amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); ++ /* stream_fifo_hole */ ++ if (core->platform->revision >= VDEC_REVISION_G12A) ++ amvdec_write_dos_bits(core, HEVC_STREAM_FIFO_CTL, BIT(29)); ++ ++ val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x7fffffff; ++ val |= (3 << 29) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | BIT(0); ++ amvdec_write_dos(core, HEVC_PARSER_INT_CONTROL, val); ++ amvdec_write_dos_bits(core, HEVC_SHIFT_STATUS, BIT(0)); ++ amvdec_write_dos(core, HEVC_SHIFT_CONTROL, BIT(10) | BIT(9) | ++ (3 << 6) | BIT(5) | BIT(2) | BIT(1) | BIT(0)); ++ amvdec_write_dos(core, HEVC_CABAC_CONTROL, BIT(0)); ++ amvdec_write_dos(core, HEVC_PARSER_CORE_CONTROL, BIT(0)); ++ amvdec_write_dos(core, HEVC_SHIFT_STARTCODE, 0x00000001); ++ ++ amvdec_write_dos(core, VP9_DEC_STATUS_REG, 0); ++ ++ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, BIT(16)); ++ for (i = 0; i < ARRAY_SIZE(vdec_hevc_parser_cmd); ++i) ++ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, ++ vdec_hevc_parser_cmd[i]); ++ ++ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_0, PARSER_CMD_SKIP_CFG_0); ++ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_1, PARSER_CMD_SKIP_CFG_1); ++ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_2, PARSER_CMD_SKIP_CFG_2); ++ amvdec_write_dos(core, HEVC_PARSER_IF_CONTROL, ++ BIT(5) | BIT(2) | BIT(0)); ++ ++ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(0)); ++ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(1)); ++ ++ amvdec_write_dos(core, VP9_WAIT_FLAG, 1); ++ ++ /* clear mailbox interrupt */ ++ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_CLR_REG, 1); ++ /* enable mailbox interrupt */ ++ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_MASK, 1); ++ /* disable PSCALE for hardware sharing */ ++ amvdec_write_dos(core, HEVC_PSCALE_CTRL, 0); ++ /* Let the uCode do all the parsing */ ++ amvdec_write_dos(core, NAL_SEARCH_CTL, 0x8); ++ ++ amvdec_write_dos(core, DECODE_STOP_POS, 0); ++ amvdec_write_dos(core, VP9_DECODE_MODE, DECODE_MODE_SINGLE); ++ ++ pr_debug("decode_count: %u; decode_size: %u\n", ++ amvdec_read_dos(core, HEVC_DECODE_COUNT), ++ amvdec_read_dos(core, HEVC_DECODE_SIZE)); ++ ++ vp9_loop_filter_init(core, vp9); ++ ++ INIT_LIST_HEAD(&vp9->ref_frames_list); ++ mutex_init(&vp9->lock); ++ memset(&vp9->ref_frame_map, -1, sizeof(vp9->ref_frame_map)); ++ memset(&vp9->next_ref_frame_map, -1, sizeof(vp9->next_ref_frame_map)); ++ for (i = 0; i < REFS_PER_FRAME; ++i) ++ vp9->frame_refs[i] = NULL; ++ sess->priv = vp9; ++ ++ return 0; ++ ++free_vp9: ++ kfree(vp9); ++ return ret; ++} ++ ++static int codec_vp9_stop(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_vp9 *vp9 = sess->priv; ++ ++ mutex_lock(&vp9->lock); ++ if (vp9->workspace_vaddr) ++ dma_free_coherent(core->dev, SIZE_WORKSPACE, ++ vp9->workspace_vaddr, ++ vp9->workspace_paddr); ++ ++ codec_hevc_free_fbc_buffers(sess, &vp9->common); ++ mutex_unlock(&vp9->lock); ++ ++ return 0; ++} ++ ++static void codec_vp9_set_sao(struct amvdec_session *sess, ++ struct vb2_buffer *vb) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_vp9 *vp9 = sess->priv; ++ ++ dma_addr_t buf_y_paddr; ++ dma_addr_t buf_u_v_paddr; ++ u32 val; ++ ++ if (codec_hevc_use_downsample(sess->pixfmt_cap, vp9->is_10bit)) ++ buf_y_paddr = ++ vp9->common.fbc_buffer_paddr[vb->index]; ++ else ++ buf_y_paddr = ++ vb2_dma_contig_plane_dma_addr(vb, 0); ++ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { ++ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200; ++ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); ++ amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); ++ } ++ ++ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { ++ buf_y_paddr = ++ vb2_dma_contig_plane_dma_addr(vb, 0); ++ buf_u_v_paddr = ++ vb2_dma_contig_plane_dma_addr(vb, 1); ++ amvdec_write_dos(core, HEVC_SAO_Y_START_ADDR, buf_y_paddr); ++ amvdec_write_dos(core, HEVC_SAO_C_START_ADDR, buf_u_v_paddr); ++ amvdec_write_dos(core, HEVC_SAO_Y_WPTR, buf_y_paddr); ++ amvdec_write_dos(core, HEVC_SAO_C_WPTR, buf_u_v_paddr); ++ } ++ ++ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, ++ vp9->is_10bit)) { ++ amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, ++ vp9->common.mmu_header_paddr[vb->index]); ++ /* use HEVC_CM_HEADER_START_ADDR */ ++ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10)); ++ } ++ ++ amvdec_write_dos(core, HEVC_SAO_Y_LENGTH, ++ amvdec_get_output_size(sess)); ++ amvdec_write_dos(core, HEVC_SAO_C_LENGTH, ++ (amvdec_get_output_size(sess) / 2)); ++ ++ if (core->platform->revision >= VDEC_REVISION_G12A) { ++ amvdec_clear_dos_bits(core, HEVC_DBLK_CFGB, ++ BIT(4) | BIT(5) | BIT(8) | BIT(9)); ++ /* enable first, compressed write */ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) ++ amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(8)); ++ ++ /* enable second, uncompressed write */ ++ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) ++ amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(9)); ++ ++ /* dblk pipeline mode=1 for performance */ ++ if (sess->width >= 1280) ++ amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(4)); ++ ++ pr_debug("HEVC_DBLK_CFGB: %08X\n", ++ amvdec_read_dos(core, HEVC_DBLK_CFGB)); ++ } ++ ++ val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff0; ++ val |= 0xff0; /* Set endianness for 2-bytes swaps (nv12) */ ++ if (core->platform->revision < VDEC_REVISION_G12A) { ++ val &= ~0x3; ++ if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) ++ val |= BIT(0); /* disable cm compression */ ++ /* TOFIX: Handle Amlogic Framebuffer compression */ ++ } ++ ++ amvdec_write_dos(core, HEVC_SAO_CTRL1, val); ++ pr_debug("HEVC_SAO_CTRL1: %08X\n", val); ++ ++ /* no downscale for NV12 */ ++ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0000; ++ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); ++ ++ val = amvdec_read_dos(core, HEVCD_IPP_AXIIF_CONFIG) & ~0x30; ++ val |= 0xf; ++ val &= ~BIT(12); /* NV12 */ ++ amvdec_write_dos(core, HEVCD_IPP_AXIIF_CONFIG, val); ++} ++ ++static dma_addr_t codec_vp9_get_frame_mv_paddr(struct codec_vp9 *vp9, ++ struct vp9_frame *frame) ++{ ++ return vp9->workspace_paddr + MPRED_MV_OFFSET + ++ (frame->index * MPRED_MV_BUF_SIZE); ++} ++ ++static void codec_vp9_set_mpred_mv(struct amvdec_core *core, ++ struct codec_vp9 *vp9) ++{ ++ int mpred_mv_rd_end_addr; ++ int use_prev_frame_mvs = vp9->prev_frame->width == ++ vp9->cur_frame->width && ++ vp9->prev_frame->height == ++ vp9->cur_frame->height && ++ !vp9->prev_frame->intra_only && ++ vp9->prev_frame->show && ++ vp9->prev_frame->type != KEY_FRAME; ++ ++ amvdec_write_dos(core, HEVC_MPRED_CTRL3, 0x24122412); ++ amvdec_write_dos(core, HEVC_MPRED_ABV_START_ADDR, ++ vp9->workspace_paddr + MPRED_ABV_OFFSET); ++ ++ amvdec_clear_dos_bits(core, HEVC_MPRED_CTRL4, BIT(6)); ++ if (use_prev_frame_mvs) ++ amvdec_write_dos_bits(core, HEVC_MPRED_CTRL4, BIT(6)); ++ ++ amvdec_write_dos(core, HEVC_MPRED_MV_WR_START_ADDR, ++ codec_vp9_get_frame_mv_paddr(vp9, vp9->cur_frame)); ++ amvdec_write_dos(core, HEVC_MPRED_MV_WPTR, ++ codec_vp9_get_frame_mv_paddr(vp9, vp9->cur_frame)); ++ ++ amvdec_write_dos(core, HEVC_MPRED_MV_RD_START_ADDR, ++ codec_vp9_get_frame_mv_paddr(vp9, vp9->prev_frame)); ++ amvdec_write_dos(core, HEVC_MPRED_MV_RPTR, ++ codec_vp9_get_frame_mv_paddr(vp9, vp9->prev_frame)); ++ ++ mpred_mv_rd_end_addr = ++ codec_vp9_get_frame_mv_paddr(vp9, vp9->prev_frame) + ++ (vp9->lcu_total * MV_MEM_UNIT); ++ amvdec_write_dos(core, HEVC_MPRED_MV_RD_END_ADDR, mpred_mv_rd_end_addr); ++} ++ ++static void codec_vp9_update_next_ref(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ u32 buf_idx = vp9->cur_frame->index; ++ int ref_index = 0; ++ int refresh_frame_flags; ++ int mask; ++ ++ refresh_frame_flags = vp9->cur_frame->type == KEY_FRAME ? ++ 0xff : param->p.refresh_frame_flags; ++ ++ for (mask = refresh_frame_flags; mask; mask >>= 1) { ++ pr_debug("mask=%08X; ref_index=%d\n", mask, ref_index); ++ if (mask & 1) ++ vp9->next_ref_frame_map[ref_index] = buf_idx; ++ else ++ vp9->next_ref_frame_map[ref_index] = ++ vp9->ref_frame_map[ref_index]; ++ ++ ++ref_index; ++ } ++ ++ for (; ref_index < REF_FRAMES; ++ref_index) ++ vp9->next_ref_frame_map[ref_index] = ++ vp9->ref_frame_map[ref_index]; ++} ++ ++static void codec_vp9_save_refs(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ int i; ++ ++ for (i = 0; i < REFS_PER_FRAME; ++i) { ++ const int ref = (param->p.ref_info >> ++ (((REFS_PER_FRAME - i - 1) * 4) + 1)) & 0x7; ++ ++ if (vp9->ref_frame_map[ref] < 0) ++ continue; ++ ++ pr_warn("%s: FIXME, would need to save ref %d\n", ++ __func__, vp9->ref_frame_map[ref]); ++ } ++} ++ ++static void codec_vp9_update_ref(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ int ref_index = 0; ++ int mask; ++ int refresh_frame_flags; ++ ++ if (!vp9->cur_frame) ++ return; ++ ++ refresh_frame_flags = vp9->cur_frame->type == KEY_FRAME ? ++ 0xff : param->p.refresh_frame_flags; ++ ++ for (mask = refresh_frame_flags; mask; mask >>= 1) { ++ vp9->ref_frame_map[ref_index] = ++ vp9->next_ref_frame_map[ref_index]; ++ ++ref_index; ++ } ++ ++ if (param->p.show_existing_frame) ++ return; ++ ++ for (; ref_index < REF_FRAMES; ++ref_index) ++ vp9->ref_frame_map[ref_index] = ++ vp9->next_ref_frame_map[ref_index]; ++} ++ ++static struct vp9_frame *codec_vp9_get_frame_by_idx(struct codec_vp9 *vp9, ++ int idx) ++{ ++ struct vp9_frame *frame; ++ ++ list_for_each_entry(frame, &vp9->ref_frames_list, list) { ++ if (frame->index == idx) ++ return frame; ++ } ++ ++ return NULL; ++} ++ ++static void codec_vp9_sync_ref(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ int i; ++ ++ for (i = 0; i < REFS_PER_FRAME; ++i) { ++ const int ref = (param->p.ref_info >> ++ (((REFS_PER_FRAME - i - 1) * 4) + 1)) & 0x7; ++ const int idx = vp9->ref_frame_map[ref]; ++ ++ vp9->frame_refs[i] = codec_vp9_get_frame_by_idx(vp9, idx); ++ if (!vp9->frame_refs[i]) ++ pr_warn("%s: couldn't find VP9 ref %d\n", __func__, ++ idx); ++ } ++} ++ ++static void codec_vp9_set_refs(struct amvdec_session *sess, ++ struct codec_vp9 *vp9) ++{ ++ struct amvdec_core *core = sess->core; ++ int i; ++ ++ for (i = 0; i < REFS_PER_FRAME; ++i) { ++ struct vp9_frame *frame = vp9->frame_refs[i]; ++ int id_y; ++ int id_u_v; ++ ++ if (!frame) ++ continue; ++ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { ++ id_y = frame->index; ++ id_u_v = id_y; ++ } else { ++ id_y = frame->index * 2; ++ id_u_v = id_y + 1; ++ } ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, ++ (id_u_v << 16) | (id_u_v << 8) | id_y); ++ } ++} ++ ++static void codec_vp9_set_mc(struct amvdec_session *sess, ++ struct codec_vp9 *vp9) ++{ ++ struct amvdec_core *core = sess->core; ++ u32 scale = 0; ++ u32 sz; ++ int i; ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); ++ codec_vp9_set_refs(sess, vp9); ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, ++ (16 << 8) | 1); ++ codec_vp9_set_refs(sess, vp9); ++ ++ amvdec_write_dos(core, VP9D_MPP_REFINFO_TBL_ACCCONFIG, BIT(2)); ++ for (i = 0; i < REFS_PER_FRAME; ++i) { ++ if (!vp9->frame_refs[i]) ++ continue; ++ ++ if (vp9->frame_refs[i]->width != vp9->width || ++ vp9->frame_refs[i]->height != vp9->height) ++ scale = 1; ++ ++ sz = amvdec_am21c_body_size(vp9->frame_refs[i]->width, ++ vp9->frame_refs[i]->height); ++ ++ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, ++ vp9->frame_refs[i]->width); ++ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, ++ vp9->frame_refs[i]->height); ++ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, ++ (vp9->frame_refs[i]->width << 14) / ++ vp9->width); ++ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, ++ (vp9->frame_refs[i]->height << 14) / ++ vp9->height); ++ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, sz >> 5); ++ } ++ ++ amvdec_write_dos(core, VP9D_MPP_REF_SCALE_ENBL, scale); ++} ++ ++static struct vp9_frame *codec_vp9_get_new_frame(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ union rpm_param *param = &vp9->rpm_param; ++ struct vb2_v4l2_buffer *vbuf; ++ struct vp9_frame *new_frame; ++ ++ new_frame = kzalloc(sizeof(*new_frame), GFP_KERNEL); ++ if (!new_frame) ++ return NULL; ++ ++ vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); ++ if (!vbuf) { ++ dev_err(sess->core->dev, "No dst buffer available\n"); ++ kfree(new_frame); ++ return NULL; ++ } ++ ++ while (codec_vp9_get_frame_by_idx(vp9, vbuf->vb2_buf.index)) { ++ struct vb2_v4l2_buffer *old_vbuf = vbuf; ++ ++ vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); ++ v4l2_m2m_buf_queue(sess->m2m_ctx, old_vbuf); ++ if (!vbuf) { ++ dev_err(sess->core->dev, "No dst buffer available\n"); ++ kfree(new_frame); ++ return NULL; ++ } ++ } ++ ++ new_frame->vbuf = vbuf; ++ new_frame->index = vbuf->vb2_buf.index; ++ new_frame->intra_only = param->p.intra_only; ++ new_frame->show = param->p.show_frame; ++ new_frame->type = param->p.frame_type; ++ new_frame->width = vp9->width; ++ new_frame->height = vp9->height; ++ list_add_tail(&new_frame->list, &vp9->ref_frames_list); ++ vp9->frames_num++; ++ ++ return new_frame; ++} ++ ++static void codec_vp9_show_existing_frame(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ ++ if (!param->p.show_existing_frame) ++ return; ++ ++ pr_debug("showing frame %u\n", param->p.frame_to_show_idx); ++} ++ ++static void codec_vp9_rm_noshow_frame(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ struct vp9_frame *tmp; ++ ++ list_for_each_entry(tmp, &vp9->ref_frames_list, list) { ++ if (tmp->show) ++ continue; ++ ++ pr_debug("rm noshow: %u\n", tmp->index); ++ v4l2_m2m_buf_queue(sess->m2m_ctx, tmp->vbuf); ++ list_del(&tmp->list); ++ kfree(tmp); ++ vp9->frames_num--; ++ return; ++ } ++} ++ ++static void codec_vp9_process_frame(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_vp9 *vp9 = sess->priv; ++ union rpm_param *param = &vp9->rpm_param; ++ int intra_only; ++ ++ if (!param->p.show_frame) ++ codec_vp9_rm_noshow_frame(sess); ++ ++ vp9->cur_frame = codec_vp9_get_new_frame(sess); ++ if (!vp9->cur_frame) ++ return; ++ ++ pr_debug("frame %d: type: %08X; show_exist: %u; show: %u, intra_only: %u\n", ++ vp9->cur_frame->index, ++ param->p.frame_type, param->p.show_existing_frame, ++ param->p.show_frame, param->p.intra_only); ++ ++ if (param->p.frame_type != KEY_FRAME) ++ codec_vp9_sync_ref(vp9); ++ codec_vp9_update_next_ref(vp9); ++ codec_vp9_show_existing_frame(vp9); ++ ++ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, ++ vp9->is_10bit)) ++ codec_hevc_fill_mmu_map(sess, &vp9->common, ++ &vp9->cur_frame->vbuf->vb2_buf); ++ ++ intra_only = param->p.show_frame ? 0 : param->p.intra_only; ++ ++ /* clear mpred (for keyframe only) */ ++ if (param->p.frame_type != KEY_FRAME && !intra_only) { ++ codec_vp9_set_mc(sess, vp9); ++ codec_vp9_set_mpred_mv(core, vp9); ++ } else { ++ amvdec_clear_dos_bits(core, HEVC_MPRED_CTRL4, BIT(6)); ++ } ++ ++ amvdec_write_dos(core, HEVC_PARSER_PICTURE_SIZE, ++ (vp9->height << 16) | vp9->width); ++ codec_vp9_set_sao(sess, &vp9->cur_frame->vbuf->vb2_buf); ++ ++ vp9_loop_filter_frame_init(core, &vp9->seg_4lf, ++ &vp9->lfi, &vp9->lf, ++ vp9->default_filt_lvl); ++ ++ /* ask uCode to start decoding */ ++ amvdec_write_dos(core, VP9_DEC_STATUS_REG, VP9_10B_DECODE_SLICE); ++} ++ ++static void codec_vp9_process_lf(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ int i; ++ ++ vp9->lf.mode_ref_delta_enabled = param->p.mode_ref_delta_enabled; ++ vp9->lf.sharpness_level = param->p.sharpness_level; ++ vp9->default_filt_lvl = param->p.filter_level; ++ vp9->seg_4lf.enabled = param->p.seg_enabled; ++ vp9->seg_4lf.abs_delta = param->p.seg_abs_delta; ++ ++ for (i = 0; i < 4; i++) ++ vp9->lf.ref_deltas[i] = param->p.ref_deltas[i]; ++ ++ for (i = 0; i < 2; i++) ++ vp9->lf.mode_deltas[i] = param->p.mode_deltas[i]; ++ ++ for (i = 0; i < MAX_SEGMENTS; i++) ++ vp9->seg_4lf.feature_mask[i] = ++ (param->p.seg_lf_info[i] & 0x8000) ? ++ (1 << SEG_LVL_ALT_LF) : 0; ++ ++ for (i = 0; i < MAX_SEGMENTS; i++) ++ vp9->seg_4lf.feature_data[i][SEG_LVL_ALT_LF] = ++ (param->p.seg_lf_info[i] & 0x100) ? ++ -(param->p.seg_lf_info[i] & 0x3f) ++ : (param->p.seg_lf_info[i] & 0x3f); ++} ++ ++static void codec_vp9_resume(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ ++ mutex_lock(&vp9->lock); ++ if (codec_hevc_setup_buffers(sess, &vp9->common, vp9->is_10bit)) { ++ mutex_unlock(&vp9->lock); ++ amvdec_abort(sess); ++ return; ++ } ++ ++ codec_vp9_setup_workspace(sess, vp9); ++ codec_hevc_setup_decode_head(sess, vp9->is_10bit); ++ codec_vp9_process_lf(vp9); ++ codec_vp9_process_frame(sess); ++ ++ mutex_unlock(&vp9->lock); ++} ++ ++/** ++ * The RPM section within the workspace contains ++ * many information regarding the parsed bitstream ++ */ ++static void codec_vp9_fetch_rpm(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ u16 *rpm_vaddr = vp9->workspace_vaddr + RPM_OFFSET; ++ int i, j; ++ ++ for (i = 0; i < RPM_BUF_SIZE; i += 4) ++ for (j = 0; j < 4; j++) ++ vp9->rpm_param.l.data[i + j] = rpm_vaddr[i + 3 - j]; ++} ++ ++static int codec_vp9_process_rpm(struct codec_vp9 *vp9) ++{ ++ union rpm_param *param = &vp9->rpm_param; ++ int src_changed = 0; ++ int is_10bit = 0; ++ int pic_width_64 = ALIGN(param->p.width, 64); ++ int pic_height_32 = ALIGN(param->p.height, 32); ++ int pic_width_lcu = (pic_width_64 % LCU_SIZE) ? ++ pic_width_64 / LCU_SIZE + 1 ++ : pic_width_64 / LCU_SIZE; ++ int pic_height_lcu = (pic_height_32 % LCU_SIZE) ? ++ pic_height_32 / LCU_SIZE + 1 ++ : pic_height_32 / LCU_SIZE; ++ vp9->lcu_total = pic_width_lcu * pic_height_lcu; ++ ++ if (param->p.bit_depth == 10) ++ is_10bit = 1; ++ ++ if (vp9->width != param->p.width || vp9->height != param->p.height || ++ vp9->is_10bit != is_10bit) ++ src_changed = 1; ++ ++ vp9->width = param->p.width; ++ vp9->height = param->p.height; ++ vp9->is_10bit = is_10bit; ++ ++ pr_debug("width: %u; height: %u; is_10bit: %d; src_changed: %d\n", ++ vp9->width, vp9->height, is_10bit, src_changed); ++ ++ return src_changed; ++} ++ ++static bool codec_vp9_is_ref(struct codec_vp9 *vp9, struct vp9_frame *frame) ++{ ++ int i; ++ ++ for (i = 0; i < REF_FRAMES; ++i) ++ if (vp9->ref_frame_map[i] == frame->index) ++ return true; ++ ++ return false; ++} ++ ++static void codec_vp9_show_frame(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ struct vp9_frame *tmp, *n; ++ ++ list_for_each_entry_safe(tmp, n, &vp9->ref_frames_list, list) { ++ if (!tmp->show || tmp == vp9->cur_frame) ++ continue; ++ ++ if (!tmp->done) { ++ pr_debug("Doning %u\n", tmp->index); ++ amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE); ++ tmp->done = 1; ++ vp9->frames_num--; ++ } ++ ++ if (codec_vp9_is_ref(vp9, tmp) || tmp == vp9->prev_frame) ++ continue; ++ ++ pr_debug("deleting %d\n", tmp->index); ++ list_del(&tmp->list); ++ kfree(tmp); ++ } ++} ++ ++static void vp9_tree_merge_probs(unsigned int *prev_prob, ++ unsigned int *cur_prob, ++ int coef_node_start, int tree_left, ++ int tree_right, ++ int tree_i, int node) ++{ ++ int prob_32, prob_res, prob_shift; ++ int pre_prob, new_prob; ++ int den, m_count, get_prob, factor; ++ ++ prob_32 = prev_prob[coef_node_start / 4 * 2]; ++ prob_res = coef_node_start & 3; ++ prob_shift = prob_res * 8; ++ pre_prob = (prob_32 >> prob_shift) & 0xff; ++ ++ den = tree_left + tree_right; ++ ++ if (den == 0) { ++ new_prob = pre_prob; ++ } else { ++ m_count = den < MODE_MV_COUNT_SAT ? den : MODE_MV_COUNT_SAT; ++ get_prob = ++ clip_prob(div_r32(((int64_t)tree_left * 256 + ++ (den >> 1)), ++ den)); ++ ++ /* weighted_prob */ ++ factor = count_to_update_factor[m_count]; ++ new_prob = ROUND_POWER_OF_TWO(pre_prob * (256 - factor) + ++ get_prob * factor, 8); ++ } ++ ++ cur_prob[coef_node_start / 4 * 2] = ++ (cur_prob[coef_node_start / 4 * 2] & (~(0xff << prob_shift))) | ++ (new_prob << prob_shift); ++} ++ ++static void adapt_coef_probs_cxt(unsigned int *prev_prob, ++ unsigned int *cur_prob, ++ unsigned int *count, ++ int update_factor, ++ int cxt_num, ++ int coef_cxt_start, ++ int coef_count_cxt_start) ++{ ++ int prob_32, prob_res, prob_shift; ++ int pre_prob, new_prob; ++ int num, den, m_count, get_prob, factor; ++ int node, coef_node_start; ++ int count_sat = 24; ++ int cxt; ++ ++ for (cxt = 0; cxt < cxt_num; cxt++) { ++ const int n0 = count[coef_count_cxt_start]; ++ const int n1 = count[coef_count_cxt_start + 1]; ++ const int n2 = count[coef_count_cxt_start + 2]; ++ const int neob = count[coef_count_cxt_start + 3]; ++ const int nneob = count[coef_count_cxt_start + 4]; ++ const unsigned int branch_ct[3][2] = { ++ { neob, nneob }, ++ { n0, n1 + n2 }, ++ { n1, n2 } ++ }; ++ ++ coef_node_start = coef_cxt_start; ++ for (node = 0 ; node < 3 ; node++) { ++ prob_32 = prev_prob[coef_node_start / 4 * 2]; ++ prob_res = coef_node_start & 3; ++ prob_shift = prob_res * 8; ++ pre_prob = (prob_32 >> prob_shift) & 0xff; ++ ++ /* get binary prob */ ++ num = branch_ct[node][0]; ++ den = branch_ct[node][0] + branch_ct[node][1]; ++ m_count = den < count_sat ? den : count_sat; ++ ++ get_prob = (den == 0) ? ++ 128u : ++ clip_prob(div_r32(((int64_t)num * 256 + ++ (den >> 1)), den)); ++ ++ factor = update_factor * m_count / count_sat; ++ new_prob = ++ ROUND_POWER_OF_TWO(pre_prob * (256 - factor) + ++ get_prob * factor, 8); ++ ++ cur_prob[coef_node_start / 4 * 2] = ++ (cur_prob[coef_node_start / 4 * 2] & ++ (~(0xff << prob_shift))) | ++ (new_prob << prob_shift); ++ ++ coef_node_start += 1; ++ } ++ ++ coef_cxt_start = coef_cxt_start + 3; ++ coef_count_cxt_start = coef_count_cxt_start + 5; ++ } ++} ++ ++static void adapt_coef_probs(int prev_kf, int cur_kf, int pre_fc, ++ unsigned int *prev_prob, unsigned int *cur_prob, ++ unsigned int *count) ++{ ++ int tx_size, coef_tx_size_start, coef_count_tx_size_start; ++ int plane, coef_plane_start, coef_count_plane_start; ++ int type, coef_type_start, coef_count_type_start; ++ int band, coef_band_start, coef_count_band_start; ++ int cxt_num; ++ int coef_cxt_start, coef_count_cxt_start; ++ int node, coef_node_start, coef_count_node_start; ++ ++ int tree_i, tree_left, tree_right; ++ int mvd_i; ++ ++ int update_factor = cur_kf ? 112 : (prev_kf ? 128 : 112); ++ ++ int prob_32; ++ int prob_res; ++ int prob_shift; ++ int pre_prob; ++ ++ int den; ++ int get_prob; ++ int m_count; ++ int factor; ++ ++ int new_prob; ++ ++ for (tx_size = 0 ; tx_size < 4 ; tx_size++) { ++ coef_tx_size_start = VP9_COEF_START + ++ tx_size * 4 * VP9_COEF_SIZE_ONE_SET; ++ coef_count_tx_size_start = VP9_COEF_COUNT_START + ++ tx_size * 4 * VP9_COEF_COUNT_SIZE_ONE_SET; ++ coef_plane_start = coef_tx_size_start; ++ coef_count_plane_start = coef_count_tx_size_start; ++ ++ for (plane = 0 ; plane < 2 ; plane++) { ++ coef_type_start = coef_plane_start; ++ coef_count_type_start = coef_count_plane_start; ++ ++ for (type = 0 ; type < 2 ; type++) { ++ coef_band_start = coef_type_start; ++ coef_count_band_start = coef_count_type_start; ++ ++ for (band = 0 ; band < 6 ; band++) { ++ if (band == 0) ++ cxt_num = 3; ++ else ++ cxt_num = 6; ++ coef_cxt_start = coef_band_start; ++ coef_count_cxt_start = ++ coef_count_band_start; ++ ++ adapt_coef_probs_cxt(prev_prob, ++ cur_prob, ++ count, ++ update_factor, ++ cxt_num, ++ coef_cxt_start, ++ coef_count_cxt_start); ++ ++ if (band == 0) { ++ coef_band_start += 10; ++ coef_count_band_start += 15; ++ } else { ++ coef_band_start += 18; ++ coef_count_band_start += 30; ++ } ++ } ++ coef_type_start += VP9_COEF_SIZE_ONE_SET; ++ coef_count_type_start += ++ VP9_COEF_COUNT_SIZE_ONE_SET; ++ } ++ ++ coef_plane_start += 2 * VP9_COEF_SIZE_ONE_SET; ++ coef_count_plane_start += ++ 2 * VP9_COEF_COUNT_SIZE_ONE_SET; ++ } ++ } ++ ++ if (cur_kf == 0) { ++ /* mode_mv_merge_probs - merge_intra_inter_prob */ ++ for (coef_count_node_start = VP9_INTRA_INTER_COUNT_START; ++ coef_count_node_start < (VP9_MV_CLASS0_HP_1_COUNT_START + ++ VP9_MV_CLASS0_HP_1_COUNT_SIZE); ++ coef_count_node_start += 2) { ++ if (coef_count_node_start == ++ VP9_INTRA_INTER_COUNT_START) ++ coef_node_start = VP9_INTRA_INTER_START; ++ else if (coef_count_node_start == ++ VP9_COMP_INTER_COUNT_START) ++ coef_node_start = VP9_COMP_INTER_START; ++ else if (coef_count_node_start == ++ VP9_TX_MODE_COUNT_START) ++ coef_node_start = VP9_TX_MODE_START; ++ else if (coef_count_node_start == ++ VP9_SKIP_COUNT_START) ++ coef_node_start = VP9_SKIP_START; ++ else if (coef_count_node_start == ++ VP9_MV_SIGN_0_COUNT_START) ++ coef_node_start = VP9_MV_SIGN_0_START; ++ else if (coef_count_node_start == ++ VP9_MV_SIGN_1_COUNT_START) ++ coef_node_start = VP9_MV_SIGN_1_START; ++ else if (coef_count_node_start == ++ VP9_MV_BITS_0_COUNT_START) ++ coef_node_start = VP9_MV_BITS_0_START; ++ else if (coef_count_node_start == ++ VP9_MV_BITS_1_COUNT_START) ++ coef_node_start = VP9_MV_BITS_1_START; ++ else if (coef_count_node_start == ++ VP9_MV_CLASS0_HP_0_COUNT_START) ++ coef_node_start = VP9_MV_CLASS0_HP_0_START; ++ ++ den = count[coef_count_node_start] + ++ count[coef_count_node_start + 1]; ++ ++ prob_32 = prev_prob[coef_node_start / 4 * 2]; ++ prob_res = coef_node_start & 3; ++ prob_shift = prob_res * 8; ++ pre_prob = (prob_32 >> prob_shift) & 0xff; ++ ++ if (den == 0) { ++ new_prob = pre_prob; ++ } else { ++ m_count = den < MODE_MV_COUNT_SAT ? ++ den : MODE_MV_COUNT_SAT; ++ get_prob = ++ clip_prob(div_r32(((int64_t) ++ count[coef_count_node_start] * 256 + ++ (den >> 1)), ++ den)); ++ ++ /* weighted prob */ ++ factor = count_to_update_factor[m_count]; ++ new_prob = ++ ROUND_POWER_OF_TWO(pre_prob * ++ (256 - factor) + ++ get_prob * factor, ++ 8); ++ } ++ ++ cur_prob[coef_node_start / 4 * 2] = ++ (cur_prob[coef_node_start / 4 * 2] & ++ (~(0xff << prob_shift))) | ++ (new_prob << prob_shift); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ ++ coef_node_start = VP9_INTER_MODE_START; ++ coef_count_node_start = VP9_INTER_MODE_COUNT_START; ++ for (tree_i = 0 ; tree_i < 7 ; tree_i++) { ++ for (node = 0 ; node < 3 ; node++) { ++ unsigned int start = coef_count_node_start; ++ ++ switch (node) { ++ case 2: ++ tree_left = count[start + 1]; ++ tree_right = count[start + 3]; ++ break; ++ case 1: ++ tree_left = count[start + 0]; ++ tree_right = count[start + 1] + ++ count[start + 3]; ++ break; ++ default: ++ tree_left = count[start + 2]; ++ tree_right = count[start + 0] + ++ count[start + 1] + ++ count[start + 3]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ ++ coef_count_node_start = coef_count_node_start + 4; ++ } ++ ++ coef_node_start = VP9_IF_Y_MODE_START; ++ coef_count_node_start = VP9_IF_Y_MODE_COUNT_START; ++ for (tree_i = 0 ; tree_i < 14 ; tree_i++) { ++ for (node = 0 ; node < 9 ; node++) { ++ unsigned int start = coef_count_node_start; ++ ++ switch (node) { ++ case 8: ++ tree_left = ++ count[start + D153_PRED]; ++ tree_right = ++ count[start + D207_PRED]; ++ break; ++ case 7: ++ tree_left = ++ count[start + D63_PRED]; ++ tree_right = ++ count[start + D207_PRED] + ++ count[start + D153_PRED]; ++ break; ++ case 6: ++ tree_left = ++ count[start + D45_PRED]; ++ tree_right = ++ count[start + D207_PRED] + ++ count[start + D153_PRED] + ++ count[start + D63_PRED]; ++ break; ++ case 5: ++ tree_left = ++ count[start + D135_PRED]; ++ tree_right = ++ count[start + D117_PRED]; ++ break; ++ case 4: ++ tree_left = ++ count[start + H_PRED]; ++ tree_right = ++ count[start + D117_PRED] + ++ count[start + D135_PRED]; ++ break; ++ case 3: ++ tree_left = ++ count[start + H_PRED] + ++ count[start + D117_PRED] + ++ count[start + D135_PRED]; ++ tree_right = ++ count[start + D45_PRED] + ++ count[start + D207_PRED] + ++ count[start + D153_PRED] + ++ count[start + D63_PRED]; ++ break; ++ case 2: ++ tree_left = ++ count[start + V_PRED]; ++ tree_right = ++ count[start + H_PRED] + ++ count[start + D117_PRED] + ++ count[start + D135_PRED] + ++ count[start + D45_PRED] + ++ count[start + D207_PRED] + ++ count[start + D153_PRED] + ++ count[start + D63_PRED]; ++ break; ++ case 1: ++ tree_left = ++ count[start + TM_PRED]; ++ tree_right = ++ count[start + V_PRED] + ++ count[start + H_PRED] + ++ count[start + D117_PRED] + ++ count[start + D135_PRED] + ++ count[start + D45_PRED] + ++ count[start + D207_PRED] + ++ count[start + D153_PRED] + ++ count[start + D63_PRED]; ++ break; ++ default: ++ tree_left = ++ count[start + DC_PRED]; ++ tree_right = ++ count[start + TM_PRED] + ++ count[start + V_PRED] + ++ count[start + H_PRED] + ++ count[start + D117_PRED] + ++ count[start + D135_PRED] + ++ count[start + D45_PRED] + ++ count[start + D207_PRED] + ++ count[start + D153_PRED] + ++ count[start + D63_PRED]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ coef_count_node_start = coef_count_node_start + 10; ++ } ++ ++ coef_node_start = VP9_PARTITION_P_START; ++ coef_count_node_start = VP9_PARTITION_P_COUNT_START; ++ for (tree_i = 0 ; tree_i < 16 ; tree_i++) { ++ for (node = 0 ; node < 3 ; node++) { ++ unsigned int start = coef_count_node_start; ++ ++ switch (node) { ++ case 2: ++ tree_left = count[start + 2]; ++ tree_right = count[start + 3]; ++ break; ++ case 1: ++ tree_left = count[start + 1]; ++ tree_right = count[start + 2] + ++ count[start + 3]; ++ break; ++ default: ++ tree_left = count[start + 0]; ++ tree_right = count[start + 1] + ++ count[start + 2] + ++ count[start + 3]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ ++ coef_count_node_start = coef_count_node_start + 4; ++ } ++ ++ coef_node_start = VP9_INTERP_START; ++ coef_count_node_start = VP9_INTERP_COUNT_START; ++ for (tree_i = 0 ; tree_i < 4 ; tree_i++) { ++ for (node = 0 ; node < 2 ; node++) { ++ unsigned int start = coef_count_node_start; ++ ++ switch (node) { ++ case 1: ++ tree_left = count[start + 1]; ++ tree_right = count[start + 2]; ++ break; ++ default: ++ tree_left = count[start + 0]; ++ tree_right = count[start + 1] + ++ count[start + 2]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ coef_count_node_start = coef_count_node_start + 3; ++ } ++ ++ coef_node_start = VP9_MV_JOINTS_START; ++ coef_count_node_start = VP9_MV_JOINTS_COUNT_START; ++ for (tree_i = 0 ; tree_i < 1 ; tree_i++) { ++ for (node = 0 ; node < 3 ; node++) { ++ unsigned int start = coef_count_node_start; ++ ++ switch (node) { ++ case 2: ++ tree_left = count[start + 2]; ++ tree_right = count[start + 3]; ++ break; ++ case 1: ++ tree_left = count[start + 1]; ++ tree_right = count[start + 2] + ++ count[start + 3]; ++ break; ++ default: ++ tree_left = count[start + 0]; ++ tree_right = count[start + 1] + ++ count[start + 2] + ++ count[start + 3]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ coef_count_node_start = coef_count_node_start + 4; ++ } ++ ++ for (mvd_i = 0 ; mvd_i < 2 ; mvd_i++) { ++ coef_node_start = mvd_i ? VP9_MV_CLASSES_1_START : ++ VP9_MV_CLASSES_0_START; ++ coef_count_node_start = mvd_i ? ++ VP9_MV_CLASSES_1_COUNT_START : ++ VP9_MV_CLASSES_0_COUNT_START; ++ tree_i = 0; ++ for (node = 0; node < 10; node++) { ++ unsigned int start = coef_count_node_start; ++ ++ switch (node) { ++ case 9: ++ tree_left = count[start + 9]; ++ tree_right = count[start + 10]; ++ break; ++ case 8: ++ tree_left = count[start + 7]; ++ tree_right = count[start + 8]; ++ break; ++ case 7: ++ tree_left = count[start + 7] + ++ count[start + 8]; ++ tree_right = count[start + 9] + ++ count[start + 10]; ++ break; ++ case 6: ++ tree_left = count[start + 6]; ++ tree_right = count[start + 7] + ++ count[start + 8] + ++ count[start + 9] + ++ count[start + 10]; ++ break; ++ case 5: ++ tree_left = count[start + 4]; ++ tree_right = count[start + 5]; ++ break; ++ case 4: ++ tree_left = count[start + 4] + ++ count[start + 5]; ++ tree_right = count[start + 6] + ++ count[start + 7] + ++ count[start + 8] + ++ count[start + 9] + ++ count[start + 10]; ++ break; ++ case 3: ++ tree_left = count[start + 2]; ++ tree_right = count[start + 3]; ++ break; ++ case 2: ++ tree_left = count[start + 2] + ++ count[start + 3]; ++ tree_right = count[start + 4] + ++ count[start + 5] + ++ count[start + 6] + ++ count[start + 7] + ++ count[start + 8] + ++ count[start + 9] + ++ count[start + 10]; ++ break; ++ case 1: ++ tree_left = count[start + 1]; ++ tree_right = count[start + 2] + ++ count[start + 3] + ++ count[start + 4] + ++ count[start + 5] + ++ count[start + 6] + ++ count[start + 7] + ++ count[start + 8] + ++ count[start + 9] + ++ count[start + 10]; ++ break; ++ default: ++ tree_left = count[start + 0]; ++ tree_right = count[start + 1] + ++ count[start + 2] + ++ count[start + 3] + ++ count[start + 4] + ++ count[start + 5] + ++ count[start + 6] + ++ count[start + 7] + ++ count[start + 8] + ++ count[start + 9] + ++ count[start + 10]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ ++ coef_node_start = mvd_i ? VP9_MV_CLASS0_1_START : ++ VP9_MV_CLASS0_0_START; ++ coef_count_node_start = mvd_i ? ++ VP9_MV_CLASS0_1_COUNT_START : ++ VP9_MV_CLASS0_0_COUNT_START; ++ tree_i = 0; ++ node = 0; ++ tree_left = count[coef_count_node_start + 0]; ++ tree_right = count[coef_count_node_start + 1]; ++ ++ vp9_tree_merge_probs(prev_prob, cur_prob, ++ coef_node_start, ++ tree_left, tree_right, ++ tree_i, node); ++ coef_node_start = mvd_i ? VP9_MV_CLASS0_FP_1_START : ++ VP9_MV_CLASS0_FP_0_START; ++ coef_count_node_start = mvd_i ? ++ VP9_MV_CLASS0_FP_1_COUNT_START : ++ VP9_MV_CLASS0_FP_0_COUNT_START; ++ ++ for (tree_i = 0; tree_i < 3; tree_i++) { ++ for (node = 0; node < 3; node++) { ++ unsigned int start = ++ coef_count_node_start; ++ switch (node) { ++ case 2: ++ tree_left = count[start + 2]; ++ tree_right = count[start + 3]; ++ break; ++ case 1: ++ tree_left = count[start + 1]; ++ tree_right = count[start + 2] + ++ count[start + 3]; ++ break; ++ default: ++ tree_left = count[start + 0]; ++ tree_right = count[start + 1] + ++ count[start + 2] + ++ count[start + 3]; ++ break; ++ } ++ ++ vp9_tree_merge_probs(prev_prob, ++ cur_prob, ++ coef_node_start, ++ tree_left, ++ tree_right, ++ tree_i, node); ++ ++ coef_node_start = coef_node_start + 1; ++ } ++ coef_count_node_start = ++ coef_count_node_start + 4; ++ } ++ } ++ } ++} ++ ++static irqreturn_t codec_vp9_threaded_isr(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_vp9 *vp9 = sess->priv; ++ u32 dec_status = amvdec_read_dos(core, VP9_DEC_STATUS_REG); ++ u32 prob_status = amvdec_read_dos(core, VP9_ADAPT_PROB_REG); ++ int i; ++ ++ if (!vp9) ++ return IRQ_HANDLED; ++ ++ mutex_lock(&vp9->lock); ++ if (dec_status != VP9_HEAD_PARSER_DONE) { ++ dev_err(core->dev_dec, "Unrecognized dec_status: %08X\n", ++ dec_status); ++ amvdec_abort(sess); ++ goto unlock; ++ } ++ ++ pr_debug("ISR: %08X;%08X\n", dec_status, prob_status); ++ sess->keyframe_found = 1; ++ ++ if ((prob_status & 0xff) == 0xfd && vp9->cur_frame) { ++ /* VP9_REQ_ADAPT_PROB */ ++ u8 *prev_prob_b = ((u8 *)vp9->workspace_vaddr + ++ PROB_OFFSET) + ++ ((prob_status >> 8) * 0x1000); ++ u8 *cur_prob_b = ((u8 *)vp9->workspace_vaddr + ++ PROB_OFFSET) + 0x4000; ++ u8 *count_b = (u8 *)vp9->workspace_vaddr + ++ COUNT_OFFSET; ++ int last_frame_type = vp9->prev_frame ? ++ vp9->prev_frame->type : ++ KEY_FRAME; ++ ++ adapt_coef_probs(last_frame_type == KEY_FRAME, ++ vp9->cur_frame->type == KEY_FRAME ? 1 : 0, ++ prob_status >> 8, ++ (unsigned int *)prev_prob_b, ++ (unsigned int *)cur_prob_b, ++ (unsigned int *)count_b); ++ ++ memcpy(prev_prob_b, cur_prob_b, ADAPT_PROB_SIZE); ++ amvdec_write_dos(core, VP9_ADAPT_PROB_REG, 0); ++ } ++ ++ /* Invalidate first 3 refs */ ++ for (i = 0; i < REFS_PER_FRAME ; ++i) ++ vp9->frame_refs[i] = NULL; ++ ++ vp9->prev_frame = vp9->cur_frame; ++ codec_vp9_update_ref(vp9); ++ ++ codec_vp9_fetch_rpm(sess); ++ if (codec_vp9_process_rpm(vp9)) { ++ amvdec_src_change(sess, vp9->width, vp9->height, 16); ++ ++ /* No frame is actually processed */ ++ vp9->cur_frame = NULL; ++ ++ /* Show the remaining frame */ ++ codec_vp9_show_frame(sess); ++ ++ /* FIXME: Save refs for resized frame */ ++ if (vp9->frames_num) ++ codec_vp9_save_refs(vp9); ++ ++ goto unlock; ++ } ++ ++ codec_vp9_process_lf(vp9); ++ codec_vp9_process_frame(sess); ++ codec_vp9_show_frame(sess); ++ ++unlock: ++ mutex_unlock(&vp9->lock); ++ return IRQ_HANDLED; ++} ++ ++static irqreturn_t codec_vp9_isr(struct amvdec_session *sess) ++{ ++ return IRQ_WAKE_THREAD; ++} ++ ++struct amvdec_codec_ops codec_vp9_ops = { ++ .start = codec_vp9_start, ++ .stop = codec_vp9_stop, ++ .isr = codec_vp9_isr, ++ .threaded_isr = codec_vp9_threaded_isr, ++ .num_pending_bufs = codec_vp9_num_pending_bufs, ++ .drain = codec_vp9_flush_output, ++ .resume = codec_vp9_resume, ++}; +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.h b/drivers/staging/media/meson/vdec/codec_vp9.h +new file mode 100644 +index 000000000000..62db65a2b939 +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/codec_vp9.h +@@ -0,0 +1,13 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ */ ++ ++#ifndef __MESON_VDEC_CODEC_VP9_H_ ++#define __MESON_VDEC_CODEC_VP9_H_ ++ ++#include "vdec.h" ++ ++extern struct amvdec_codec_ops codec_vp9_ops; ++ ++#endif +diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h +index 55c1a80b955a..0392f41a1eed 100644 +--- a/drivers/staging/media/meson/vdec/hevc_regs.h ++++ b/drivers/staging/media/meson/vdec/hevc_regs.h +@@ -122,6 +122,8 @@ + #define HEVC_MPRED_L0_REF00_POC 0xc880 + #define HEVC_MPRED_L1_REF00_POC 0xc8c0 + ++#define HEVC_MPRED_CTRL4 0xc930 ++ + #define HEVC_MPRED_CUR_POC 0xc980 + #define HEVC_MPRED_COL_POC 0xc984 + #define HEVC_MPRED_MV_RD_END_ADDR 0xc988 +@@ -140,6 +142,10 @@ + #define HEVCD_IPP_LINEBUFF_BASE 0xd024 + #define HEVCD_IPP_AXIIF_CONFIG 0xd02c + ++#define VP9D_MPP_REF_SCALE_ENBL 0xd104 ++#define VP9D_MPP_REFINFO_TBL_ACCCONFIG 0xd108 ++#define VP9D_MPP_REFINFO_DATA 0xd10c ++ + #define HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR 0xd180 + #define HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR 0xd184 + #define HEVCD_MPP_ANC2AXI_TBL_DATA 0xd190 +@@ -164,6 +170,7 @@ + #define HEVC_DBLK_CFG9 0xd424 + #define HEVC_DBLK_CFGA 0xd428 + #define HEVC_DBLK_STS0 0xd42c ++#define HEVC_DBLK_CFGB 0xd42c + #define HEVC_DBLK_STS1 0xd430 + #define HEVC_DBLK_CFGE 0xd438 + +diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c +index bfca4c82aa56..f19b463aa392 100644 +--- a/drivers/staging/media/meson/vdec/vdec.c ++++ b/drivers/staging/media/meson/vdec/vdec.c +@@ -395,6 +395,7 @@ static void vdec_reset_bufs_recycle(struct amvdec_session *sess) + static void vdec_stop_streaming(struct vb2_queue *q) + { + struct amvdec_session *sess = vb2_get_drv_priv(q); ++ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; + struct amvdec_core *core = sess->core; + struct vb2_v4l2_buffer *buf; + +@@ -423,6 +424,10 @@ static void vdec_stop_streaming(struct vb2_queue *q) + + sess->streamon_out = 0; + } else { ++ /* Drain remaining refs if was still running */ ++ if (sess->status >= STATUS_RUNNING && codec_ops->drain) ++ codec_ops->drain(sess); ++ + while ((buf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx))) + v4l2_m2m_buf_done(buf, VB2_BUF_STATE_ERROR); + +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index caec0fb60338..7f07a9175815 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -299,6 +299,10 @@ static void dst_buf_done(struct amvdec_session *sess, + sess->sequence_cap - 1); + v4l2_event_queue_fh(&sess->fh, &ev); + vbuf->flags |= V4L2_BUF_FLAG_LAST; ++ } else if (sess->status == STATUS_NEEDS_RESUME) { ++ /* Mark LAST for drained show frames during a source change */ ++ vbuf->flags |= V4L2_BUF_FLAG_LAST; ++ sess->sequence_cap = 0; + } else if (sess->should_stop) + dev_dbg(dev, "should_stop, %u bufs remain\n", + atomic_read(&sess->esparser_queued_bufs)); +diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c +index e9356a46828f..eabbebab2da2 100644 +--- a/drivers/staging/media/meson/vdec/vdec_platform.c ++++ b/drivers/staging/media/meson/vdec/vdec_platform.c +@@ -8,8 +8,10 @@ + #include "vdec.h" + + #include "vdec_1.h" ++#include "vdec_hevc.h" + #include "codec_mpeg12.h" + #include "codec_h264.h" ++#include "codec_vp9.h" + + static const struct amvdec_format vdec_formats_gxbb[] = { + { +@@ -51,6 +53,18 @@ static const struct amvdec_format vdec_formats_gxbb[] = { + + static const struct amvdec_format vdec_formats_gxl[] = { + { ++ .pixfmt = V4L2_PIX_FMT_VP9, ++ .min_buffers = 16, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_vp9_ops, ++ .firmware_path = "meson/vdec/gxl_vp9.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, + .max_buffers = 24, +@@ -127,6 +141,18 @@ static const struct amvdec_format vdec_formats_gxm[] = { + + static const struct amvdec_format vdec_formats_g12a[] = { + { ++ .pixfmt = V4L2_PIX_FMT_VP9, ++ .min_buffers = 16, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_vp9_ops, ++ .firmware_path = "meson/vdec/g12a_vp9.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, + .max_buffers = 24, +@@ -165,6 +191,18 @@ static const struct amvdec_format vdec_formats_g12a[] = { + + static const struct amvdec_format vdec_formats_sm1[] = { + { ++ .pixfmt = V4L2_PIX_FMT_VP9, ++ .min_buffers = 16, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_vp9_ops, ++ .firmware_path = "meson/vdec/sm1_vp9_mmu.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, + .max_buffers = 24, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0114-TEMP-silence-multi-channel-GX-log-spam.patch b/packages/linux/patches/amlogic/amlogic-0114-TEMP-silence-multi-channel-GX-log-spam.patch deleted file mode 100644 index 9da7c7082c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0114-TEMP-silence-multi-channel-GX-log-spam.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 924a5fe4044150ba30b962522925674a5c31d75a Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Tue, 13 Aug 2019 09:13:44 +0000 -Subject: [PATCH 114/187] TEMP: silence multi-channel GX log spam - -Signed-off-by: Christian Hewitt ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 2 +- - sound/soc/codecs/hdmi-codec.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index 63ca25dfc129..73d63c4dd01d 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -@@ -57,7 +57,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, - inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; - conf0 = (HDMI_AUD_CONF0_I2S_SELECT | HDMI_AUD_CONF0_I2S_EN0); - -- dev_info(dev, "channels=%d sample_width=%d sample_rate=%d\n", hparms->channels, hparms->sample_width, hparms->sample_rate); -+ dev_dbg(dev, "channels=%d sample_width=%d sample_rate=%d\n", hparms->channels, hparms->sample_width, hparms->sample_rate); - - /* Enable the required i2s lanes */ - switch (hparms->channels) { -diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c -index 608c3638741f..862ebb01cc8d 100644 ---- a/sound/soc/codecs/hdmi-codec.c -+++ b/sound/soc/codecs/hdmi-codec.c -@@ -461,7 +461,7 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, - }; - int ret, idx; - -- dev_info(dai->dev, "%s() width %d rate %d channels %d\n", __func__, -+ dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, - params_width(params), params_rate(params), - params_channels(params)); - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch b/packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch new file mode 100644 index 0000000000..07224e5d7c --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch @@ -0,0 +1,111 @@ +From 36766de5db4a3e886c5465e8f2a7cc20178ae50e Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 20 Feb 2020 17:13:26 +0000 +Subject: [PATCH 115/146] FROMLIST: drm/fourcc: Add modifier definitions for + describing Amlogic Video Framebuffer Compression + +Amlogic uses a proprietary lossless image compression protocol and format +for their hardware video codec accelerators, either video decoders or +video input encoders. + +It considerably reduces memory bandwidth while writing and reading +frames in memory. + +The underlying storage is considered to be 3 components, 8bit or 10-bit +per component, YCbCr 420, single plane : +- DRM_FORMAT_YUV420_8BIT +- DRM_FORMAT_YUV420_10BIT + +This modifier will be notably added to DMA-BUF frames imported from the V4L2 +Amlogic VDEC decoder. + +At least two options are supported : +- Scatter mode: the buffer is filled with a IOMMU scatter table referring + to the encoder current memory layout. This mode if more efficient in terms + of memory allocation but frames are not dumpable and only valid during until + the buffer is freed and back in control of the encoder +- Memory saving: when the pixel bpp is 8b, the size of the superblock can + be reduced, thus saving memory. + +Signed-off-by: Neil Armstrong +--- + include/uapi/drm/drm_fourcc.h | 56 +++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h +index 8bc0b31597d8..8a6e87bacadb 100644 +--- a/include/uapi/drm/drm_fourcc.h ++++ b/include/uapi/drm/drm_fourcc.h +@@ -309,6 +309,7 @@ extern "C" { + #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 + #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 + #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 ++#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a + + /* add more to the end as needed */ + +@@ -804,6 +805,61 @@ extern "C" { + */ + #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) + ++/* ++ * Amlogic Video Framebuffer Compression modifiers ++ * ++ * Amlogic uses a proprietary lossless image compression protocol and format ++ * for their hardware video codec accelerators, either video decoders or ++ * video input encoders. ++ * ++ * It considerably reduces memory bandwidth while writing and reading ++ * frames in memory. ++ * Implementation details may be platform and SoC specific, and shared ++ * between the producer and the decoder on the same platform. ++ * ++ * The underlying storage is considered to be 3 components, 8bit or 10-bit ++ * per component YCbCr 420, single plane : ++ * - DRM_FORMAT_YUV420_8BIT ++ * - DRM_FORMAT_YUV420_10BIT ++ * ++ * The classic memory storage is composed of: ++ * - a body content organized in 64x32 superblocks with 4096 bytes per ++ * superblock in default mode. ++ * - a 32 bytes per 128x64 header block ++ */ ++#define DRM_FORMAT_MOD_AMLOGIC_FBC_DEFAULT fourcc_mod_code(AMLOGIC, 0) ++ ++/* ++ * Amlogic Video Framebuffer Compression Options ++ * ++ * Two optional features are available which may not supported/used on every ++ * SoCs and Compressed Framebuffer producers. ++ */ ++#define DRM_FORMAT_MOD_AMLOGIC_FBC(__modes) fourcc_mod_code(AMLOGIC, __modes) ++ ++/* ++ * Amlogic FBC Scatter Memory layout ++ * ++ * Indicates the header contains IOMMU references to the compressed ++ * frames content to optimize memory access and layout. ++ * In this mode, only the header memory address is needed, thus the ++ * content memory organization is tied to the current producer ++ * execution and cannot be saved/dumped. ++ */ ++#define DRM_FORMAT_MOD_AMLOGIC_FBC_SCATTER (1ULL << 0) ++ ++/* ++ * Amlogic FBC Memory Saving mode ++ * ++ * Indicates the storage is packed when pixel size is multiple of word ++ * boudaries, i.e. 8bit should be stored in this mode to save allocation ++ * memory. ++ * ++ * This mode reduces body layout to 3072 bytes per 64x32 superblock and ++ * 3200 bytes per 64x32 superblock combined with scatter mode. ++ */ ++#define DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING (1ULL << 1) ++ + #if defined(__cplusplus) + } + #endif +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0115-TEMP-arm64-dts-meson-gx-add-vdec-entry.patch b/packages/linux/patches/amlogic/amlogic-0115-TEMP-arm64-dts-meson-gx-add-vdec-entry.patch deleted file mode 100644 index f29be9b066..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0115-TEMP-arm64-dts-meson-gx-add-vdec-entry.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e46797af2343fccb53772151db9a7f7501a0ef3e Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Wed, 29 Aug 2018 15:24:02 +0200 -Subject: [PATCH 115/187] TEMP: arm64: dts: meson-gx: add vdec entry - -Add the video decoder dts entry - -Signed-off-by: Maxime Jourdan ---- - arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -index ed6ab86d3e7e..65155abbe082 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -461,6 +461,20 @@ - }; - }; - -+ vdec: video-decoder@c8820000 { -+ compatible = "amlogic,gx-vdec"; -+ reg = <0x0 0xc8820000 0x0 0x10000>, -+ <0x0 0xc110a580 0x0 0xe4>; -+ reg-names = "dos", "esparser"; -+ -+ interrupts = , -+ ; -+ interrupt-names = "vdec", "esparser"; -+ -+ amlogic,ao-sysctrl = <&sysctrl_AO>; -+ amlogic,canvas = <&canvas>; -+ }; -+ - periphs: periphs@c8834000 { - compatible = "simple-bus"; - reg = <0x0 0xc8834000 0x0 0x2000>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch b/packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch new file mode 100644 index 0000000000..66dc4a80ac --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch @@ -0,0 +1,60 @@ +From a46e55e018d8de7f28bedd7bda0ca5816856469f Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 20 Feb 2020 17:14:31 +0000 +Subject: [PATCH 116/146] FROMLIST: drm/meson: add Amlogic Video FBC registers + +Add the registers of the VPU VD1 Amlogic FBC decoder module, and routing +register. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_registers.h | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h +index 8ea00546cd4e..08631fdfe4b9 100644 +--- a/drivers/gpu/drm/meson/meson_registers.h ++++ b/drivers/gpu/drm/meson/meson_registers.h +@@ -144,10 +144,15 @@ + #define VIU_SW_RESET_OSD1 BIT(0) + #define VIU_MISC_CTRL0 0x1a06 + #define VIU_CTRL0_VD1_AFBC_MASK 0x170000 ++#define VIU_CTRL0_AFBC_TO_VD1 BIT(20) + #define VIU_MISC_CTRL1 0x1a07 + #define MALI_AFBC_MISC GENMASK(15, 8) + #define D2D3_INTF_LENGTH 0x1a08 + #define D2D3_INTF_CTRL0 0x1a09 ++#define VD1_AFBCD0_MISC_CTRL 0x1a0a ++#define VD1_AXI_SEL_AFBC (1 << 12) ++#define AFBC_VD1_SEL (1 << 10) ++#define VD2_AFBCD1_MISC_CTRL 0x1a0b + #define VIU_OSD1_CTRL_STAT 0x1a10 + #define VIU_OSD1_OSD_BLK_ENABLE BIT(0) + #define VIU_OSD1_OSD_MEM_MODE_LINEAR BIT(2) +@@ -365,6 +370,23 @@ + #define VIU_OSD1_OETF_LUT_ADDR_PORT 0x1add + #define VIU_OSD1_OETF_LUT_DATA_PORT 0x1ade + #define AFBC_ENABLE 0x1ae0 ++#define AFBC_MODE 0x1ae1 ++#define AFBC_SIZE_IN 0x1ae2 ++#define AFBC_DEC_DEF_COLOR 0x1ae3 ++#define AFBC_CONV_CTRL 0x1ae4 ++#define AFBC_LBUF_DEPTH 0x1ae5 ++#define AFBC_HEAD_BADDR 0x1ae6 ++#define AFBC_BODY_BADDR 0x1ae7 ++#define AFBC_SIZE_OUT 0x1ae8 ++#define AFBC_OUT_YSCOPE 0x1ae9 ++#define AFBC_STAT 0x1aea ++#define AFBC_VD_CFMT_CTRL 0x1aeb ++#define AFBC_VD_CFMT_W 0x1aec ++#define AFBC_MIF_HOR_SCOPE 0x1aed ++#define AFBC_MIF_VER_SCOPE 0x1aee ++#define AFBC_PIXEL_HOR_SCOPE 0x1aef ++#define AFBC_PIXEL_VER_SCOPE 0x1af0 ++#define AFBC_VD_CFMT_H 0x1af1 + + /* vpp */ + #define VPP_DUMMY_DATA 0x1d00 +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0116-TEMP-arm64-dts-meson-add-vdec-entries.patch b/packages/linux/patches/amlogic/amlogic-0116-TEMP-arm64-dts-meson-add-vdec-entries.patch deleted file mode 100644 index d7a4e5c70a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0116-TEMP-arm64-dts-meson-add-vdec-entries.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 01c278a4ec857842bb7a156c49d37559eb1e4f64 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Wed, 29 Aug 2018 15:24:22 +0200 -Subject: [PATCH 116/187] TEMP: arm64: dts: meson: add vdec entries - -This enables the video decoder for gxbb, gxl and gxm chips - -Signed-off-by: Maxime Jourdan ---- - arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 11 +++++++++++ - arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 11 +++++++++++ - arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 4 ++++ - 3 files changed, 26 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -index 30dbc3753045..d432398a5150 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi -@@ -873,3 +873,14 @@ - compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu"; - power-domains = <&pwrc_vpu>; - }; -+ -+&vdec { -+ compatible = "amlogic,gxbb-vdec"; -+ clocks = <&clkc CLKID_DOS_PARSER>, -+ <&clkc CLKID_DOS>, -+ <&clkc CLKID_VDEC_1>, -+ <&clkc CLKID_VDEC_HEVC>; -+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc"; -+ resets = <&reset RESET_PARSER>; -+ reset-names = "esparser"; -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -index a76e5b603da9..d8814fc30e78 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -@@ -876,3 +876,14 @@ - compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu"; - power-domains = <&pwrc_vpu>; - }; -+ -+&vdec { -+ compatible = "amlogic,gxl-vdec"; -+ clocks = <&clkc CLKID_DOS_PARSER>, -+ <&clkc CLKID_DOS>, -+ <&clkc CLKID_VDEC_1>, -+ <&clkc CLKID_VDEC_HEVC>; -+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc"; -+ resets = <&reset RESET_PARSER>; -+ reset-names = "esparser"; -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi -index 7a85a82bf65d..13e76d4136c0 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi -@@ -144,3 +144,7 @@ - &dwc3 { - phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>, <&usb2_phy2>; - }; -+ -+&vdec { -+ compatible = "amlogic,gxm-vdec"; -+}; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch b/packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch new file mode 100644 index 0000000000..4d242c7e88 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch @@ -0,0 +1,425 @@ +From 2efbbf6375425dee26a2e6e5e0c91822959734bc Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 20 Feb 2020 17:15:43 +0000 +Subject: [PATCH 117/146] FROMLIST: drm/meson: overlay: setup overlay for + Amlogic FBC + +Setup the Amlogic FBC decoder for the VD1 video overlay plane. + +The VD1 Amlogic FBC decoder is integrated in the pipeline like the +YUV pixel reading/formatter but used a direct memory address instead. + +The default mode needs to calculate the content body size since the header +is allocated after. + +The scatter mode needs a simplier management since only the header is needed, +since it contains an IOMMU scatter table to locate the superblocks in memory. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_drv.h | 16 ++ + drivers/gpu/drm/meson/meson_overlay.c | 257 +++++++++++++++++++++++++- + 2 files changed, 265 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h +index 04fdf3826643..da951964e988 100644 +--- a/drivers/gpu/drm/meson/meson_drv.h ++++ b/drivers/gpu/drm/meson/meson_drv.h +@@ -80,6 +80,7 @@ struct meson_drm { + + bool vd1_enabled; + bool vd1_commit; ++ bool vd1_afbc; + unsigned int vd1_planes; + uint32_t vd1_if0_gen_reg; + uint32_t vd1_if0_luma_x0; +@@ -105,6 +106,21 @@ struct meson_drm { + uint32_t vd1_height0; + uint32_t vd1_height1; + uint32_t vd1_height2; ++ uint32_t vd1_afbc_mode; ++ uint32_t vd1_afbc_en; ++ uint32_t vd1_afbc_head_addr; ++ uint32_t vd1_afbc_body_addr; ++ uint32_t vd1_afbc_conv_ctrl; ++ uint32_t vd1_afbc_dec_def_color; ++ uint32_t vd1_afbc_vd_cfmt_ctrl; ++ uint32_t vd1_afbc_vd_cfmt_w; ++ uint32_t vd1_afbc_vd_cfmt_h; ++ uint32_t vd1_afbc_mif_hor_scope; ++ uint32_t vd1_afbc_mif_ver_scope; ++ uint32_t vd1_afbc_size_out; ++ uint32_t vd1_afbc_pixel_hor_scope; ++ uint32_t vd1_afbc_pixel_ver_scope; ++ uint32_t vd1_afbc_size_in; + uint32_t vpp_pic_in_height; + uint32_t vpp_postblend_vd1_h_start_end; + uint32_t vpp_postblend_vd1_v_start_end; +diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c +index 2468b0212d52..1fbb81732e9a 100644 +--- a/drivers/gpu/drm/meson/meson_overlay.c ++++ b/drivers/gpu/drm/meson/meson_overlay.c +@@ -5,6 +5,7 @@ + * Copyright (C) 2015 Amlogic, Inc. All rights reserved. + */ + ++#define DEBUG + #include + + #include +@@ -76,6 +77,84 @@ + #define VD_REGION24_START(value) FIELD_PREP(GENMASK(11, 0), value) + #define VD_REGION13_END(value) FIELD_PREP(GENMASK(27, 16), value) + ++/* AFBC_ENABLE */ ++#define AFBC_DEC_ENABLE BIT(8) ++#define AFBC_FRM_START BIT(0) ++ ++/* AFBC_MODE */ ++#define AFBC_HORZ_SKIP_UV(value) FIELD_PREP(GENMASK(1, 0), value) ++#define AFBC_VERT_SKIP_UV(value) FIELD_PREP(GENMASK(3, 2), value) ++#define AFBC_HORZ_SKIP_Y(value) FIELD_PREP(GENMASK(5, 4), value) ++#define AFBC_VERT_SKIP_Y(value) FIELD_PREP(GENMASK(7, 6), value) ++#define AFBC_COMPBITS_YUV(value) FIELD_PREP(GENMASK(13, 8), value) ++#define AFBC_COMPBITS_8BIT 0 ++#define AFBC_COMPBITS_10BIT (2 | (2 << 2) | (2 << 4)) ++#define AFBC_BURST_LEN(value) FIELD_PREP(GENMASK(15, 14), value) ++#define AFBC_HOLD_LINE_NUM(value) FIELD_PREP(GENMASK(22, 16), value) ++#define AFBC_MIF_URGENT(value) FIELD_PREP(GENMASK(25, 24), value) ++#define AFBC_REV_MODE(value) FIELD_PREP(GENMASK(27, 26), value) ++#define AFBC_BLK_MEM_MODE BIT(28) ++#define AFBC_SCATTER_MODE BIT(29) ++#define AFBC_SOFT_RESET BIT(31) ++ ++/* AFBC_SIZE_IN */ ++#define AFBC_HSIZE_IN(value) FIELD_PREP(GENMASK(28, 16), value) ++#define AFBC_VSIZE_IN(value) FIELD_PREP(GENMASK(12, 0), value) ++ ++/* AFBC_DEC_DEF_COLOR */ ++#define AFBC_DEF_COLOR_Y(value) FIELD_PREP(GENMASK(29, 20), value) ++#define AFBC_DEF_COLOR_U(value) FIELD_PREP(GENMASK(19, 10), value) ++#define AFBC_DEF_COLOR_V(value) FIELD_PREP(GENMASK(9, 0), value) ++ ++/* AFBC_CONV_CTRL */ ++#define AFBC_CONV_LBUF_LEN(value) FIELD_PREP(GENMASK(11, 0), value) ++ ++/* AFBC_LBUF_DEPTH */ ++#define AFBC_DEC_LBUF_DEPTH(value) FIELD_PREP(GENMASK(27, 16), value) ++#define AFBC_MIF_LBUF_DEPTH(value) FIELD_PREP(GENMASK(11, 0), value) ++ ++/* AFBC_OUT_XSCOPE/AFBC_SIZE_OUT */ ++#define AFBC_HSIZE_OUT(value) FIELD_PREP(GENMASK(28, 16), value) ++#define AFBC_VSIZE_OUT(value) FIELD_PREP(GENMASK(12, 0), value) ++#define AFBC_OUT_HORZ_BGN(value) FIELD_PREP(GENMASK(28, 16), value) ++#define AFBC_OUT_HORZ_END(value) FIELD_PREP(GENMASK(12, 0), value) ++ ++/* AFBC_OUT_YSCOPE */ ++#define AFBC_OUT_VERT_BGN(value) FIELD_PREP(GENMASK(28, 16), value) ++#define AFBC_OUT_VERT_END(value) FIELD_PREP(GENMASK(12, 0), value) ++ ++/* AFBC_VD_CFMT_CTRL */ ++#define AFBC_HORZ_RPT_PIXEL0 BIT(23) ++#define AFBC_HORZ_Y_C_RATIO(value) FIELD_PREP(GENMASK(22, 21), value) ++#define AFBC_HORZ_FMT_EN BIT(20) ++#define AFBC_VERT_RPT_LINE0 BIT(16) ++#define AFBC_VERT_INITIAL_PHASE(value) FIELD_PREP(GENMASK(11, 8), value) ++#define AFBC_VERT_PHASE_STEP(value) FIELD_PREP(GENMASK(7, 1), value) ++#define AFBC_VERT_FMT_EN BIT(0) ++ ++/* AFBC_VD_CFMT_W */ ++#define AFBC_VD_V_WIDTH(value) FIELD_PREP(GENMASK(11, 0), value) ++#define AFBC_VD_H_WIDTH(value) FIELD_PREP(GENMASK(27, 16), value) ++ ++/* AFBC_MIF_HOR_SCOPE */ ++#define AFBC_MIF_BLK_BGN_H(value) FIELD_PREP(GENMASK(25, 16), value) ++#define AFBC_MIF_BLK_END_H(value) FIELD_PREP(GENMASK(9, 0), value) ++ ++/* AFBC_MIF_VER_SCOPE */ ++#define AFBC_MIF_BLK_BGN_V(value) FIELD_PREP(GENMASK(27, 16), value) ++#define AFBC_MIF_BLK_END_V(value) FIELD_PREP(GENMASK(11, 0), value) ++ ++/* AFBC_PIXEL_HOR_SCOPE */ ++#define AFBC_DEC_PIXEL_BGN_H(value) FIELD_PREP(GENMASK(28, 16), value) ++#define AFBC_DEC_PIXEL_END_H(value) FIELD_PREP(GENMASK(12, 0), value) ++ ++/* AFBC_PIXEL_VER_SCOPE */ ++#define AFBC_DEC_PIXEL_BGN_V(value) FIELD_PREP(GENMASK(28, 16), value) ++#define AFBC_DEC_PIXEL_END_V(value) FIELD_PREP(GENMASK(12, 0), value) ++ ++/* AFBC_VD_CFMT_H */ ++#define AFBC_VD_HEIGHT(value) FIELD_PREP(GENMASK(12, 0), value) ++ + struct meson_overlay { + struct drm_plane base; + struct meson_drm *priv; +@@ -157,6 +236,9 @@ static void meson_overlay_setup_scaler_params(struct meson_drm *priv, + unsigned int ratio_x, ratio_y; + int temp_height, temp_width; + unsigned int w_in, h_in; ++ int afbc_left, afbc_right; ++ int afbc_top_src, afbc_bottom_src; ++ int afbc_top, afbc_bottom; + int temp, start, end; + + if (!crtc_state) { +@@ -169,7 +251,7 @@ static void meson_overlay_setup_scaler_params(struct meson_drm *priv, + + w_in = fixed16_to_int(state->src_w); + h_in = fixed16_to_int(state->src_h); +- crop_top = fixed16_to_int(state->src_x); ++ crop_top = fixed16_to_int(state->src_y); + crop_left = fixed16_to_int(state->src_x); + + video_top = state->crtc_y; +@@ -243,6 +325,14 @@ static void meson_overlay_setup_scaler_params(struct meson_drm *priv, + DRM_DEBUG("vsc startp %d endp %d start_lines %d end_lines %d\n", + vsc_startp, vsc_endp, vd_start_lines, vd_end_lines); + ++ afbc_top = round_down(vd_start_lines, 4); ++ afbc_bottom = round_up(vd_end_lines + 1, 4); ++ afbc_top_src = 0; ++ afbc_bottom_src = round_up(h_in + 1, 4); ++ ++ DRM_DEBUG("afbc top %d (src %d) bottom %d (src %d)\n", ++ afbc_top, afbc_top_src, afbc_bottom, afbc_bottom_src); ++ + /* Horizontal */ + + start = video_left + video_width / 2 - ((w_in << 17) / ratio_x); +@@ -278,6 +368,16 @@ static void meson_overlay_setup_scaler_params(struct meson_drm *priv, + DRM_DEBUG("hsc startp %d endp %d start_lines %d end_lines %d\n", + hsc_startp, hsc_endp, hd_start_lines, hd_end_lines); + ++ if (hd_start_lines > 0 || (hd_end_lines < w_in)) { ++ afbc_left = 0; ++ afbc_right = round_up(w_in, 32); ++ } else { ++ afbc_left = round_down(hd_start_lines, 32); ++ afbc_right = round_up(hd_end_lines + 1, 32); ++ } ++ ++ DRM_DEBUG("afbc left %d right %d\n", afbc_left, afbc_right); ++ + priv->viu.vpp_vsc_start_phase_step = ratio_y << 6; + + priv->viu.vpp_vsc_ini_phase = vphase << 8; +@@ -293,6 +393,35 @@ static void meson_overlay_setup_scaler_params(struct meson_drm *priv, + VD_H_WIDTH(hd_end_lines - hd_start_lines + 1) | + VD_V_WIDTH(hd_end_lines/2 - hd_start_lines/2 + 1); + ++ priv->viu.vd1_afbc_vd_cfmt_w = ++ AFBC_VD_H_WIDTH(afbc_right - afbc_left) | ++ AFBC_VD_V_WIDTH(afbc_right / 2 - afbc_left / 2); ++ ++ priv->viu.vd1_afbc_vd_cfmt_h = ++ AFBC_VD_HEIGHT((afbc_bottom - afbc_top) / 2); ++ ++ priv->viu.vd1_afbc_mif_hor_scope = AFBC_MIF_BLK_BGN_H(afbc_left / 32) | ++ AFBC_MIF_BLK_END_H((afbc_right / 32) - 1); ++ ++ priv->viu.vd1_afbc_mif_ver_scope = AFBC_MIF_BLK_BGN_V(afbc_top / 4) | ++ AFBC_MIF_BLK_END_H((afbc_bottom / 4) - 1); ++ ++ priv->viu.vd1_afbc_size_out = ++ AFBC_HSIZE_OUT(afbc_right - afbc_left) | ++ AFBC_VSIZE_OUT(afbc_bottom - afbc_top); ++ ++ priv->viu.vd1_afbc_pixel_hor_scope = ++ AFBC_DEC_PIXEL_BGN_H(hd_start_lines - afbc_left) | ++ AFBC_DEC_PIXEL_END_H(hd_end_lines - afbc_left); ++ ++ priv->viu.vd1_afbc_pixel_ver_scope = ++ AFBC_DEC_PIXEL_BGN_V(vd_start_lines - afbc_top) | ++ AFBC_DEC_PIXEL_END_V(vd_end_lines - afbc_top); ++ ++ priv->viu.vd1_afbc_size_in = ++ AFBC_HSIZE_IN(afbc_right - afbc_left) | ++ AFBC_VSIZE_IN(afbc_bottom_src - afbc_top_src); ++ + priv->viu.vd1_if0_luma_y0 = VD_Y_START(vd_start_lines) | + VD_Y_END(vd_end_lines); + +@@ -350,11 +479,63 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + + spin_lock_irqsave(&priv->drm->event_lock, flags); + +- priv->viu.vd1_if0_gen_reg = VD_URGENT_CHROMA | +- VD_URGENT_LUMA | +- VD_HOLD_LINES(9) | +- VD_CHRO_RPT_LASTL_CTRL | +- VD_ENABLE; ++ if ((fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC(0)) == ++ DRM_FORMAT_MOD_AMLOGIC_FBC(0)) { ++ priv->viu.vd1_afbc = true; ++ ++ priv->viu.vd1_afbc_mode = AFBC_MIF_URGENT(3) | ++ AFBC_HOLD_LINE_NUM(8) | ++ AFBC_BURST_LEN(2); ++ ++ if (fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC_SCATTER) ++ priv->viu.vd1_afbc_mode |= AFBC_SCATTER_MODE; ++ ++ if (fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING) ++ priv->viu.vd1_afbc_mode |= AFBC_BLK_MEM_MODE; ++ ++ priv->viu.vd1_afbc_en = 0x1600 | AFBC_DEC_ENABLE; ++ ++ priv->viu.vd1_afbc_conv_ctrl = AFBC_CONV_LBUF_LEN(256); ++ ++ priv->viu.vd1_afbc_dec_def_color = AFBC_DEF_COLOR_Y(1023); ++ ++ /* 420: horizontal / 2, vertical / 4 */ ++ priv->viu.vd1_afbc_vd_cfmt_ctrl = AFBC_HORZ_RPT_PIXEL0 | ++ AFBC_HORZ_Y_C_RATIO(1) | ++ AFBC_HORZ_FMT_EN | ++ AFBC_VERT_RPT_LINE0 | ++ AFBC_VERT_INITIAL_PHASE(12) | ++ AFBC_VERT_PHASE_STEP(8) | ++ AFBC_VERT_FMT_EN; ++ ++ switch (fb->format->format) { ++ /* AFBC Only formats */ ++ case DRM_FORMAT_YUV420_10BIT: ++ priv->viu.vd1_afbc_mode |= ++ AFBC_COMPBITS_YUV(AFBC_COMPBITS_10BIT); ++ priv->viu.vd1_afbc_dec_def_color |= ++ AFBC_DEF_COLOR_U(512) | ++ AFBC_DEF_COLOR_V(512); ++ break; ++ case DRM_FORMAT_YUV420_8BIT: ++ priv->viu.vd1_afbc_dec_def_color |= ++ AFBC_DEF_COLOR_U(128) | ++ AFBC_DEF_COLOR_V(128); ++ break; ++ } ++ ++ priv->viu.vd1_if0_gen_reg = 0; ++ priv->viu.vd1_if0_canvas0 = 0; ++ priv->viu.viu_vd1_fmt_ctrl = 0; ++ } else { ++ priv->viu.vd1_afbc = false; ++ ++ priv->viu.vd1_if0_gen_reg = VD_URGENT_CHROMA | ++ VD_URGENT_LUMA | ++ VD_HOLD_LINES(9) | ++ VD_CHRO_RPT_LASTL_CTRL | ++ VD_ENABLE; ++ } + + /* Setup scaler params */ + meson_overlay_setup_scaler_params(priv, plane, interlace_mode); +@@ -370,6 +551,7 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + priv->viu.vd1_if0_gen_reg2 = 0; + priv->viu.viu_vd1_fmt_ctrl = 0; + ++ /* None will match for AFBC Only formats */ + switch (fb->format->format) { + /* TOFIX DRM_FORMAT_RGB888 should be supported */ + case DRM_FORMAT_YUYV: +@@ -488,13 +670,42 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + priv->viu.vd1_stride0 = fb->pitches[0]; + priv->viu.vd1_height0 = + drm_format_info_plane_height(fb->format, +- fb->height, 0); ++ fb->height, 0); + DRM_DEBUG("plane 0 addr 0x%x stride %d height %d\n", + priv->viu.vd1_addr0, + priv->viu.vd1_stride0, + priv->viu.vd1_height0); + } + ++ if (priv->viu.vd1_afbc) { ++ if (priv->viu.vd1_afbc_mode & AFBC_SCATTER_MODE) { ++ /* ++ * In Scatter mode, the header contains the physical ++ * body content layout, thus the body content ++ * size isn't needed. ++ */ ++ priv->viu.vd1_afbc_head_addr = priv->viu.vd1_addr0 >> 4; ++ priv->viu.vd1_afbc_body_addr = 0; ++ } else { ++ /* Default mode is 4k per superblock */ ++ unsigned long block_size = 4096; ++ unsigned long body_size; ++ ++ /* 8bit mem saving mode is 3072bytes per superblock */ ++ if (priv->viu.vd1_afbc_mode & AFBC_BLK_MEM_MODE) ++ block_size = 3072; ++ ++ body_size = (ALIGN(priv->viu.vd1_stride0, 64) / 64) * ++ (ALIGN(priv->viu.vd1_height0, 32) / 32) * ++ block_size; ++ ++ priv->viu.vd1_afbc_body_addr = priv->viu.vd1_addr0 >> 4; ++ /* Header is after body content */ ++ priv->viu.vd1_afbc_head_addr = (priv->viu.vd1_addr0 + ++ body_size) >> 4; ++ } ++ } ++ + priv->viu.vd1_enabled = true; + + spin_unlock_irqrestore(&priv->drm->event_lock, flags); +@@ -531,6 +742,23 @@ static const struct drm_plane_helper_funcs meson_overlay_helper_funcs = { + .prepare_fb = drm_gem_fb_prepare_fb, + }; + ++static bool meson_overlay_format_mod_supported(struct drm_plane *plane, ++ u32 format, u64 modifier) ++{ ++ if (modifier == DRM_FORMAT_MOD_LINEAR && ++ format != DRM_FORMAT_YUV420_8BIT && ++ format != DRM_FORMAT_YUV420_10BIT) ++ return true; ++ ++ if ((modifier & DRM_FORMAT_MOD_AMLOGIC_FBC(0)) == ++ DRM_FORMAT_MOD_AMLOGIC_FBC(0) && ++ (format == DRM_FORMAT_YUV420_8BIT || ++ format == DRM_FORMAT_YUV420_10BIT)) ++ return true; ++ ++ return false; ++} ++ + static const struct drm_plane_funcs meson_overlay_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, +@@ -538,6 +766,7 @@ static const struct drm_plane_funcs meson_overlay_funcs = { + .reset = drm_atomic_helper_plane_reset, + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, ++ .format_mod_supported = meson_overlay_format_mod_supported, + }; + + static const uint32_t supported_drm_formats[] = { +@@ -549,6 +778,18 @@ static const uint32_t supported_drm_formats[] = { + DRM_FORMAT_YUV420, + DRM_FORMAT_YUV411, + DRM_FORMAT_YUV410, ++ DRM_FORMAT_YUV420_8BIT, /* Amlogic FBC Only */ ++ DRM_FORMAT_YUV420_10BIT, /* Amlogic FBC Only */ ++}; ++ ++static const uint64_t format_modifiers[] = { ++ DRM_FORMAT_MOD_AMLOGIC_FBC(DRM_FORMAT_MOD_AMLOGIC_FBC_SCATTER | ++ DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING), ++ DRM_FORMAT_MOD_AMLOGIC_FBC(DRM_FORMAT_MOD_AMLOGIC_FBC_SCATTER), ++ DRM_FORMAT_MOD_AMLOGIC_FBC(DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING), ++ DRM_FORMAT_MOD_AMLOGIC_FBC_DEFAULT, ++ DRM_FORMAT_MOD_LINEAR, ++ DRM_FORMAT_MOD_INVALID, + }; + + int meson_overlay_create(struct meson_drm *priv) +@@ -570,7 +811,7 @@ int meson_overlay_create(struct meson_drm *priv) + &meson_overlay_funcs, + supported_drm_formats, + ARRAY_SIZE(supported_drm_formats), +- NULL, ++ format_modifiers, + DRM_PLANE_TYPE_OVERLAY, "meson_overlay_plane"); + + drm_plane_helper_add(plane, &meson_overlay_helper_funcs); +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0117-TEMP-arm64-dts-meson-g12a-add-video-decoder-node.patch b/packages/linux/patches/amlogic/amlogic-0117-TEMP-arm64-dts-meson-g12a-add-video-decoder-node.patch deleted file mode 100644 index 00f1c722eb..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0117-TEMP-arm64-dts-meson-g12a-add-video-decoder-node.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 48c831371ce937a054b2b8bf0a1773d12ce6a303 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Mon, 26 Aug 2019 05:12:45 +0000 -Subject: [PATCH 117/187] TEMP: arm64: dts: meson-g12a: add video decoder node - -Signed-off-by: Maxime Jourdan ---- - .../boot/dts/amlogic/meson-g12-common.dtsi | 23 +++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -index 2fa4b43f2dad..e4aa4a3b06bd 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi -@@ -2165,6 +2165,29 @@ - }; - }; - -+ vdec: video-decoder@ff620000 { -+ compatible = "amlogic,g12a-vdec"; -+ reg = <0x0 0xff620000 0x0 0x10000>, -+ <0x0 0xffd0e180 0x0 0xe4>; -+ reg-names = "dos", "esparser"; -+ -+ interrupts = , -+ ; -+ interrupt-names = "vdec", "esparser"; -+ -+ amlogic,ao-sysctrl = <&rti>; -+ amlogic,canvas = <&canvas>; -+ -+ clocks = <&clkc CLKID_PARSER>, -+ <&clkc CLKID_DOS>, -+ <&clkc CLKID_VDEC_1>, -+ <&clkc CLKID_VDEC_HEVC>, -+ <&clkc CLKID_VDEC_HEVCF>; -+ clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc", "vdec_hevcf"; -+ resets = <&reset RESET_PARSER>; -+ reset-names = "esparser"; -+ }; -+ - vpu: vpu@ff900000 { - compatible = "amlogic,meson-g12a-vpu"; - reg = <0x0 0xff900000 0x0 0x100000>, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch b/packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch new file mode 100644 index 0000000000..bbe9a1ff95 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch @@ -0,0 +1,160 @@ +From bf2cfb439d3d0936b3636b88d0c793a0a2b8c8a6 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 20 Feb 2020 17:16:57 +0000 +Subject: [PATCH 118/146] FROMLIST: drm/meson: crtc: handle commit of Amlogic + FBC frames + +Since the VD1 Amlogic FBC decoder is now configured by the overlay driver, +commit the right registers to decode the Amlogic FBC frame. + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_crtc.c | 118 +++++++++++++++++++++-------- + 1 file changed, 88 insertions(+), 30 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c +index e66b6271ff58..d6dcfd654e9c 100644 +--- a/drivers/gpu/drm/meson/meson_crtc.c ++++ b/drivers/gpu/drm/meson/meson_crtc.c +@@ -291,6 +291,10 @@ static void meson_crtc_enable_vd1(struct meson_drm *priv) + VPP_VD1_PREBLEND | VPP_VD1_POSTBLEND | + VPP_COLOR_MNG_ENABLE, + priv->io_base + _REG(VPP_MISC)); ++ ++ writel_bits_relaxed(VIU_CTRL0_AFBC_TO_VD1, ++ priv->viu.vd1_afbc ? VIU_CTRL0_AFBC_TO_VD1 : 0, ++ priv->io_base + _REG(VIU_MISC_CTRL0)); + } + + static void meson_g12a_crtc_enable_vd1(struct meson_drm *priv) +@@ -300,6 +304,10 @@ static void meson_g12a_crtc_enable_vd1(struct meson_drm *priv) + VD_BLEND_POSTBLD_SRC_VD1 | + VD_BLEND_POSTBLD_PREMULT_EN, + priv->io_base + _REG(VD1_BLEND_SRC_CTRL)); ++ ++ writel_relaxed(priv->viu.vd1_afbc ? ++ (VD1_AXI_SEL_AFBC | AFBC_VD1_SEL) : 0, ++ priv->io_base + _REG(VD1_AFBCD0_MISC_CTRL)); + } + + void meson_crtc_irq(struct meson_drm *priv) +@@ -383,36 +391,86 @@ void meson_crtc_irq(struct meson_drm *priv) + /* Update the VD1 registers */ + if (priv->viu.vd1_enabled && priv->viu.vd1_commit) { + +- switch (priv->viu.vd1_planes) { +- case 3: +- meson_canvas_config(priv->canvas, +- priv->canvas_id_vd1_2, +- priv->viu.vd1_addr2, +- priv->viu.vd1_stride2, +- priv->viu.vd1_height2, +- MESON_CANVAS_WRAP_NONE, +- MESON_CANVAS_BLKMODE_LINEAR, +- MESON_CANVAS_ENDIAN_SWAP64); +- /* fallthrough */ +- case 2: +- meson_canvas_config(priv->canvas, +- priv->canvas_id_vd1_1, +- priv->viu.vd1_addr1, +- priv->viu.vd1_stride1, +- priv->viu.vd1_height1, +- MESON_CANVAS_WRAP_NONE, +- MESON_CANVAS_BLKMODE_LINEAR, +- MESON_CANVAS_ENDIAN_SWAP64); +- /* fallthrough */ +- case 1: +- meson_canvas_config(priv->canvas, +- priv->canvas_id_vd1_0, +- priv->viu.vd1_addr0, +- priv->viu.vd1_stride0, +- priv->viu.vd1_height0, +- MESON_CANVAS_WRAP_NONE, +- MESON_CANVAS_BLKMODE_LINEAR, +- MESON_CANVAS_ENDIAN_SWAP64); ++ if (priv->viu.vd1_afbc) { ++ writel_relaxed(priv->viu.vd1_afbc_head_addr, ++ priv->io_base + ++ _REG(AFBC_HEAD_BADDR)); ++ writel_relaxed(priv->viu.vd1_afbc_body_addr, ++ priv->io_base + ++ _REG(AFBC_BODY_BADDR)); ++ writel_relaxed(priv->viu.vd1_afbc_en, ++ priv->io_base + ++ _REG(AFBC_ENABLE)); ++ writel_relaxed(priv->viu.vd1_afbc_mode, ++ priv->io_base + ++ _REG(AFBC_MODE)); ++ writel_relaxed(priv->viu.vd1_afbc_size_in, ++ priv->io_base + ++ _REG(AFBC_SIZE_IN)); ++ writel_relaxed(priv->viu.vd1_afbc_dec_def_color, ++ priv->io_base + ++ _REG(AFBC_DEC_DEF_COLOR)); ++ writel_relaxed(priv->viu.vd1_afbc_conv_ctrl, ++ priv->io_base + ++ _REG(AFBC_CONV_CTRL)); ++ writel_relaxed(priv->viu.vd1_afbc_size_out, ++ priv->io_base + ++ _REG(AFBC_SIZE_OUT)); ++ writel_relaxed(priv->viu.vd1_afbc_vd_cfmt_ctrl, ++ priv->io_base + ++ _REG(AFBC_VD_CFMT_CTRL)); ++ writel_relaxed(priv->viu.vd1_afbc_vd_cfmt_w, ++ priv->io_base + ++ _REG(AFBC_VD_CFMT_W)); ++ writel_relaxed(priv->viu.vd1_afbc_mif_hor_scope, ++ priv->io_base + ++ _REG(AFBC_MIF_HOR_SCOPE)); ++ writel_relaxed(priv->viu.vd1_afbc_mif_ver_scope, ++ priv->io_base + ++ _REG(AFBC_MIF_VER_SCOPE)); ++ writel_relaxed(priv->viu.vd1_afbc_pixel_hor_scope, ++ priv->io_base+ ++ _REG(AFBC_PIXEL_HOR_SCOPE)); ++ writel_relaxed(priv->viu.vd1_afbc_pixel_ver_scope, ++ priv->io_base + ++ _REG(AFBC_PIXEL_VER_SCOPE)); ++ writel_relaxed(priv->viu.vd1_afbc_vd_cfmt_h, ++ priv->io_base + ++ _REG(AFBC_VD_CFMT_H)); ++ } else { ++ switch (priv->viu.vd1_planes) { ++ case 3: ++ meson_canvas_config(priv->canvas, ++ priv->canvas_id_vd1_2, ++ priv->viu.vd1_addr2, ++ priv->viu.vd1_stride2, ++ priv->viu.vd1_height2, ++ MESON_CANVAS_WRAP_NONE, ++ MESON_CANVAS_BLKMODE_LINEAR, ++ MESON_CANVAS_ENDIAN_SWAP64); ++ /* fallthrough */ ++ case 2: ++ meson_canvas_config(priv->canvas, ++ priv->canvas_id_vd1_1, ++ priv->viu.vd1_addr1, ++ priv->viu.vd1_stride1, ++ priv->viu.vd1_height1, ++ MESON_CANVAS_WRAP_NONE, ++ MESON_CANVAS_BLKMODE_LINEAR, ++ MESON_CANVAS_ENDIAN_SWAP64); ++ /* fallthrough */ ++ case 1: ++ meson_canvas_config(priv->canvas, ++ priv->canvas_id_vd1_0, ++ priv->viu.vd1_addr0, ++ priv->viu.vd1_stride0, ++ priv->viu.vd1_height0, ++ MESON_CANVAS_WRAP_NONE, ++ MESON_CANVAS_BLKMODE_LINEAR, ++ MESON_CANVAS_ENDIAN_SWAP64); ++ } ++ ++ writel_relaxed(0, priv->io_base + _REG(AFBC_ENABLE)); + } + + writel_relaxed(priv->viu.vd1_if0_gen_reg, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0119-FROMLIST-arm64-dts-meson-gxbb-odroid-c2-add-rc-odroi.patch b/packages/linux/patches/amlogic/amlogic-0119-FROMLIST-arm64-dts-meson-gxbb-odroid-c2-add-rc-odroi.patch new file mode 100644 index 0000000000..0b2e47a15a --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0119-FROMLIST-arm64-dts-meson-gxbb-odroid-c2-add-rc-odroi.patch @@ -0,0 +1,26 @@ +From 19c3b2dac2ce756a2f2ce1af1a2fd5cda807cfa3 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 19 Oct 2019 04:39:47 +0000 +Subject: [PATCH 119/146] FROMLIST: arm64: dts: meson-gxbb-odroid-c2: add + rc-odroid ir keymap + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +index 76841f75a8a8..b1107d7ff32b 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +@@ -288,6 +288,7 @@ + status = "okay"; + pinctrl-0 = <&remote_input_ao_pins>; + pinctrl-names = "default"; ++ linux,rc-map-name = "rc-odroid"; + }; + + &gpio_ao { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0119-TEMP-media-meson-vdec-add-MPEG4-decoding-support.patch b/packages/linux/patches/amlogic/amlogic-0119-TEMP-media-meson-vdec-add-MPEG4-decoding-support.patch deleted file mode 100644 index 9790e1b33d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0119-TEMP-media-meson-vdec-add-MPEG4-decoding-support.patch +++ /dev/null @@ -1,316 +0,0 @@ -From ba9b3254bdfe7dc87eddbec601acf61fb12365ed Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Wed, 29 Aug 2018 16:01:55 +0200 -Subject: [PATCH 119/187] TEMP: media: meson: vdec: add MPEG4 decoding support - -Add support for V4L2_PIX_FMT_MPEG4, V4L2_PIX_FMT_XVID and -V4L2_PIX_FMT_H.263 - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/Makefile | 2 +- - .../staging/media/meson/vdec/codec_mpeg4.c | 139 ++++++++++++++++++ - .../staging/media/meson/vdec/codec_mpeg4.h | 13 ++ - .../staging/media/meson/vdec/vdec_platform.c | 91 ++++++++++++ - 4 files changed, 244 insertions(+), 1 deletion(-) - create mode 100644 drivers/staging/media/meson/vdec/codec_mpeg4.c - create mode 100644 drivers/staging/media/meson/vdec/codec_mpeg4.h - -diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile -index 711d990c760e..f167a61acb36 100644 ---- a/drivers/staging/media/meson/vdec/Makefile -+++ b/drivers/staging/media/meson/vdec/Makefile -@@ -3,6 +3,6 @@ - - meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o - meson-vdec-objs += vdec_1.o --meson-vdec-objs += codec_mpeg12.o codec_h264.o -+meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o - - obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o -diff --git a/drivers/staging/media/meson/vdec/codec_mpeg4.c b/drivers/staging/media/meson/vdec/codec_mpeg4.c -new file mode 100644 -index 000000000000..1d574e576112 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_mpeg4.c -@@ -0,0 +1,139 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#include -+#include -+ -+#include "vdec_helpers.h" -+#include "dos_regs.h" -+ -+#define SIZE_WORKSPACE SZ_1M -+/* Offset added by firmware, to substract from workspace paddr */ -+#define DCAC_BUFF_START_IP 0x02b00000 -+ -+/* map firmware registers to known MPEG4 functions */ -+#define MREG_BUFFERIN AV_SCRATCH_8 -+#define MREG_BUFFEROUT AV_SCRATCH_9 -+#define MP4_NOT_CODED_CNT AV_SCRATCH_A -+#define MP4_OFFSET_REG AV_SCRATCH_C -+#define MEM_OFFSET_REG AV_SCRATCH_F -+#define MREG_FATAL_ERROR AV_SCRATCH_L -+ -+#define BUF_IDX_MASK GENMASK(2, 0) -+#define INTERLACE_FLAG BIT(7) -+#define TOP_FIELD_FIRST_FLAG BIT(6) -+ -+struct codec_mpeg4 { -+ /* Buffer for the MPEG4 Workspace */ -+ void *workspace_vaddr; -+ dma_addr_t workspace_paddr; -+}; -+ -+static int codec_mpeg4_can_recycle(struct amvdec_core *core) -+{ -+ return !amvdec_read_dos(core, MREG_BUFFERIN); -+} -+ -+static void codec_mpeg4_recycle(struct amvdec_core *core, u32 buf_idx) -+{ -+ amvdec_write_dos(core, MREG_BUFFERIN, ~BIT(buf_idx)); -+} -+ -+static int codec_mpeg4_start(struct amvdec_session *sess) { -+ struct amvdec_core *core = sess->core; -+ struct codec_mpeg4 *mpeg4 = sess->priv; -+ int ret; -+ -+ mpeg4 = kzalloc(sizeof(*mpeg4), GFP_KERNEL); -+ if (!mpeg4) -+ return -ENOMEM; -+ -+ /* Allocate some memory for the MPEG4 decoder's state */ -+ mpeg4->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, -+ &mpeg4->workspace_paddr, -+ GFP_KERNEL); -+ if (!mpeg4->workspace_vaddr) { -+ dev_err(core->dev, "Failed to request MPEG4 Workspace\n"); -+ ret = -ENOMEM; -+ goto free_mpeg4; -+ } -+ -+ /* Canvas regs: AV_SCRATCH_0-AV_SCRATCH_4;AV_SCRATCH_G-AV_SCRATCH_J */ -+ amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_0, AV_SCRATCH_G, 0 }, -+ (u32[]){ 4, 4, 0 }); -+ -+ amvdec_write_dos(core, MEM_OFFSET_REG, -+ mpeg4->workspace_paddr - DCAC_BUFF_START_IP); -+ amvdec_write_dos(core, PSCALE_CTRL, 0); -+ amvdec_write_dos(core, MP4_NOT_CODED_CNT, 0); -+ amvdec_write_dos(core, MREG_BUFFERIN, 0); -+ amvdec_write_dos(core, MREG_BUFFEROUT, 0); -+ amvdec_write_dos(core, MREG_FATAL_ERROR, 0); -+ amvdec_write_dos(core, MDEC_PIC_DC_THRESH, 0x404038aa); -+ -+ sess->keyframe_found = 1; -+ sess->priv = mpeg4; -+ -+ return 0; -+ -+free_mpeg4: -+ kfree(mpeg4); -+ return ret; -+} -+ -+static int codec_mpeg4_stop(struct amvdec_session *sess) -+{ -+ struct codec_mpeg4 *mpeg4 = sess->priv; -+ struct amvdec_core *core = sess->core; -+ -+ if (mpeg4->workspace_vaddr) { -+ dma_free_coherent(core->dev, SIZE_WORKSPACE, -+ mpeg4->workspace_vaddr, -+ mpeg4->workspace_paddr); -+ mpeg4->workspace_vaddr = 0; -+ } -+ -+ return 0; -+} -+ -+static irqreturn_t codec_mpeg4_isr(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ u32 reg; -+ u32 buffer_index; -+ u32 field = V4L2_FIELD_NONE; -+ -+ reg = amvdec_read_dos(core, MREG_FATAL_ERROR); -+ if (reg == 1) { -+ dev_err(core->dev, "mpeg4 fatal error\n"); -+ amvdec_abort(sess); -+ return IRQ_HANDLED; -+ } -+ -+ reg = amvdec_read_dos(core, MREG_BUFFEROUT); -+ if (!reg) -+ goto end; -+ -+ buffer_index = reg & BUF_IDX_MASK; -+ if (reg & INTERLACE_FLAG) -+ field = (reg & TOP_FIELD_FIRST_FLAG) ? -+ V4L2_FIELD_INTERLACED_TB : -+ V4L2_FIELD_INTERLACED_BT; -+ -+ amvdec_dst_buf_done_idx(sess, buffer_index, -1, field); -+ amvdec_write_dos(core, MREG_BUFFEROUT, 0); -+ -+end: -+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1); -+ return IRQ_HANDLED; -+} -+ -+struct amvdec_codec_ops codec_mpeg4_ops = { -+ .start = codec_mpeg4_start, -+ .stop = codec_mpeg4_stop, -+ .isr = codec_mpeg4_isr, -+ .can_recycle = codec_mpeg4_can_recycle, -+ .recycle = codec_mpeg4_recycle, -+}; -diff --git a/drivers/staging/media/meson/vdec/codec_mpeg4.h b/drivers/staging/media/meson/vdec/codec_mpeg4.h -new file mode 100644 -index 000000000000..8dcdcc51fad4 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_mpeg4.h -@@ -0,0 +1,13 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#ifndef __MESON_VDEC_CODEC_MPEG4_H_ -+#define __MESON_VDEC_CODEC_MPEG4_H_ -+ -+#include "vdec.h" -+ -+extern struct amvdec_codec_ops codec_mpeg4_ops; -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -index 579d3e48f0b2..be307bf5bccd 100644 ---- a/drivers/staging/media/meson/vdec/vdec_platform.c -+++ b/drivers/staging/media/meson/vdec/vdec_platform.c -@@ -10,9 +10,40 @@ - #include "vdec_1.h" - #include "codec_mpeg12.h" - #include "codec_h264.h" -+#include "codec_mpeg4.h" - - static const struct amvdec_format vdec_formats_gxbb[] = { - { -+ .pixfmt = V4L2_PIX_FMT_MPEG4, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/vmpeg4_mc_5", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_H263, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/h263_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_XVID, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/vmpeg4_mc_5", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_H264, - .min_buffers = 2, - .max_buffers = 24, -@@ -47,6 +78,36 @@ static const struct amvdec_format vdec_formats_gxbb[] = { - - static const struct amvdec_format vdec_formats_gxl[] = { - { -+ .pixfmt = V4L2_PIX_FMT_MPEG4, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/vmpeg4_mc_5", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_H263, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/h263_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_XVID, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/vmpeg4_mc_5", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_H264, - .min_buffers = 2, - .max_buffers = 24, -@@ -81,6 +142,36 @@ static const struct amvdec_format vdec_formats_gxl[] = { - - static const struct amvdec_format vdec_formats_gxm[] = { - { -+ .pixfmt = V4L2_PIX_FMT_MPEG4, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/vmpeg4_mc_5", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_H263, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/h263_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_XVID, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/gx/vmpeg4_mc_5", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_H264, - .min_buffers = 2, - .max_buffers = 24, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0120-FROMLIST-arm64-dts-meson-gxbb-vega-s95-fix-missing-b.patch b/packages/linux/patches/amlogic/amlogic-0120-FROMLIST-arm64-dts-meson-gxbb-vega-s95-fix-missing-b.patch new file mode 100644 index 0000000000..aecf9fdf0f --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0120-FROMLIST-arm64-dts-meson-gxbb-vega-s95-fix-missing-b.patch @@ -0,0 +1,45 @@ +From 50c13c5012dc6884799e2166a6452dc8c49683b1 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Sat, 13 Apr 2019 06:18:39 +0000 +Subject: [PATCH 120/146] FROMLIST: arm64: dts: meson-gxbb-vega-s95: fix + missing bindings and bluetooth node + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +index 5eab3dfdbd55..3cacd32be986 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +@@ -4,6 +4,8 @@ + */ + + #include "meson-gxbb.dtsi" ++#include ++#include + + / { + compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb"; +@@ -124,7 +126,6 @@ + eth_phy0: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ + reg = <0>; +- + reset-assert-us = <10000>; + reset-deassert-us = <30000>; + reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; +@@ -245,6 +246,9 @@ + bluetooth { + compatible = "brcm,bcm43438-bt"; + shutdown-gpios = <&gpio GPIOX_20 GPIO_ACTIVE_HIGH>; ++ max-speed = <2000000>; ++ clocks = <&wifi32k>; ++ clock-names = "lpo"; + }; + }; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0120-TEMP-media-meson-vdec-add-MJPEG-decoding-support.patch b/packages/linux/patches/amlogic/amlogic-0120-TEMP-media-meson-vdec-add-MJPEG-decoding-support.patch deleted file mode 100644 index 2c3319823b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0120-TEMP-media-meson-vdec-add-MJPEG-decoding-support.patch +++ /dev/null @@ -1,256 +0,0 @@ -From ff4361a1233883772a5bbee3532e77912a0da92e Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Sun, 21 Oct 2018 15:14:27 +0200 -Subject: [PATCH 120/187] TEMP: media: meson: vdec: add MJPEG decoding support - -Add support for V4L2_PIX_FMT_MJPEG - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/Makefile | 2 +- - .../staging/media/meson/vdec/codec_mjpeg.c | 140 ++++++++++++++++++ - .../staging/media/meson/vdec/codec_mjpeg.h | 13 ++ - .../staging/media/meson/vdec/vdec_platform.c | 31 ++++ - 4 files changed, 185 insertions(+), 1 deletion(-) - create mode 100644 drivers/staging/media/meson/vdec/codec_mjpeg.c - create mode 100644 drivers/staging/media/meson/vdec/codec_mjpeg.h - -diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile -index f167a61acb36..20c23f9015eb 100644 ---- a/drivers/staging/media/meson/vdec/Makefile -+++ b/drivers/staging/media/meson/vdec/Makefile -@@ -3,6 +3,6 @@ - - meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o - meson-vdec-objs += vdec_1.o --meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o -+meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o codec_mjpeg.o - - obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o -diff --git a/drivers/staging/media/meson/vdec/codec_mjpeg.c b/drivers/staging/media/meson/vdec/codec_mjpeg.c -new file mode 100644 -index 000000000000..abea9e3f944c ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_mjpeg.c -@@ -0,0 +1,140 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#include -+#include -+ -+#include "vdec_helpers.h" -+#include "dos_regs.h" -+ -+/* map FW registers to known MJPEG functions */ -+#define MREG_DECODE_PARAM AV_SCRATCH_2 -+#define MREG_TO_AMRISC AV_SCRATCH_8 -+#define MREG_FROM_AMRISC AV_SCRATCH_9 -+#define MREG_FRAME_OFFSET AV_SCRATCH_A -+ -+static int codec_mjpeg_can_recycle(struct amvdec_core *core) -+{ -+ return !amvdec_read_dos(core, MREG_TO_AMRISC); -+} -+ -+static void codec_mjpeg_recycle(struct amvdec_core *core, u32 buf_idx) -+{ -+ amvdec_write_dos(core, MREG_TO_AMRISC, buf_idx + 1); -+} -+ -+/* 4 point triangle */ -+static const uint32_t filt_coef[] = { -+ 0x20402000, 0x20402000, 0x1f3f2101, 0x1f3f2101, -+ 0x1e3e2202, 0x1e3e2202, 0x1d3d2303, 0x1d3d2303, -+ 0x1c3c2404, 0x1c3c2404, 0x1b3b2505, 0x1b3b2505, -+ 0x1a3a2606, 0x1a3a2606, 0x19392707, 0x19392707, -+ 0x18382808, 0x18382808, 0x17372909, 0x17372909, -+ 0x16362a0a, 0x16362a0a, 0x15352b0b, 0x15352b0b, -+ 0x14342c0c, 0x14342c0c, 0x13332d0d, 0x13332d0d, -+ 0x12322e0e, 0x12322e0e, 0x11312f0f, 0x11312f0f, -+ 0x10303010 -+}; -+ -+static void codec_mjpeg_init_scaler(struct amvdec_core *core) -+{ -+ int i; -+ -+ /* PSCALE cbus bmem enable */ -+ amvdec_write_dos(core, PSCALE_CTRL, 0xc000); -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 0); -+ for (i = 0; i < ARRAY_SIZE(filt_coef); ++i) { -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, filt_coef[i]); -+ } -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 74); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000); -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 82); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000); -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 78); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000); -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 86); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x0008); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x60000000); -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 73); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000); -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 81); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000); -+ -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 77); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000); -+ amvdec_write_dos(core, PSCALE_BMEM_ADDR, 85); -+ amvdec_write_dos(core, PSCALE_BMEM_DAT, 0x10000); -+ -+ amvdec_write_dos(core, PSCALE_RST, 0x7); -+ amvdec_write_dos(core, PSCALE_RST, 0); -+} -+ -+static int codec_mjpeg_start(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ -+ amvdec_write_dos(core, AV_SCRATCH_0, 12); -+ amvdec_write_dos(core, AV_SCRATCH_1, 0x031a); -+ -+ amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_4, 0 }, -+ (u32[]){ 4, 0 }); -+ codec_mjpeg_init_scaler(core); -+ -+ amvdec_write_dos(core, MREG_TO_AMRISC, 0); -+ amvdec_write_dos(core, MREG_FROM_AMRISC, 0); -+ amvdec_write_dos(core, MCPU_INTR_MSK, 0xffff); -+ amvdec_write_dos(core, MREG_DECODE_PARAM, -+ (sess->height << 4) | 0x8000); -+ amvdec_write_dos(core, VDEC_ASSIST_AMR1_INT8, 8); -+ -+ /* Intra-only codec */ -+ sess->keyframe_found = 1; -+ -+ return 0; -+} -+ -+static int codec_mjpeg_stop(struct amvdec_session *sess) -+{ -+ return 0; -+} -+ -+static irqreturn_t codec_mjpeg_isr(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ u32 reg; -+ u32 buffer_index; -+ u32 offset; -+ -+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1); -+ -+ reg = amvdec_read_dos(core, MREG_FROM_AMRISC); -+ if (!(reg & 0x7)) -+ return IRQ_HANDLED; -+ -+ buffer_index = ((reg & 0x7) - 1) & 3; -+ offset = amvdec_read_dos(core, MREG_FRAME_OFFSET); -+ amvdec_dst_buf_done_idx(sess, buffer_index, offset, V4L2_FIELD_NONE); -+ -+ amvdec_write_dos(core, MREG_FROM_AMRISC, 0); -+ return IRQ_HANDLED; -+} -+ -+struct amvdec_codec_ops codec_mjpeg_ops = { -+ .start = codec_mjpeg_start, -+ .stop = codec_mjpeg_stop, -+ .isr = codec_mjpeg_isr, -+ .can_recycle = codec_mjpeg_can_recycle, -+ .recycle = codec_mjpeg_recycle, -+}; -diff --git a/drivers/staging/media/meson/vdec/codec_mjpeg.h b/drivers/staging/media/meson/vdec/codec_mjpeg.h -new file mode 100644 -index 000000000000..364fa7ee6d9e ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_mjpeg.h -@@ -0,0 +1,13 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#ifndef __MESON_VDEC_CODEC_MJPEG_H_ -+#define __MESON_VDEC_CODEC_MJPEG_H_ -+ -+#include "vdec.h" -+ -+extern struct amvdec_codec_ops codec_mjpeg_ops; -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -index be307bf5bccd..fb714d74753f 100644 ---- a/drivers/staging/media/meson/vdec/vdec_platform.c -+++ b/drivers/staging/media/meson/vdec/vdec_platform.c -@@ -11,9 +11,20 @@ - #include "codec_mpeg12.h" - #include "codec_h264.h" - #include "codec_mpeg4.h" -+#include "codec_mjpeg.h" - - static const struct amvdec_format vdec_formats_gxbb[] = { - { -+ .pixfmt = V4L2_PIX_FMT_MJPEG, -+ .min_buffers = 4, -+ .max_buffers = 4, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mjpeg_ops, -+ .firmware_path = "meson/gx/vmjpeg_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_MPEG4, - .min_buffers = 8, - .max_buffers = 8, -@@ -78,6 +89,16 @@ static const struct amvdec_format vdec_formats_gxbb[] = { - - static const struct amvdec_format vdec_formats_gxl[] = { - { -+ .pixfmt = V4L2_PIX_FMT_MJPEG, -+ .min_buffers = 4, -+ .max_buffers = 4, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mjpeg_ops, -+ .firmware_path = "meson/gx/vmjpeg_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_MPEG4, - .min_buffers = 8, - .max_buffers = 8, -@@ -142,6 +163,16 @@ static const struct amvdec_format vdec_formats_gxl[] = { - - static const struct amvdec_format vdec_formats_gxm[] = { - { -+ .pixfmt = V4L2_PIX_FMT_MJPEG, -+ .min_buffers = 4, -+ .max_buffers = 4, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mjpeg_ops, -+ .firmware_path = "meson/gx/vmjpeg_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_MPEG4, - .min_buffers = 8, - .max_buffers = 8, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0174-WIP-arm64-dts-meson-gxl-s905x-p212-add-bluetooth-nod.patch b/packages/linux/patches/amlogic/amlogic-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch similarity index 79% rename from packages/linux/patches/amlogic/amlogic-0174-WIP-arm64-dts-meson-gxl-s905x-p212-add-bluetooth-nod.patch rename to packages/linux/patches/amlogic/amlogic-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch index cee6aac8da..6722df64ba 100644 --- a/packages/linux/patches/amlogic/amlogic-0174-WIP-arm64-dts-meson-gxl-s905x-p212-add-bluetooth-nod.patch +++ b/packages/linux/patches/amlogic/amlogic-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch @@ -1,8 +1,8 @@ -From 0966380518cfc2f55c5623b8e599c620ae9d376c Mon Sep 17 00:00:00 2001 +From 6eb6ec4e705628b332b27d20afdf103460e2776c Mon Sep 17 00:00:00 2001 From: chewitt Date: Mon, 15 Jul 2019 09:45:17 +0000 -Subject: [PATCH 174/187] WIP: arm64: dts: meson-gxl-s905x-p212: add bluetooth - nodes +Subject: [PATCH 121/146] FROMLIST: arm64: dts: meson-gxl-s905x-p212: add + bluetooth nodes Signed-off-by: Christian Hewitt --- @@ -10,10 +10,10 @@ Signed-off-by: Christian Hewitt 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi -index e3c16f50814b..2863f34cba10 100644 +index ba74f54c5b3f..9ad762197e2f 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi -@@ -15,7 +15,6 @@ +@@ -16,7 +16,6 @@ / { aliases { serial0 = &uart_AO; @@ -21,7 +21,7 @@ index e3c16f50814b..2863f34cba10 100644 ethernet0 = ðmac; }; -@@ -177,6 +176,14 @@ +@@ -250,6 +249,14 @@ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; pinctrl-names = "default"; uart-has-rtscts; diff --git a/packages/linux/patches/amlogic/amlogic-0121-TEMP-media-videodev2.h-Add-Amlogic-compressed-format.patch b/packages/linux/patches/amlogic/amlogic-0121-TEMP-media-videodev2.h-Add-Amlogic-compressed-format.patch deleted file mode 100644 index 581bcd4c16..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0121-TEMP-media-videodev2.h-Add-Amlogic-compressed-format.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 11ac121bbed82fbec1ec9fc65ca889c3105f0593 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Sun, 21 Oct 2018 15:14:49 +0200 -Subject: [PATCH 121/187] TEMP: media: videodev2.h: Add Amlogic compressed - format - -Add V4L2_PIX_FMT_AM21C which is a lossless, compressed framebuffer -format. - -It is used by the video decoding and the display IP on many Amlogic -SoCs. - -Signed-off-by: Maxime Jourdan ---- - drivers/media/v4l2-core/v4l2-ioctl.c | 1 + - include/uapi/linux/videodev2.h | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c -index b1f4b991dba6..74abce874fe8 100644 ---- a/drivers/media/v4l2-core/v4l2-ioctl.c -+++ b/drivers/media/v4l2-core/v4l2-ioctl.c -@@ -1355,6 +1355,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) - case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break; - case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; - case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break; -+ case V4L2_PIX_FMT_AM21C: descr = "Amlogic Compressed Format"; break; - default: - if (fmt->description[0]) - return; -diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h -index 2427bc4d8eba..1e1ae481e42e 100644 ---- a/include/uapi/linux/videodev2.h -+++ b/include/uapi/linux/videodev2.h -@@ -724,6 +724,7 @@ struct v4l2_pix_format { - #define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */ - #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */ - #define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ -+#define V4L2_PIX_FMT_AM21C v4l2_fourcc('A', 'M', '2', '1') /* Amlogic compressed block mode */ - #define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */ - #define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */ - #define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0122-FROMLIST-arm64-dts-meson-fix-gxm-khadas-vim2-wifi.patch b/packages/linux/patches/amlogic/amlogic-0122-FROMLIST-arm64-dts-meson-fix-gxm-khadas-vim2-wifi.patch new file mode 100644 index 0000000000..e79459aaac --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0122-FROMLIST-arm64-dts-meson-fix-gxm-khadas-vim2-wifi.patch @@ -0,0 +1,45 @@ +From f8fd048da3c8ad0a9e39d4fc97f41d58000ada35 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Wed, 19 Feb 2020 12:48:36 +0000 +Subject: [PATCH 122/146] FROMLIST: arm64: dts: meson: fix gxm-khadas-vim2 wifi + +Fixes: adc52bf7ef16 ("arm64: dts: meson: fix mmc v2 chips max frequencies") + +before + +[ 6.418252] brcmfmac: F1 signature read @0x18000000=0x17224356 +[ 6.435663] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4356-sdio for chip BCM4356/2 +[ 6.551259] brcmfmac: brcmf_sdiod_ramrw: membytes transfer failed +[ 6.551275] brcmfmac: brcmf_sdio_verifymemory: error -84 on reading 2048 membytes at 0x00184000 +[ 6.551352] brcmfmac: brcmf_sdio_download_firmware: dongle image file download failed + +after + +[ 6.657165] brcmfmac: F1 signature read @0x18000000=0x17224356 +[ 6.660807] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4356-sdio for chip BCM4356/2 +[ 6.918643] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4356-sdio for chip BCM4356/2 +[ 6.918734] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available +[ 6.922724] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4356/2 wl0: Jun 16 2015 14:25:06 version 7.35.184.r1 (TOB) (r559293) FWID 01-b22ae69c + +Suggested-by: Art Nikpal +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +index a25786c68def..dfa2abc55918 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +@@ -397,7 +397,7 @@ + #size-cells = <0>; + + bus-width = <4>; +- max-frequency = <50000000>; ++ max-frequency = <60000000>; + + non-removable; + disable-wp; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0122-TEMP-media-meson-vdec-add-support-for-V4L2_PIX_FMT_A.patch b/packages/linux/patches/amlogic/amlogic-0122-TEMP-media-meson-vdec-add-support-for-V4L2_PIX_FMT_A.patch deleted file mode 100644 index a827e0ff53..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0122-TEMP-media-meson-vdec-add-support-for-V4L2_PIX_FMT_A.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 3370c6b325e6537621e26c0b1ab4457308a96aae Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Sun, 21 Oct 2018 15:15:26 +0200 -Subject: [PATCH 122/187] TEMP: media: meson: vdec: add support for - V4L2_PIX_FMT_AM21C - -Support the lossless framebuffer compression format. - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/vdec.c | 12 +++++++ - .../staging/media/meson/vdec/vdec_helpers.c | 31 +++++++++++++++++++ - .../staging/media/meson/vdec/vdec_helpers.h | 4 +++ - 3 files changed, 47 insertions(+) - -diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c -index 0a1a04fd5d13..c3415db2b15b 100644 ---- a/drivers/staging/media/meson/vdec/vdec.c -+++ b/drivers/staging/media/meson/vdec/vdec.c -@@ -187,6 +187,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, - { - struct amvdec_session *sess = vb2_get_drv_priv(q); - u32 output_size = amvdec_get_output_size(sess); -+ u32 am21c_size = amvdec_am21c_size(sess->width, sess->height); - - if (*num_planes) { - switch (q->type) { -@@ -209,6 +210,10 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, - sizes[2] < output_size / 4) - return -EINVAL; - break; -+ case V4L2_PIX_FMT_AM21C: -+ if (*num_planes != 1 || sizes[0] < am21c_size) -+ return -EINVAL; -+ break; - default: - return -EINVAL; - } -@@ -238,6 +243,9 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, - sizes[2] = output_size / 4; - *num_planes = 3; - break; -+ case V4L2_PIX_FMT_AM21C: -+ sizes[0] = am21c_size; -+ *num_planes = 1; - default: - return -EINVAL; - } -@@ -518,6 +526,10 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size, - get_output_size(pixmp->width, pixmp->height) / 4; - pfmt[2].bytesperline = ALIGN(pixmp->width, 64) / 2; - pixmp->num_planes = 3; -+ } else if (pixmp->pixelformat == V4L2_PIX_FMT_AM21C) { -+ pfmt[0].sizeimage = -+ amvdec_am21c_size(pixmp->width, pixmp->height); -+ pfmt[0].bytesperline = 0; - } - } else { - return NULL; -diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c -index f16948bdbf2f..2b554f21e3c1 100644 ---- a/drivers/staging/media/meson/vdec/vdec_helpers.c -+++ b/drivers/staging/media/meson/vdec/vdec_helpers.c -@@ -50,6 +50,33 @@ void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val) - } - EXPORT_SYMBOL_GPL(amvdec_write_parser); - -+/* 4 KiB per 64x32 block */ -+u32 amvdec_am21c_body_size(u32 width, u32 height) -+{ -+ u32 width_64 = ALIGN(width, 64) / 64; -+ u32 height_32 = ALIGN(height, 32) / 32; -+ -+ return SZ_4K * width_64 * height_32; -+} -+EXPORT_SYMBOL_GPL(amvdec_am21c_body_size); -+ -+/* 32 bytes per 128x64 block */ -+u32 amvdec_am21c_head_size(u32 width, u32 height) -+{ -+ u32 width_128 = ALIGN(width, 128) / 128; -+ u32 height_64 = ALIGN(height, 64) / 64; -+ -+ return 32 * width_128 * height_64; -+} -+EXPORT_SYMBOL_GPL(amvdec_am21c_head_size); -+ -+u32 amvdec_am21c_size(u32 width, u32 height) -+{ -+ return ALIGN(amvdec_am21c_body_size(width, height) + -+ amvdec_am21c_head_size(width, height), SZ_64K); -+} -+EXPORT_SYMBOL_GPL(amvdec_am21c_size); -+ - static int canvas_alloc(struct amvdec_session *sess, u8 *canvas_id) - { - int ret; -@@ -267,6 +294,10 @@ static void dst_buf_done(struct amvdec_session *sess, - vbuf->vb2_buf.planes[1].bytesused = output_size / 4; - vbuf->vb2_buf.planes[2].bytesused = output_size / 4; - break; -+ case V4L2_PIX_FMT_AM21C: -+ vbuf->vb2_buf.planes[0].bytesused = -+ amvdec_am21c_size(sess->width, sess->height); -+ break; - } - - vbuf->vb2_buf.timestamp = timestamp; -diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h -index a455a9ee1cc2..94d2c1ecfe14 100644 ---- a/drivers/staging/media/meson/vdec/vdec_helpers.h -+++ b/drivers/staging/media/meson/vdec/vdec_helpers.h -@@ -27,6 +27,10 @@ void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val); - u32 amvdec_read_parser(struct amvdec_core *core, u32 reg); - void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val); - -+u32 amvdec_am21c_body_size(u32 width, u32 height); -+u32 amvdec_am21c_head_size(u32 width, u32 height); -+u32 amvdec_am21c_size(u32 width, u32 height); -+ - /** - * amvdec_dst_buf_done_idx() - Signal that a buffer is done decoding - * --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0123-FROMLIST-arm64-dts-meson-gxl-s905x-khadas-vim-add-th.patch b/packages/linux/patches/amlogic/amlogic-0123-FROMLIST-arm64-dts-meson-gxl-s905x-khadas-vim-add-th.patch new file mode 100644 index 0000000000..dfc5c948eb --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0123-FROMLIST-arm64-dts-meson-gxl-s905x-khadas-vim-add-th.patch @@ -0,0 +1,93 @@ +From bbb089ffa58fb2ec94f9a73716c457b81e12f74e Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 21 Feb 2020 05:28:24 +0000 +Subject: [PATCH 123/146] FROMLIST: arm64: dts: meson: gxl-s905x-khadas-vim: + add thermal zones + +Add thermal zones to the VIM1 board so that a cooling fan can be driven +using the i2c interface. Zone config is copied from the VIM2. + +Suggested-by: Nick Xie +Signed-off-by: Christian Hewitt +--- + .../amlogic/meson-gxl-s905x-khadas-vim.dts | 50 +++++++++++++++++++ + 1 file changed, 50 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +index 440bc23c7342..2c198c4212b2 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +@@ -6,6 +6,7 @@ + /dts-v1/; + + #include ++#include + + #include "meson-gxl-s905x-p212.dtsi" + +@@ -63,6 +64,39 @@ + }; + }; + }; ++ ++ thermal-zones { ++ cpu-thermal { ++ polling-delay-passive = <250>; /* milliseconds */ ++ polling-delay = <1000>; /* milliseconds */ ++ ++ thermal-sensors = <&scpi_sensors 0>; ++ ++ trips { ++ cpu_alert0: cpu-alert0 { ++ temperature = <70000>; /* millicelsius */ ++ hysteresis = <2000>; /* millicelsius */ ++ type = "active"; ++ }; ++ ++ cpu_alert1: cpu-alert1 { ++ temperature = <80000>; /* millicelsius */ ++ hysteresis = <2000>; /* millicelsius */ ++ type = "passive"; ++ }; ++ }; ++ ++ cooling-maps { ++ map0 { ++ trip = <&cpu_alert1>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; ++ }; ++ }; ++ }; + }; + + &cec_AO { +@@ -72,6 +106,22 @@ + hdmi-phandle = <&hdmi_tx>; + }; + ++&cpu0 { ++ #cooling-cells = <2>; ++}; ++ ++&cpu1 { ++ #cooling-cells = <2>; ++}; ++ ++&cpu2 { ++ #cooling-cells = <2>; ++}; ++ ++&cpu3 { ++ #cooling-cells = <2>; ++}; ++ + &hdmi_tx { + status = "okay"; + pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0123-TEMP-media-meson-vdec-add-HEVC-decoding-support.patch b/packages/linux/patches/amlogic/amlogic-0123-TEMP-media-meson-vdec-add-HEVC-decoding-support.patch deleted file mode 100644 index ef36ed3750..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0123-TEMP-media-meson-vdec-add-HEVC-decoding-support.patch +++ /dev/null @@ -1,2202 +0,0 @@ -From 2beabde956ca5707c4c54c1bf366d20b2da24509 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Wed, 29 Aug 2018 18:48:35 +0200 -Subject: [PATCH 123/187] TEMP: media: meson: vdec: add HEVC decoding support - -Add support for V4L2_PIX_FMT_HEVC - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/Makefile | 4 +- - drivers/staging/media/meson/vdec/codec_hevc.c | 1357 +++++++++++++++++ - drivers/staging/media/meson/vdec/codec_hevc.h | 13 + - .../media/meson/vdec/codec_hevc_common.c | 188 +++ - .../media/meson/vdec/codec_hevc_common.h | 49 + - drivers/staging/media/meson/vdec/hevc_regs.h | 205 +++ - drivers/staging/media/meson/vdec/vdec.h | 7 +- - drivers/staging/media/meson/vdec/vdec_hevc.c | 191 +++ - drivers/staging/media/meson/vdec/vdec_hevc.h | 22 + - .../staging/media/meson/vdec/vdec_platform.c | 32 + - 10 files changed, 2065 insertions(+), 3 deletions(-) - create mode 100644 drivers/staging/media/meson/vdec/codec_hevc.c - create mode 100644 drivers/staging/media/meson/vdec/codec_hevc.h - create mode 100644 drivers/staging/media/meson/vdec/codec_hevc_common.c - create mode 100644 drivers/staging/media/meson/vdec/codec_hevc_common.h - create mode 100644 drivers/staging/media/meson/vdec/hevc_regs.h - create mode 100644 drivers/staging/media/meson/vdec/vdec_hevc.c - create mode 100644 drivers/staging/media/meson/vdec/vdec_hevc.h - -diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile -index 20c23f9015eb..900dde088da0 100644 ---- a/drivers/staging/media/meson/vdec/Makefile -+++ b/drivers/staging/media/meson/vdec/Makefile -@@ -2,7 +2,7 @@ - # Makefile for Amlogic meson video decoder driver - - meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o --meson-vdec-objs += vdec_1.o --meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o codec_mjpeg.o -+meson-vdec-objs += vdec_1.o vdec_hevc.o -+meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o codec_mjpeg.o codec_hevc_common.o codec_hevc.o - - obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o -diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c -new file mode 100644 -index 000000000000..03f00f969f02 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_hevc.c -@@ -0,0 +1,1357 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. -+ */ -+ -+#include -+#include -+ -+#include "codec_hevc.h" -+#include "dos_regs.h" -+#include "hevc_regs.h" -+#include "vdec_helpers.h" -+#include "codec_hevc_common.h" -+ -+/* HEVC reg mapping */ -+#define HEVC_DEC_STATUS_REG HEVC_ASSIST_SCRATCH_0 -+ #define HEVC_ACTION_DONE 0xff -+#define HEVC_RPM_BUFFER HEVC_ASSIST_SCRATCH_1 -+#define HEVC_SHORT_TERM_RPS HEVC_ASSIST_SCRATCH_2 -+#define HEVC_VPS_BUFFER HEVC_ASSIST_SCRATCH_3 -+#define HEVC_SPS_BUFFER HEVC_ASSIST_SCRATCH_4 -+#define HEVC_PPS_BUFFER HEVC_ASSIST_SCRATCH_5 -+#define HEVC_SAO_UP HEVC_ASSIST_SCRATCH_6 -+#define HEVC_STREAM_SWAP_BUFFER HEVC_ASSIST_SCRATCH_7 -+#define H265_MMU_MAP_BUFFER HEVC_ASSIST_SCRATCH_7 -+#define HEVC_STREAM_SWAP_BUFFER2 HEVC_ASSIST_SCRATCH_8 -+#define HEVC_sao_mem_unit HEVC_ASSIST_SCRATCH_9 -+#define HEVC_SAO_ABV HEVC_ASSIST_SCRATCH_A -+#define HEVC_sao_vb_size HEVC_ASSIST_SCRATCH_B -+#define HEVC_SAO_VB HEVC_ASSIST_SCRATCH_C -+#define HEVC_SCALELUT HEVC_ASSIST_SCRATCH_D -+#define HEVC_WAIT_FLAG HEVC_ASSIST_SCRATCH_E -+#define RPM_CMD_REG HEVC_ASSIST_SCRATCH_F -+#define LMEM_DUMP_ADR HEVC_ASSIST_SCRATCH_F -+#define DEBUG_REG1 HEVC_ASSIST_SCRATCH_G -+#define HEVC_DECODE_MODE2 HEVC_ASSIST_SCRATCH_H -+#define NAL_SEARCH_CTL HEVC_ASSIST_SCRATCH_I -+#define HEVC_DECODE_MODE HEVC_ASSIST_SCRATCH_J -+ #define DECODE_MODE_SINGLE 0 -+#define DECODE_STOP_POS HEVC_ASSIST_SCRATCH_K -+#define HEVC_AUX_ADR HEVC_ASSIST_SCRATCH_L -+#define HEVC_AUX_DATA_SIZE HEVC_ASSIST_SCRATCH_M -+#define HEVC_DECODE_SIZE HEVC_ASSIST_SCRATCH_N -+ -+#define AMRISC_MAIN_REQ 0x04 -+ -+/* HEVC Constants */ -+#define MAX_REF_PIC_NUM 24 -+#define MAX_REF_ACTIVE 16 -+#define MAX_TILE_COL_NUM 10 -+#define MAX_TILE_ROW_NUM 20 -+#define MAX_SLICE_NUM 800 -+#define INVALID_POC 0x80000000 -+ -+/* HEVC Workspace layout */ -+#define MPRED_MV_BUF_SIZE 0x120000 -+ -+#define IPP_SIZE 0x4000 -+#define SAO_ABV_SIZE 0x30000 -+#define SAO_VB_SIZE 0x30000 -+#define SH_TM_RPS_SIZE 0x800 -+#define VPS_SIZE 0x800 -+#define SPS_SIZE 0x800 -+#define PPS_SIZE 0x2000 -+#define SAO_UP_SIZE 0x2800 -+#define SWAP_BUF_SIZE 0x800 -+#define SWAP_BUF2_SIZE 0x800 -+#define SCALELUT_SIZE 0x8000 -+#define DBLK_PARA_SIZE 0x20000 -+#define DBLK_DATA_SIZE 0x40000 -+#define MMU_VBH_SIZE 0x5000 -+#define MPRED_ABV_SIZE 0x8000 -+#define MPRED_MV_SIZE (MPRED_MV_BUF_SIZE * MAX_REF_PIC_NUM) -+#define RPM_BUF_SIZE 0x100 -+#define LMEM_SIZE 0xA00 -+ -+#define IPP_OFFSET 0x00 -+#define SAO_ABV_OFFSET (IPP_OFFSET + IPP_SIZE) -+#define SAO_VB_OFFSET (SAO_ABV_OFFSET + SAO_ABV_SIZE) -+#define SH_TM_RPS_OFFSET (SAO_VB_OFFSET + SAO_VB_SIZE) -+#define VPS_OFFSET (SH_TM_RPS_OFFSET + SH_TM_RPS_SIZE) -+#define SPS_OFFSET (VPS_OFFSET + VPS_SIZE) -+#define PPS_OFFSET (SPS_OFFSET + SPS_SIZE) -+#define SAO_UP_OFFSET (PPS_OFFSET + PPS_SIZE) -+#define SWAP_BUF_OFFSET (SAO_UP_OFFSET + SAO_UP_SIZE) -+#define SWAP_BUF2_OFFSET (SWAP_BUF_OFFSET + SWAP_BUF_SIZE) -+#define SCALELUT_OFFSET (SWAP_BUF2_OFFSET + SWAP_BUF2_SIZE) -+#define DBLK_PARA_OFFSET (SCALELUT_OFFSET + SCALELUT_SIZE) -+#define DBLK_DATA_OFFSET (DBLK_PARA_OFFSET + DBLK_PARA_SIZE) -+#define MMU_VBH_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) -+#define MPRED_ABV_OFFSET (MMU_VBH_OFFSET + MMU_VBH_SIZE) -+#define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) -+#define RPM_OFFSET (MPRED_MV_OFFSET + MPRED_MV_SIZE) -+#define LMEM_OFFSET (RPM_OFFSET + RPM_BUF_SIZE) -+ -+/* ISR decode status */ -+#define HEVC_DEC_IDLE 0x0 -+#define HEVC_NAL_UNIT_VPS 0x1 -+#define HEVC_NAL_UNIT_SPS 0x2 -+#define HEVC_NAL_UNIT_PPS 0x3 -+#define HEVC_NAL_UNIT_CODED_SLICE_SEGMENT 0x4 -+#define HEVC_CODED_SLICE_SEGMENT_DAT 0x5 -+#define HEVC_SLICE_DECODING 0x6 -+#define HEVC_NAL_UNIT_SEI 0x7 -+#define HEVC_SLICE_SEGMENT_DONE 0x8 -+#define HEVC_NAL_SEARCH_DONE 0x9 -+#define HEVC_DECPIC_DATA_DONE 0xa -+#define HEVC_DECPIC_DATA_ERROR 0xb -+#define HEVC_SEI_DAT 0xc -+#define HEVC_SEI_DAT_DONE 0xd -+ -+/* RPM misc_flag0 */ -+#define PCM_LOOP_FILTER_DISABLED_FLAG_BIT 0 -+#define PCM_ENABLE_FLAG_BIT 1 -+#define LOOP_FILER_ACROSS_TILES_ENABLED_FLAG_BIT 2 -+#define PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT 3 -+#define DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG_BIT 4 -+#define PPS_DEBLOCKING_FILTER_DISABLED_FLAG_BIT 5 -+#define DEBLOCKING_FILTER_OVERRIDE_FLAG_BIT 6 -+#define SLICE_DEBLOCKING_FILTER_DISABLED_FLAG_BIT 7 -+#define SLICE_SAO_LUMA_FLAG_BIT 8 -+#define SLICE_SAO_CHROMA_FLAG_BIT 9 -+#define SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT 10 -+ -+/* Constants for HEVC_MPRED_CTRL1 */ -+#define AMVP_MAX_NUM_CANDS_MEM 3 -+#define AMVP_MAX_NUM_CANDS 2 -+#define NUM_CHROMA_MODE 5 -+#define DM_CHROMA_IDX 36 -+ -+/* Buffer sizes */ -+#define SIZE_WORKSPACE ALIGN(LMEM_OFFSET + LMEM_SIZE, 64 * SZ_1K) -+#define SIZE_AUX (SZ_1K * 16) -+#define SIZE_FRAME_MMU (0x1200 * 4) -+#define RPM_SIZE 0x80 -+#define RPS_USED_BIT 14 -+ -+/* Data received from the HW in this form, do not rearrange */ -+union rpm_param { -+ struct { -+ u16 data[RPM_SIZE]; -+ } l; -+ struct { -+ u16 CUR_RPS[MAX_REF_ACTIVE]; -+ u16 num_ref_idx_l0_active; -+ u16 num_ref_idx_l1_active; -+ u16 slice_type; -+ u16 slice_temporal_mvp_enable_flag; -+ u16 dependent_slice_segment_flag; -+ u16 slice_segment_address; -+ u16 num_title_rows_minus1; -+ u16 pic_width_in_luma_samples; -+ u16 pic_height_in_luma_samples; -+ u16 log2_min_coding_block_size_minus3; -+ u16 log2_diff_max_min_coding_block_size; -+ u16 log2_max_pic_order_cnt_lsb_minus4; -+ u16 POClsb; -+ u16 collocated_from_l0_flag; -+ u16 collocated_ref_idx; -+ u16 log2_parallel_merge_level; -+ u16 five_minus_max_num_merge_cand; -+ u16 sps_num_reorder_pics_0; -+ u16 modification_flag; -+ u16 tiles_flags; -+ u16 num_tile_columns_minus1; -+ u16 num_tile_rows_minus1; -+ u16 tile_width[8]; -+ u16 tile_height[8]; -+ u16 misc_flag0; -+ u16 pps_beta_offset_div2; -+ u16 pps_tc_offset_div2; -+ u16 slice_beta_offset_div2; -+ u16 slice_tc_offset_div2; -+ u16 pps_cb_qp_offset; -+ u16 pps_cr_qp_offset; -+ u16 first_slice_segment_in_pic_flag; -+ u16 m_temporalId; -+ u16 m_nalUnitType; -+ u16 vui_num_units_in_tick_hi; -+ u16 vui_num_units_in_tick_lo; -+ u16 vui_time_scale_hi; -+ u16 vui_time_scale_lo; -+ u16 bit_depth; -+ u16 profile_etc; -+ u16 sei_frame_field_info; -+ u16 video_signal_type; -+ u16 modification_list[0x20]; -+ u16 conformance_window_flag; -+ u16 conf_win_left_offset; -+ u16 conf_win_right_offset; -+ u16 conf_win_top_offset; -+ u16 conf_win_bottom_offset; -+ u16 chroma_format_idc; -+ u16 color_description; -+ u16 aspect_ratio_idc; -+ u16 sar_width; -+ u16 sar_height; -+ } p; -+}; -+ -+enum nal_unit_type { -+ NAL_UNIT_CODED_SLICE_BLA = 16, -+ NAL_UNIT_CODED_SLICE_BLANT = 17, -+ NAL_UNIT_CODED_SLICE_BLA_N_LP = 18, -+ NAL_UNIT_CODED_SLICE_IDR = 19, -+ NAL_UNIT_CODED_SLICE_IDR_N_LP = 20, -+}; -+ -+enum slice_type { -+ B_SLICE = 0, -+ P_SLICE = 1, -+ I_SLICE = 2, -+}; -+ -+/* A frame being decoded */ -+struct hevc_frame { -+ struct list_head list; -+ struct vb2_v4l2_buffer *vbuf; -+ u32 offset; -+ u32 poc; -+ -+ int referenced; -+ u32 num_reorder_pic; -+ -+ u32 cur_slice_idx; -+ u32 cur_slice_type; -+ -+ /* 2 lists (L0/L1) ; 800 slices ; 16 refs */ -+ u32 ref_poc_list[2][MAX_SLICE_NUM][MAX_REF_ACTIVE]; -+ u32 ref_num[2]; -+}; -+ -+struct codec_hevc { -+ struct mutex lock; -+ -+ /* Buffer for the HEVC Workspace */ -+ void *workspace_vaddr; -+ dma_addr_t workspace_paddr; -+ -+ /* AUX buffer */ -+ void *aux_vaddr; -+ dma_addr_t aux_paddr; -+ -+ /* Contains many information parsed from the bitstream */ -+ union rpm_param rpm_param; -+ -+ /* Information computed from the RPM */ -+ u32 lcu_size; // Largest Coding Unit -+ u32 lcu_x_num; -+ u32 lcu_y_num; -+ u32 lcu_total; -+ -+ /* Current Frame being handled */ -+ struct hevc_frame *cur_frame; -+ u32 curr_poc; -+ /* Collocated Reference Picture */ -+ struct hevc_frame *col_frame; -+ u32 col_poc; -+ -+ /* All ref frames used by the HW at a given time */ -+ struct list_head ref_frames_list; -+ u32 frames_num; -+ -+ /* Coded resolution reported by the hardware */ -+ u32 width, height; -+ /* Resolution minus the conformance window offsets */ -+ u32 dst_width, dst_height; -+ -+ u32 prev_tid0_poc; -+ u32 slice_segment_addr; -+ u32 slice_addr; -+ u32 ldc_flag; -+ -+ /* Whether we detected the bitstream as 10-bit */ -+ int is_10bit; -+}; -+ -+static u32 codec_hevc_num_pending_bufs(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc; -+ u32 ret; -+ -+ hevc = sess->priv; -+ if (!hevc) -+ return 0; -+ -+ mutex_lock(&hevc->lock); -+ ret = hevc->frames_num; -+ mutex_unlock(&hevc->lock); -+ -+ return ret; -+} -+ -+/* Update the L0 and L1 reference lists for a given frame */ -+static void codec_hevc_update_frame_refs(struct amvdec_session *sess, struct hevc_frame *frame) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ union rpm_param *params = &hevc->rpm_param; -+ int i; -+ int num_neg = 0; -+ int num_pos = 0; -+ int total_num; -+ int num_ref_idx_l0_active = -+ (params->p.num_ref_idx_l0_active > MAX_REF_ACTIVE) ? -+ MAX_REF_ACTIVE : params->p.num_ref_idx_l0_active; -+ int num_ref_idx_l1_active = -+ (params->p.num_ref_idx_l1_active > MAX_REF_ACTIVE) ? -+ MAX_REF_ACTIVE : params->p.num_ref_idx_l1_active; -+ int ref_picset0[MAX_REF_ACTIVE] = { 0 }; -+ int ref_picset1[MAX_REF_ACTIVE] = { 0 }; -+ -+ for (i = 0; i < MAX_REF_ACTIVE; i++) { -+ frame->ref_poc_list[0][frame->cur_slice_idx][i] = 0; -+ frame->ref_poc_list[1][frame->cur_slice_idx][i] = 0; -+ } -+ -+ for (i = 0; i < MAX_REF_ACTIVE; i++) { -+ u16 cur_rps = params->p.CUR_RPS[i]; -+ int delt = cur_rps & ((1 << (RPS_USED_BIT - 1)) - 1); -+ -+ if (cur_rps & 0x8000) -+ break; -+ -+ if (!((cur_rps >> RPS_USED_BIT) & 1)) -+ continue; -+ -+ if ((cur_rps >> (RPS_USED_BIT - 1)) & 1) { -+ ref_picset0[num_neg] = -+ frame->poc - ((1 << (RPS_USED_BIT - 1)) - delt); -+ num_neg++; -+ } else { -+ ref_picset1[num_pos] = frame->poc + delt; -+ num_pos++; -+ } -+ } -+ -+ total_num = num_neg + num_pos; -+ -+ if (total_num <= 0) -+ goto end; -+ -+ for (i = 0; i < num_ref_idx_l0_active; i++) { -+ int cidx; -+ if (params->p.modification_flag & 0x1) -+ cidx = params->p.modification_list[i]; -+ else -+ cidx = i % total_num; -+ -+ frame->ref_poc_list[0][frame->cur_slice_idx][i] = -+ cidx >= num_neg ? ref_picset1[cidx - num_neg] : -+ ref_picset0[cidx]; -+ } -+ -+ if (params->p.slice_type != B_SLICE) -+ goto end; -+ -+ if (params->p.modification_flag & 0x2) { -+ for (i = 0; i < num_ref_idx_l1_active; i++) { -+ int cidx; -+ if (params->p.modification_flag & 0x1) -+ cidx = -+ params->p.modification_list[num_ref_idx_l0_active + i]; -+ else -+ cidx = params->p.modification_list[i]; -+ -+ frame->ref_poc_list[1][frame->cur_slice_idx][i] = -+ (cidx >= num_pos) ? ref_picset0[cidx - num_pos] -+ : ref_picset1[cidx]; -+ } -+ } else { -+ for (i = 0; i < num_ref_idx_l1_active; i++) { -+ int cidx = i % total_num; -+ frame->ref_poc_list[1][frame->cur_slice_idx][i] = -+ cidx >= num_pos ? ref_picset0[cidx - num_pos] : -+ ref_picset1[cidx]; -+ } -+ } -+ -+end: -+ frame->ref_num[0] = num_ref_idx_l0_active; -+ frame->ref_num[1] = num_ref_idx_l1_active; -+ -+ dev_dbg(sess->core->dev, -+ "Frame %u; slice %u; slice_type %u; num_l0 %u; num_l1 %u\n", -+ frame->poc, frame->cur_slice_idx, params->p.slice_type, -+ frame->ref_num[0], frame->ref_num[1]); -+} -+ -+static void codec_hevc_update_ldc_flag(struct codec_hevc *hevc) -+{ -+ struct hevc_frame *frame = hevc->cur_frame; -+ u32 slice_type = frame->cur_slice_type; -+ u32 slice_idx = frame->cur_slice_idx; -+ int i; -+ -+ hevc->ldc_flag = 0; -+ -+ if (slice_type == I_SLICE) -+ return; -+ -+ hevc->ldc_flag = 1; -+ for (i = 0; (i < frame->ref_num[0]) && hevc->ldc_flag; i++) { -+ if (frame->ref_poc_list[0][slice_idx][i] > frame->poc) { -+ hevc->ldc_flag = 0; -+ break; -+ } -+ } -+ -+ if (slice_type == P_SLICE) -+ return; -+ -+ for (i = 0; (i < frame->ref_num[1]) && hevc->ldc_flag; i++) { -+ if (frame->ref_poc_list[1][slice_idx][i] > frame->poc) { -+ hevc->ldc_flag = 0; -+ break; -+ } -+ } -+} -+ -+/* Tag "old" frames that are no longer referenced */ -+static void codec_hevc_update_referenced(struct codec_hevc *hevc) -+{ -+ union rpm_param *param = &hevc->rpm_param; -+ struct hevc_frame *frame; -+ int i; -+ u32 curr_poc = hevc->curr_poc; -+ -+ list_for_each_entry(frame, &hevc->ref_frames_list, list) { -+ int is_referenced = 0; -+ u32 poc_tmp; -+ -+ if (!frame->referenced) -+ continue; -+ -+ for (i = 0; i < MAX_REF_ACTIVE; i++) { -+ int delt; -+ if (param->p.CUR_RPS[i] & 0x8000) -+ break; -+ -+ delt = param->p.CUR_RPS[i] & ((1 << (RPS_USED_BIT - 1)) - 1); -+ if (param->p.CUR_RPS[i] & (1 << (RPS_USED_BIT - 1))) { -+ poc_tmp = curr_poc - ((1 << (RPS_USED_BIT - 1)) - delt); -+ } else -+ poc_tmp = curr_poc + delt; -+ if (poc_tmp == frame->poc) { -+ is_referenced = 1; -+ break; -+ } -+ } -+ -+ frame->referenced = is_referenced; -+ } -+} -+ -+static struct hevc_frame * -+codec_hevc_get_lowest_poc_frame(struct codec_hevc *hevc) -+{ -+ struct hevc_frame *tmp, *ret = NULL; -+ u32 poc = INT_MAX; -+ -+ list_for_each_entry(tmp, &hevc->ref_frames_list, list) { -+ if (tmp->poc < poc) { -+ ret = tmp; -+ poc = tmp->poc; -+ } -+ } -+ -+ return ret; -+} -+ -+/* Try to output as many frames as possible */ -+static void codec_hevc_output_frames(struct amvdec_session *sess) -+{ -+ struct hevc_frame *tmp; -+ struct codec_hevc *hevc = sess->priv; -+ -+ while ((tmp = codec_hevc_get_lowest_poc_frame(hevc))) { -+ if (hevc->curr_poc && -+ (tmp->referenced || -+ tmp->num_reorder_pic >= hevc->frames_num)) -+ break; -+ -+ dev_dbg(sess->core->dev, "DONE frame poc %u; vbuf %u\n", -+ tmp->poc, tmp->vbuf->vb2_buf.index); -+ amvdec_dst_buf_done_offset(sess, tmp->vbuf, tmp->offset, -+ V4L2_FIELD_NONE, false); -+ list_del(&tmp->list); -+ kfree(tmp); -+ hevc->frames_num--; -+ } -+} -+ -+ -+static int -+codec_hevc_setup_workspace(struct amvdec_core *core, struct codec_hevc *hevc) -+{ -+ dma_addr_t wkaddr; -+ -+ /* Allocate some memory for the HEVC decoder's state */ -+ hevc->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, -+ &wkaddr, GFP_KERNEL); -+ if (!hevc->workspace_vaddr) { -+ dev_err(core->dev, "Failed to allocate HEVC Workspace\n"); -+ return -ENOMEM; -+ } -+ -+ hevc->workspace_paddr = wkaddr; -+ -+ amvdec_write_dos(core, HEVCD_IPP_LINEBUFF_BASE, wkaddr + IPP_OFFSET); -+ amvdec_write_dos(core, HEVC_RPM_BUFFER, wkaddr + RPM_OFFSET); -+ amvdec_write_dos(core, HEVC_SHORT_TERM_RPS, wkaddr + SH_TM_RPS_OFFSET); -+ amvdec_write_dos(core, HEVC_VPS_BUFFER, wkaddr + VPS_OFFSET); -+ amvdec_write_dos(core, HEVC_SPS_BUFFER, wkaddr + SPS_OFFSET); -+ amvdec_write_dos(core, HEVC_PPS_BUFFER, wkaddr + PPS_OFFSET); -+ amvdec_write_dos(core, HEVC_SAO_UP, wkaddr + SAO_UP_OFFSET); -+ -+ /* No MMU */ -+ amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER, -+ wkaddr + SWAP_BUF_OFFSET); -+ amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER2, -+ wkaddr + SWAP_BUF2_OFFSET); -+ amvdec_write_dos(core, HEVC_SCALELUT, wkaddr + SCALELUT_OFFSET); -+ amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); -+ amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); -+ -+ return 0; -+} -+ -+static int codec_hevc_start(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_hevc *hevc; -+ u32 val; -+ int i; -+ int ret; -+ -+ hevc = kzalloc(sizeof(*hevc), GFP_KERNEL); -+ if (!hevc) -+ return -ENOMEM; -+ -+ INIT_LIST_HEAD(&hevc->ref_frames_list); -+ hevc->curr_poc = INVALID_POC; -+ -+ ret = codec_hevc_setup_workspace(core, hevc); -+ if (ret) -+ goto free_hevc; -+ -+ amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); -+ -+ val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x03ffffff; -+ val |= (3 << 29) | BIT(27) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | -+ BIT(0); -+ amvdec_write_dos(core, HEVC_PARSER_INT_CONTROL, val); -+ amvdec_write_dos_bits(core, HEVC_SHIFT_STATUS, BIT(1) | BIT(0)); -+ amvdec_write_dos(core, HEVC_SHIFT_CONTROL, -+ (3 << 6) | BIT(5) | BIT(2) | BIT(0)); -+ amvdec_write_dos(core, HEVC_CABAC_CONTROL, 1); -+ amvdec_write_dos(core, HEVC_PARSER_CORE_CONTROL, 1); -+ amvdec_write_dos(core, HEVC_DEC_STATUS_REG, 0); -+ -+ amvdec_write_dos(core, HEVC_IQIT_SCALELUT_WR_ADDR, 0); -+ for (i = 0; i < 1024; ++i) -+ amvdec_write_dos(core, HEVC_IQIT_SCALELUT_DATA, 0); -+ -+ amvdec_write_dos(core, HEVC_DECODE_SIZE, 0); -+ -+ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, BIT(16)); -+ for (i = 0; i < ARRAY_SIZE(vdec_hevc_parser_cmd); ++i) -+ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, -+ vdec_hevc_parser_cmd[i]); -+ -+ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_0, PARSER_CMD_SKIP_CFG_0); -+ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_1, PARSER_CMD_SKIP_CFG_1); -+ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_2, PARSER_CMD_SKIP_CFG_2); -+ amvdec_write_dos(core, HEVC_PARSER_IF_CONTROL, -+ BIT(5) | BIT(2) | BIT(0)); -+ -+ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(0)); -+ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(1)); -+ -+ amvdec_write_dos(core, HEVC_WAIT_FLAG, 1); -+ -+ /* clear mailbox interrupt */ -+ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_CLR_REG, 1); -+ /* enable mailbox interrupt */ -+ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_MASK, 1); -+ /* disable PSCALE for hardware sharing */ -+ amvdec_write_dos(core, HEVC_PSCALE_CTRL, 0); -+ /* Let the uCode do all the parsing */ -+ amvdec_write_dos(core, NAL_SEARCH_CTL, 0xc); -+ -+ amvdec_write_dos(core, DECODE_STOP_POS, 0); -+ amvdec_write_dos(core, HEVC_DECODE_MODE, DECODE_MODE_SINGLE); -+ amvdec_write_dos(core, HEVC_DECODE_MODE2, 0); -+ -+ /* AUX buffers */ -+ hevc->aux_vaddr = dma_alloc_coherent(core->dev, SIZE_AUX, -+ &hevc->aux_paddr, GFP_KERNEL); -+ if (!hevc->aux_vaddr) { -+ dev_err(core->dev, "Failed to request HEVC AUX\n"); -+ ret = -ENOMEM; -+ goto free_hevc; -+ } -+ -+ amvdec_write_dos(core, HEVC_AUX_ADR, hevc->aux_paddr); -+ amvdec_write_dos(core, HEVC_AUX_DATA_SIZE, -+ (((SIZE_AUX) >> 4) << 16) | 0); -+ mutex_init(&hevc->lock); -+ sess->priv = hevc; -+ -+ return 0; -+ -+free_hevc: -+ kfree(hevc); -+ return ret; -+} -+ -+static void codec_hevc_flush_output(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ struct hevc_frame *tmp; -+ -+ while (!list_empty(&hevc->ref_frames_list)) { -+ tmp = codec_hevc_get_lowest_poc_frame(hevc); -+ amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE); -+ list_del(&tmp->list); -+ kfree(tmp); -+ hevc->frames_num--; -+ } -+} -+ -+static int codec_hevc_stop(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ struct amvdec_core *core = sess->core; -+ -+ mutex_lock(&hevc->lock); -+ codec_hevc_flush_output(sess); -+ -+ if (hevc->workspace_vaddr) -+ dma_free_coherent(core->dev, SIZE_WORKSPACE, -+ hevc->workspace_vaddr, -+ hevc->workspace_paddr); -+ -+ if (hevc->aux_vaddr) -+ dma_free_coherent(core->dev, SIZE_AUX, -+ hevc->aux_vaddr, hevc->aux_paddr); -+ -+ codec_hevc_free_fbc_buffers(sess); -+ mutex_unlock(&hevc->lock); -+ mutex_destroy(&hevc->lock); -+ -+ return 0; -+} -+ -+static struct hevc_frame * -+codec_hevc_get_frame_by_poc(struct codec_hevc *hevc, u32 poc) -+{ -+ struct hevc_frame *tmp; -+ -+ list_for_each_entry(tmp, &hevc->ref_frames_list, list) { -+ if (tmp->poc == poc) -+ return tmp; -+ } -+ -+ return NULL; -+} -+ -+static struct hevc_frame * -+codec_hevc_prepare_new_frame(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct hevc_frame *new_frame = NULL; -+ struct codec_hevc *hevc = sess->priv; -+ struct vb2_v4l2_buffer *vbuf; -+ union rpm_param *params = &hevc->rpm_param; -+ -+ new_frame = kzalloc(sizeof(*new_frame), GFP_KERNEL); -+ if (!new_frame) -+ return NULL; -+ -+ vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); -+ if (!vbuf) { -+ dev_err(sess->core->dev, "No dst buffer available\n"); -+ return NULL; -+ } -+ -+ new_frame->vbuf = vbuf; -+ new_frame->referenced = 1; -+ new_frame->poc = hevc->curr_poc; -+ new_frame->cur_slice_type = params->p.slice_type; -+ new_frame->num_reorder_pic = params->p.sps_num_reorder_pics_0; -+ new_frame->offset = amvdec_read_dos(core, HEVC_SHIFT_BYTE_COUNT); -+ -+ list_add_tail(&new_frame->list, &hevc->ref_frames_list); -+ hevc->frames_num++; -+ -+ return new_frame; -+} -+ -+static void -+codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_hevc *hevc = sess->priv; -+ union rpm_param *param = &hevc->rpm_param; -+ u32 pic_height_cu = -+ (hevc->height + hevc->lcu_size - 1) / hevc->lcu_size; -+ u32 sao_mem_unit = (hevc->lcu_size == 16 ? 9 : -+ hevc->lcu_size == 32 ? 14 : 24) << 4; -+ u32 sao_vb_size = (sao_mem_unit + (2 << 4)) * pic_height_cu; -+ u32 misc_flag0 = param->p.misc_flag0; -+ dma_addr_t buf_y_paddr; -+ dma_addr_t buf_u_v_paddr; -+ u32 slice_deblocking_filter_disabled_flag; -+ u32 val, val_2; -+ -+ val = (amvdec_read_dos(core, HEVC_SAO_CTRL0) & ~0xf) | -+ ilog2(hevc->lcu_size); -+ amvdec_write_dos(core, HEVC_SAO_CTRL0, val); -+ -+ amvdec_write_dos(core, HEVC_SAO_PIC_SIZE, -+ hevc->width | (hevc->height << 16)); -+ amvdec_write_dos(core, HEVC_SAO_PIC_SIZE_LCU, -+ (hevc->lcu_x_num - 1) | (hevc->lcu_y_num - 1) << 16); -+ -+ if (codec_hevc_use_downsample(sess->pixfmt_cap, hevc->is_10bit)) -+ buf_y_paddr = -+ sess->fbc_buffer_paddr[frame->vbuf->vb2_buf.index]; -+ else -+ buf_y_paddr = -+ vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 0); -+ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { -+ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200; -+ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); -+ amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); -+ } -+ -+ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { -+ buf_y_paddr = -+ vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 0); -+ buf_u_v_paddr = -+ vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 1); -+ amvdec_write_dos(core, HEVC_SAO_Y_START_ADDR, buf_y_paddr); -+ amvdec_write_dos(core, HEVC_SAO_C_START_ADDR, buf_u_v_paddr); -+ amvdec_write_dos(core, HEVC_SAO_Y_WPTR, buf_y_paddr); -+ amvdec_write_dos(core, HEVC_SAO_C_WPTR, buf_u_v_paddr); -+ } -+ -+ amvdec_write_dos(core, HEVC_SAO_Y_LENGTH, -+ amvdec_get_output_size(sess)); -+ amvdec_write_dos(core, HEVC_SAO_C_LENGTH, -+ (amvdec_get_output_size(sess) / 2)); -+ -+ if (frame->cur_slice_idx == 0) { -+ amvdec_write_dos(core, HEVC_DBLK_CFG2, -+ hevc->width | (hevc->height << 16)); -+ -+ val = 0; -+ if ((misc_flag0 >> PCM_ENABLE_FLAG_BIT) & 0x1) -+ val |= ((misc_flag0 >> PCM_LOOP_FILTER_DISABLED_FLAG_BIT) & 0x1) << 3; -+ -+ val |= (param->p.pps_cb_qp_offset & 0x1f) << 4; -+ val |= (param->p.pps_cr_qp_offset & 0x1f) << 9; -+ val |= (hevc->lcu_size == 64) ? 0 : ((hevc->lcu_size == 32) ? 1 : 2); -+ amvdec_write_dos(core, HEVC_DBLK_CFG1, val); -+ } -+ -+ val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff3; -+ val |= 0xff0; /* Set endianness for 2-bytes swaps (nv12) */ -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) -+ val |= BIT(0); /* disable cm compression */ -+ else if (sess->pixfmt_cap == V4L2_PIX_FMT_AM21C) -+ val |= BIT(1); /* Disable double write */ -+ -+ amvdec_write_dos(core, HEVC_SAO_CTRL1, val); -+ -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { -+ /* no downscale for NV12 */ -+ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0000; -+ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); -+ } -+ -+ val = amvdec_read_dos(core, HEVCD_IPP_AXIIF_CONFIG) & ~0x30; -+ val |= 0xf; -+ amvdec_write_dos(core, HEVCD_IPP_AXIIF_CONFIG, val); -+ -+ val = 0; -+ val_2 = amvdec_read_dos(core, HEVC_SAO_CTRL0); -+ val_2 &= (~0x300); -+ -+ slice_deblocking_filter_disabled_flag = (misc_flag0 >> -+ SLICE_DEBLOCKING_FILTER_DISABLED_FLAG_BIT) & 0x1; -+ if ((misc_flag0 & (1 << DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG_BIT)) -+ && (misc_flag0 & (1 << DEBLOCKING_FILTER_OVERRIDE_FLAG_BIT))) { -+ val |= slice_deblocking_filter_disabled_flag << 2; -+ -+ if (!slice_deblocking_filter_disabled_flag) { -+ val |= (param->p.slice_beta_offset_div2 & 0xf) << 3; -+ val |= (param->p.slice_tc_offset_div2 & 0xf) << 7; -+ } -+ } else { -+ val |= -+ ((misc_flag0 >> -+ PPS_DEBLOCKING_FILTER_DISABLED_FLAG_BIT) & 0x1) << 2; -+ -+ if (((misc_flag0 >> PPS_DEBLOCKING_FILTER_DISABLED_FLAG_BIT) & -+ 0x1) == 0) { -+ val |= (param->p.pps_beta_offset_div2 & 0xf) << 3; -+ val |= (param->p.pps_tc_offset_div2 & 0xf) << 7; -+ } -+ } -+ if ((misc_flag0 & (1 << PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT)) -+ && ((misc_flag0 & (1 << SLICE_SAO_LUMA_FLAG_BIT)) -+ || (misc_flag0 & (1 << SLICE_SAO_CHROMA_FLAG_BIT)) -+ || (!slice_deblocking_filter_disabled_flag))) { -+ val |= -+ ((misc_flag0 >> -+ SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) -+ & 0x1) << 1; -+ val_2 |= -+ ((misc_flag0 >> -+ SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) -+ & 0x1) << 9; -+ } else { -+ val |= -+ ((misc_flag0 >> -+ PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) -+ & 0x1) << 1; -+ val_2 |= -+ ((misc_flag0 >> -+ PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) -+ & 0x1) << 9; -+ } -+ -+ amvdec_write_dos(core, HEVC_DBLK_CFG9, val); -+ amvdec_write_dos(core, HEVC_SAO_CTRL0, val_2); -+ -+ amvdec_write_dos(core, HEVC_sao_mem_unit, sao_mem_unit); -+ amvdec_write_dos(core, HEVC_SAO_ABV, -+ hevc->workspace_paddr + SAO_ABV_OFFSET); -+ amvdec_write_dos(core, HEVC_sao_vb_size, sao_vb_size); -+ amvdec_write_dos(core, HEVC_SAO_VB, -+ hevc->workspace_paddr + SAO_VB_OFFSET); -+} -+ -+static dma_addr_t codec_hevc_get_frame_mv_paddr(struct codec_hevc *hevc, -+ struct hevc_frame *frame) -+{ -+ return hevc->workspace_paddr + MPRED_MV_OFFSET + -+ (frame->vbuf->vb2_buf.index * MPRED_MV_BUF_SIZE); -+} -+ -+static void -+codec_hevc_set_mpred_ctrl(struct amvdec_core *core, struct codec_hevc *hevc) -+{ -+ union rpm_param *param = &hevc->rpm_param; -+ u32 slice_type = param->p.slice_type; -+ u32 lcu_size_log2 = ilog2(hevc->lcu_size); -+ u32 val; -+ -+ val = slice_type | -+ MPRED_CTRL0_ABOVE_EN | -+ MPRED_CTRL0_MV_WR_EN | -+ MPRED_CTRL0_BUF_LINEAR | -+ (lcu_size_log2 << 16) | -+ (3 << 20) | /* cu_size_log2 */ -+ (param->p.log2_parallel_merge_level << 24); -+ -+ if (slice_type != I_SLICE) -+ val |= MPRED_CTRL0_MV_RD_EN; -+ -+ if (param->p.collocated_from_l0_flag) -+ val |= MPRED_CTRL0_COL_FROM_L0; -+ -+ if (param->p.slice_temporal_mvp_enable_flag) -+ val |= MPRED_CTRL0_TMVP; -+ -+ if (hevc->ldc_flag) -+ val |= MPRED_CTRL0_LDC; -+ -+ if (param->p.dependent_slice_segment_flag) -+ val |= MPRED_CTRL0_NEW_SLI_SEG; -+ -+ if (param->p.slice_segment_address == 0) -+ val |= MPRED_CTRL0_NEW_PIC | -+ MPRED_CTRL0_NEW_TILE; -+ -+ amvdec_write_dos(core, HEVC_MPRED_CTRL0, val); -+ -+ val = (5 - param->p.five_minus_max_num_merge_cand) | -+ (AMVP_MAX_NUM_CANDS << 4) | -+ (AMVP_MAX_NUM_CANDS_MEM << 8) | -+ (NUM_CHROMA_MODE << 12) | -+ (DM_CHROMA_IDX << 16); -+ amvdec_write_dos(core, HEVC_MPRED_CTRL1, val); -+} -+ -+static void codec_hevc_set_mpred_mv(struct amvdec_core *core, -+ struct codec_hevc *hevc, -+ struct hevc_frame *frame, -+ struct hevc_frame *col_frame) -+{ -+ union rpm_param *param = &hevc->rpm_param; -+ u32 lcu_size_log2 = ilog2(hevc->lcu_size); -+ u32 mv_mem_unit = lcu_size_log2 == 6 ? 0x200 : -+ lcu_size_log2 == 5 ? 0x80 : 0x20; -+ dma_addr_t col_mv_rd_start_addr, col_mv_rd_ptr, col_mv_rd_end_addr; -+ dma_addr_t mpred_mv_wr_ptr; -+ u32 val; -+ -+ val = amvdec_read_dos(core, HEVC_MPRED_CURR_LCU); -+ -+ col_mv_rd_start_addr = codec_hevc_get_frame_mv_paddr(hevc, col_frame); -+ mpred_mv_wr_ptr = codec_hevc_get_frame_mv_paddr(hevc, frame) + -+ (hevc->slice_addr * mv_mem_unit); -+ col_mv_rd_ptr = col_mv_rd_start_addr + -+ (hevc->slice_addr * mv_mem_unit); -+ col_mv_rd_end_addr = col_mv_rd_start_addr + -+ (hevc->lcu_total * mv_mem_unit); -+ -+ amvdec_write_dos(core, HEVC_MPRED_MV_WR_START_ADDR, -+ codec_hevc_get_frame_mv_paddr(hevc, frame)); -+ amvdec_write_dos(core, HEVC_MPRED_MV_RD_START_ADDR, -+ col_mv_rd_start_addr); -+ -+ if (param->p.slice_segment_address == 0) { -+ amvdec_write_dos(core, HEVC_MPRED_ABV_START_ADDR, -+ hevc->workspace_paddr + MPRED_ABV_OFFSET); -+ amvdec_write_dos(core, HEVC_MPRED_MV_WPTR, mpred_mv_wr_ptr); -+ amvdec_write_dos(core, HEVC_MPRED_MV_RPTR, -+ col_mv_rd_start_addr); -+ } else { -+ amvdec_write_dos(core, HEVC_MPRED_MV_RPTR, col_mv_rd_ptr); -+ } -+ -+ amvdec_write_dos(core, HEVC_MPRED_MV_RD_END_ADDR, col_mv_rd_end_addr); -+} -+ -+/* Update motion prediction with the current slice */ -+static void codec_hevc_set_mpred(struct amvdec_session *sess, -+ struct hevc_frame *frame, -+ struct hevc_frame *col_frame) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_hevc *hevc = sess->priv; -+ u32 *ref_num = frame->ref_num; -+ u32 *ref_poc_l0 = frame->ref_poc_list[0][frame->cur_slice_idx]; -+ u32 *ref_poc_l1 = frame->ref_poc_list[1][frame->cur_slice_idx]; -+ u32 val; -+ int i; -+ -+ codec_hevc_set_mpred_ctrl(core, hevc); -+ codec_hevc_set_mpred_mv(core, hevc, frame, col_frame); -+ -+ amvdec_write_dos(core, HEVC_MPRED_PIC_SIZE, -+ hevc->width | (hevc->height << 16)); -+ -+ val = ((hevc->lcu_x_num - 1) | (hevc->lcu_y_num - 1) << 16); -+ amvdec_write_dos(core, HEVC_MPRED_PIC_SIZE_LCU, val); -+ -+ amvdec_write_dos(core, HEVC_MPRED_REF_NUM, -+ (ref_num[1] << 8) | ref_num[0]); -+ amvdec_write_dos(core, HEVC_MPRED_REF_EN_L0, (1 << ref_num[0]) - 1); -+ amvdec_write_dos(core, HEVC_MPRED_REF_EN_L1, (1 << ref_num[1]) - 1); -+ -+ amvdec_write_dos(core, HEVC_MPRED_CUR_POC, hevc->curr_poc); -+ amvdec_write_dos(core, HEVC_MPRED_COL_POC, hevc->col_poc); -+ -+ for (i = 0; i < MAX_REF_ACTIVE; ++i) { -+ amvdec_write_dos(core, HEVC_MPRED_L0_REF00_POC + i * 4, -+ ref_poc_l0[i]); -+ amvdec_write_dos(core, HEVC_MPRED_L1_REF00_POC + i * 4, -+ ref_poc_l1[i]); -+ } -+} -+ -+/* motion compensation reference cache controller */ -+static void codec_hevc_set_mcrcc(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_hevc *hevc = sess->priv; -+ u32 val, val_2; -+ int l0_cnt = 0; -+ int l1_cnt = 0x7fff; -+ -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { -+ l0_cnt = hevc->cur_frame->ref_num[0]; -+ l1_cnt = hevc->cur_frame->ref_num[1]; -+ } -+ -+ if (hevc->cur_frame->cur_slice_type == I_SLICE) { -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0); -+ return; -+ } -+ -+ if (hevc->cur_frame->cur_slice_type == P_SLICE) { -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, -+ BIT(1)); -+ val = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR); -+ val &= 0xffff; -+ val |= (val << 16); -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL2, val); -+ -+ if (l0_cnt == 1) { -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); -+ } else { -+ val = amvdec_read_dos(core, -+ HEVCD_MPP_ANC_CANVAS_DATA_ADDR); -+ val &= 0xffff; -+ val |= (val << 16); -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); -+ } -+ } else { /* B_SLICE */ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 0); -+ val = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR); -+ val &= 0xffff; -+ val |= (val << 16); -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL2, val); -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, -+ BIT(12) | BIT(1)); -+ val_2 = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR); -+ val_2 &= 0xffff; -+ val_2 |= (val_2 << 16); -+ if (val == val_2 && l1_cnt > 1) { -+ val_2 = amvdec_read_dos(core, -+ HEVCD_MPP_ANC_CANVAS_DATA_ADDR); -+ val_2 &= 0xffff; -+ val_2 |= (val_2 << 16); -+ } -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); -+ } -+ -+ /* enable mcrcc progressive-mode */ -+ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0xff0); -+} -+ -+static void codec_hevc_set_ref_list(struct amvdec_session *sess, -+ u32 ref_num, u32 *ref_poc_list) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ struct hevc_frame *ref_frame; -+ struct amvdec_core *core = sess->core; -+ int i; -+ u32 buf_id_y; -+ u32 buf_id_uv; -+ -+ for (i = 0; i < ref_num; i++) { -+ ref_frame = codec_hevc_get_frame_by_poc(hevc, ref_poc_list[i]); -+ -+ if (!ref_frame) { -+ dev_warn(core->dev, "Couldn't find ref. frame %u\n", -+ ref_poc_list[i]); -+ continue; -+ } -+ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { -+ buf_id_y = buf_id_uv = ref_frame->vbuf->vb2_buf.index; -+ } else { -+ buf_id_y = ref_frame->vbuf->vb2_buf.index * 2; -+ buf_id_uv = buf_id_y + 1; -+ } -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, -+ (buf_id_uv << 16) | -+ (buf_id_uv << 8) | -+ buf_id_y); -+ } -+} -+ -+static void codec_hevc_set_mc(struct amvdec_session *sess, struct hevc_frame *frame) -+{ -+ struct amvdec_core *core = sess->core; -+ -+ if (frame->cur_slice_type == I_SLICE) -+ return; -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); -+ codec_hevc_set_ref_list(sess, frame->ref_num[0], -+ frame->ref_poc_list[0][frame->cur_slice_idx]); -+ -+ if (frame->cur_slice_type == P_SLICE) -+ return; -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, -+ BIT(12) | BIT(0)); -+ codec_hevc_set_ref_list(sess, frame->ref_num[1], -+ frame->ref_poc_list[1][frame->cur_slice_idx]); -+} -+ -+static void codec_hevc_update_col_frame(struct codec_hevc *hevc) -+{ -+ struct hevc_frame *cur_frame = hevc->cur_frame; -+ union rpm_param *param = &hevc->rpm_param; -+ u32 list_no = 0; -+ u32 col_ref = param->p.collocated_ref_idx; -+ u32 col_from_l0 = param->p.collocated_from_l0_flag; -+ -+ if (cur_frame->cur_slice_type == B_SLICE) -+ list_no = 1 - col_from_l0; -+ -+ if (col_ref >= cur_frame->ref_num[list_no]) -+ hevc->col_poc = INVALID_POC; -+ else -+ hevc->col_poc = cur_frame->ref_poc_list[list_no][cur_frame->cur_slice_idx][col_ref]; -+ -+ if (cur_frame->cur_slice_type == I_SLICE) -+ goto end; -+ -+ if (hevc->col_poc != INVALID_POC) -+ hevc->col_frame = codec_hevc_get_frame_by_poc(hevc, hevc->col_poc); -+ else -+ hevc->col_frame = hevc->cur_frame; -+ -+end: -+ if (!hevc->col_frame) -+ hevc->col_frame = hevc->cur_frame; -+} -+ -+static void codec_hevc_update_pocs(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ union rpm_param *param = &hevc->rpm_param; -+ u32 nal_unit_type = param->p.m_nalUnitType; -+ u32 temporal_id = param->p.m_temporalId & 0x7; -+ int max_poc_lsb = -+ 1 << (param->p.log2_max_pic_order_cnt_lsb_minus4 + 4); -+ int prev_poc_lsb; -+ int prev_poc_msb; -+ int poc_msb; -+ int poc_lsb = param->p.POClsb; -+ -+ if (nal_unit_type == NAL_UNIT_CODED_SLICE_IDR || -+ nal_unit_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) { -+ hevc->curr_poc = 0; -+ if ((temporal_id - 1) == 0) -+ hevc->prev_tid0_poc = hevc->curr_poc; -+ -+ return; -+ } -+ -+ prev_poc_lsb = hevc->prev_tid0_poc % max_poc_lsb; -+ prev_poc_msb = hevc->prev_tid0_poc - prev_poc_lsb; -+ -+ if ((poc_lsb < prev_poc_lsb) && -+ ((prev_poc_lsb - poc_lsb) >= (max_poc_lsb / 2))) -+ poc_msb = prev_poc_msb + max_poc_lsb; -+ else if ((poc_lsb > prev_poc_lsb) && -+ ((poc_lsb - prev_poc_lsb) > (max_poc_lsb / 2))) -+ poc_msb = prev_poc_msb - max_poc_lsb; -+ else -+ poc_msb = prev_poc_msb; -+ -+ if (nal_unit_type == NAL_UNIT_CODED_SLICE_BLA || -+ nal_unit_type == NAL_UNIT_CODED_SLICE_BLANT || -+ nal_unit_type == NAL_UNIT_CODED_SLICE_BLA_N_LP) -+ poc_msb = 0; -+ -+ hevc->curr_poc = (poc_msb + poc_lsb); -+ if ((temporal_id - 1) == 0) -+ hevc->prev_tid0_poc = hevc->curr_poc; -+} -+ -+static void codec_hevc_process_segment_header(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ union rpm_param *param = &hevc->rpm_param; -+ -+ if (param->p.first_slice_segment_in_pic_flag == 0) { -+ hevc->slice_segment_addr = param->p.slice_segment_address; -+ if (!param->p.dependent_slice_segment_flag) -+ hevc->slice_addr = hevc->slice_segment_addr; -+ } else { -+ hevc->slice_segment_addr = 0; -+ hevc->slice_addr = 0; -+ } -+ -+ codec_hevc_update_pocs(sess); -+} -+ -+static int codec_hevc_process_segment(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ struct amvdec_core *core = sess->core; -+ union rpm_param *param = &hevc->rpm_param; -+ u32 slice_segment_address = param->p.slice_segment_address; -+ -+ /* First slice: new frame */ -+ if (slice_segment_address == 0) { -+ codec_hevc_update_referenced(hevc); -+ codec_hevc_output_frames(sess); -+ -+ hevc->cur_frame = codec_hevc_prepare_new_frame(sess); -+ if (!hevc->cur_frame) -+ return -1; -+ } else { -+ hevc->cur_frame->cur_slice_idx++; -+ } -+ -+ codec_hevc_update_frame_refs(sess, hevc->cur_frame); -+ codec_hevc_update_col_frame(hevc); -+ codec_hevc_update_ldc_flag(hevc); -+ codec_hevc_set_mc(sess, hevc->cur_frame); -+ codec_hevc_set_mcrcc(sess); -+ codec_hevc_set_mpred(sess, hevc->cur_frame, hevc->col_frame); -+ codec_hevc_set_sao(sess, hevc->cur_frame); -+ -+ amvdec_write_dos_bits(core, HEVC_WAIT_FLAG, BIT(1)); -+ amvdec_write_dos(core, HEVC_DEC_STATUS_REG, -+ HEVC_CODED_SLICE_SEGMENT_DAT); -+ -+ /* Interrupt the firmware's processor */ -+ amvdec_write_dos(core, HEVC_MCPU_INTR_REQ, AMRISC_MAIN_REQ); -+ -+ return 0; -+} -+ -+static int codec_hevc_process_rpm(struct codec_hevc *hevc) -+{ -+ union rpm_param *param = &hevc->rpm_param; -+ int src_changed = 0; -+ u32 dst_width, dst_height; -+ u32 lcu_size; -+ u32 is_10bit; -+ -+ if (param->p.slice_segment_address || -+ !param->p.pic_width_in_luma_samples || -+ !param->p.pic_height_in_luma_samples) -+ return 0; -+ -+ if (param->p.bit_depth) -+ is_10bit = 1; -+ -+ hevc->width = param->p.pic_width_in_luma_samples; -+ hevc->height = param->p.pic_height_in_luma_samples; -+ dst_width = hevc->width; -+ dst_height = hevc->height; -+ -+ lcu_size = 1 << (param->p.log2_min_coding_block_size_minus3 + -+ 3 + param->p.log2_diff_max_min_coding_block_size); -+ -+ hevc->lcu_x_num = (hevc->width + lcu_size - 1) / lcu_size; -+ hevc->lcu_y_num = (hevc->height + lcu_size - 1) / lcu_size; -+ hevc->lcu_total = hevc->lcu_x_num * hevc->lcu_y_num; -+ -+ if (param->p.conformance_window_flag) { -+ u32 sub_width = 1, sub_height = 1; -+ -+ switch (param->p.chroma_format_idc) { -+ case 1: -+ sub_height = 2; -+ case 2: -+ sub_width = 2; -+ break; -+ } -+ -+ dst_width -= sub_width * -+ (param->p.conf_win_left_offset + -+ param->p.conf_win_right_offset); -+ dst_height -= sub_height * -+ (param->p.conf_win_top_offset + -+ param->p.conf_win_bottom_offset); -+ } -+ -+ if (dst_width != hevc->dst_width || -+ dst_height != hevc->dst_height || -+ lcu_size != hevc->lcu_size || -+ is_10bit != hevc->is_10bit) -+ src_changed = 1; -+ -+ hevc->dst_width = dst_width; -+ hevc->dst_height = dst_height; -+ hevc->lcu_size = lcu_size; -+ hevc->is_10bit = is_10bit; -+ -+ return src_changed; -+} -+ -+/* The RPM section within the workspace contains -+ * many information regarding the parsed bitstream -+ */ -+static void codec_hevc_fetch_rpm(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ u16 *rpm_vaddr = hevc->workspace_vaddr + RPM_OFFSET; -+ int i, j; -+ -+ for (i = 0; i < RPM_SIZE; i += 4) -+ for (j = 0; j < 4; j++) -+ hevc->rpm_param.l.data[i + j] = rpm_vaddr[i + 3 - j]; -+} -+ -+static void codec_hevc_resume(struct amvdec_session *sess) -+{ -+ struct codec_hevc *hevc = sess->priv; -+ -+ if (codec_hevc_setup_buffers(sess, hevc->is_10bit)) { -+ amvdec_abort(sess); -+ return; -+ } -+ -+ codec_hevc_setup_decode_head(sess, hevc->is_10bit); -+ codec_hevc_process_segment_header(sess); -+ if (codec_hevc_process_segment(sess)) -+ amvdec_abort(sess); -+} -+ -+static irqreturn_t codec_hevc_threaded_isr(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_hevc *hevc = sess->priv; -+ u32 dec_status = amvdec_read_dos(core, HEVC_DEC_STATUS_REG); -+ -+ if (!hevc) -+ return IRQ_HANDLED; -+ -+ mutex_lock(&hevc->lock); -+ if (dec_status != HEVC_SLICE_SEGMENT_DONE) { -+ dev_err(core->dev_dec, "Unrecognized dec_status: %08X\n", -+ dec_status); -+ amvdec_abort(sess); -+ goto unlock; -+ } -+ -+ sess->keyframe_found = 1; -+ codec_hevc_fetch_rpm(sess); -+ if (codec_hevc_process_rpm(hevc)) { -+ amvdec_src_change(sess, hevc->dst_width, hevc->dst_height, 16); -+ goto unlock; -+ } -+ -+ codec_hevc_process_segment_header(sess); -+ if (codec_hevc_process_segment(sess)) -+ amvdec_abort(sess); -+ -+unlock: -+ mutex_unlock(&hevc->lock); -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t codec_hevc_isr(struct amvdec_session *sess) -+{ -+ return IRQ_WAKE_THREAD; -+} -+ -+struct amvdec_codec_ops codec_hevc_ops = { -+ .start = codec_hevc_start, -+ .stop = codec_hevc_stop, -+ .isr = codec_hevc_isr, -+ .threaded_isr = codec_hevc_threaded_isr, -+ .num_pending_bufs = codec_hevc_num_pending_bufs, -+ .drain = codec_hevc_flush_output, -+ .resume = codec_hevc_resume, -+}; -diff --git a/drivers/staging/media/meson/vdec/codec_hevc.h b/drivers/staging/media/meson/vdec/codec_hevc.h -new file mode 100644 -index 000000000000..f2f9b2464df1 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_hevc.h -@@ -0,0 +1,13 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#ifndef __MESON_VDEC_CODEC_HEVC_H_ -+#define __MESON_VDEC_CODEC_HEVC_H_ -+ -+#include "vdec.h" -+ -+extern struct amvdec_codec_ops codec_hevc_ops; -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c -new file mode 100644 -index 000000000000..2b296beb5d88 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c -@@ -0,0 +1,188 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#include -+#include -+ -+#include "codec_hevc_common.h" -+#include "vdec_helpers.h" -+#include "hevc_regs.h" -+ -+/* Configure decode head read mode */ -+void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) -+{ -+ struct amvdec_core *core = sess->core; -+ u32 body_size = amvdec_am21c_body_size(sess->width, sess->height); -+ u32 head_size = amvdec_am21c_head_size(sess->width, sess->height); -+ -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { -+ /* Enable 2-plane reference read mode */ -+ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(31)); -+ return; -+ } -+ -+ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0); -+ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL2, body_size / 32); -+ amvdec_write_dos(core, HEVC_CM_BODY_LENGTH, body_size); -+ amvdec_write_dos(core, HEVC_CM_HEADER_OFFSET, body_size); -+ amvdec_write_dos(core, HEVC_CM_HEADER_LENGTH, head_size); -+} -+EXPORT_SYMBOL_GPL(codec_hevc_setup_decode_head); -+ -+static void -+codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, int is_10bit) -+{ -+ struct amvdec_core *core = sess->core; -+ struct v4l2_m2m_buffer *buf; -+ u32 buf_num = v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); -+ dma_addr_t buf_y_paddr = 0; -+ dma_addr_t buf_uv_paddr = 0; -+ u32 idx = 0; -+ u32 val; -+ int i; -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 0); -+ -+ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { -+ idx = buf->vb.vb2_buf.index; -+ -+ if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) -+ buf_y_paddr = sess->fbc_buffer_paddr[idx]; -+ else -+ buf_y_paddr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); -+ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { -+ val = buf_y_paddr | (idx << 8) | 1; -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ } else { -+ buf_uv_paddr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 1); -+ val = buf_y_paddr | ((idx * 2) << 8) | 1; -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ val = buf_uv_paddr | ((idx * 2 + 1) << 8) | 1; -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ } -+ } -+ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) -+ val = buf_y_paddr | (idx << 8) | 1; -+ else -+ val = buf_y_paddr | ((idx * 2) << 8) | 1; -+ -+ /* Fill the remaining unused slots with the last buffer's Y addr */ -+ for (i = buf_num; i < MAX_REF_PIC_NUM; ++i) -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 1); -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); -+ for (i = 0; i < 32; ++i) -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); -+} -+ -+static void -+codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, int is_10bit) -+{ -+ struct amvdec_core *core = sess->core; -+ struct v4l2_m2m_buffer *buf; -+ u32 buf_num = v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); -+ dma_addr_t buf_y_paddr = 0; -+ dma_addr_t buf_uv_paddr = 0; -+ int i; -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, -+ BIT(2) | BIT(1)); -+ -+ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { -+ u32 idx = buf->vb.vb2_buf.index; -+ -+ if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) -+ buf_y_paddr = sess->fbc_buffer_paddr[idx]; -+ else -+ buf_y_paddr = -+ vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, -+ buf_y_paddr >> 5); -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { -+ buf_uv_paddr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 1); -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, -+ buf_uv_paddr >> 5); -+ } -+ } -+ -+ /* Fill the remaining unused slots with the last buffer's Y addr */ -+ for (i = buf_num; i < MAX_REF_PIC_NUM; ++i) { -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, -+ buf_y_paddr >> 5); -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, -+ buf_uv_paddr >> 5); -+ } -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 1); -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); -+ for (i = 0; i < 32; ++i) -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); -+} -+ -+void codec_hevc_free_fbc_buffers(struct amvdec_session *sess) -+{ -+ struct device *dev = sess->core->dev; -+ u32 am21_size = amvdec_am21c_size(sess->width, sess->height); -+ int i; -+ -+ for (i = 0; i < MAX_REF_PIC_NUM; ++i) { -+ if (sess->fbc_buffer_vaddr[i]) { -+ dma_free_coherent(dev, am21_size, -+ sess->fbc_buffer_vaddr[i], -+ sess->fbc_buffer_paddr[i]); -+ sess->fbc_buffer_vaddr[i] = NULL; -+ } -+ } -+} -+EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers); -+ -+static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess) -+{ -+ struct device *dev = sess->core->dev; -+ struct v4l2_m2m_buffer *buf; -+ u32 am21_size = amvdec_am21c_size(sess->width, sess->height); -+ -+ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { -+ u32 idx = buf->vb.vb2_buf.index; -+ dma_addr_t paddr; -+ void *vaddr = dma_alloc_coherent(dev, am21_size, &paddr, -+ GFP_KERNEL); -+ if (!vaddr) { -+ dev_err(dev, "Couldn't allocate FBC buffer %u\n", idx); -+ codec_hevc_free_fbc_buffers(sess); -+ return -ENOMEM; -+ } -+ -+ sess->fbc_buffer_vaddr[idx] = vaddr; -+ sess->fbc_buffer_paddr[idx] = paddr; -+ } -+ -+ return 0; -+} -+ -+int codec_hevc_setup_buffers(struct amvdec_session *sess, int is_10bit) -+{ -+ struct amvdec_core *core = sess->core; -+ int ret; -+ -+ if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { -+ ret = codec_hevc_alloc_fbc_buffers(sess); -+ if (ret) -+ return ret; -+ } -+ -+ if (core->platform->revision == VDEC_REVISION_GXBB) -+ codec_hevc_setup_buffers_gxbb(sess, is_10bit); -+ else -+ codec_hevc_setup_buffers_gxl(sess, is_10bit); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers); -\ No newline at end of file -diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.h b/drivers/staging/media/meson/vdec/codec_hevc_common.h -new file mode 100644 -index 000000000000..7c8891529ac8 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.h -@@ -0,0 +1,49 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2018 BayLibre, SAS -+ * Author: Maxime Jourdan -+ */ -+ -+#ifndef __MESON_VDEC_HEVC_COMMON_H_ -+#define __MESON_VDEC_HEVC_COMMON_H_ -+ -+#include "vdec.h" -+ -+#define PARSER_CMD_SKIP_CFG_0 0x0000090b -+#define PARSER_CMD_SKIP_CFG_1 0x1b14140f -+#define PARSER_CMD_SKIP_CFG_2 0x001b1910 -+static const u16 vdec_hevc_parser_cmd[] = { -+ 0x0401, 0x8401, 0x0800, 0x0402, -+ 0x9002, 0x1423, 0x8CC3, 0x1423, -+ 0x8804, 0x9825, 0x0800, 0x04FE, -+ 0x8406, 0x8411, 0x1800, 0x8408, -+ 0x8409, 0x8C2A, 0x9C2B, 0x1C00, -+ 0x840F, 0x8407, 0x8000, 0x8408, -+ 0x2000, 0xA800, 0x8410, 0x04DE, -+ 0x840C, 0x840D, 0xAC00, 0xA000, -+ 0x08C0, 0x08E0, 0xA40E, 0xFC00, -+ 0x7C00 -+}; -+ -+/* Returns 1 if we must use framebuffer compression */ -+static inline int codec_hevc_use_fbc(u32 pixfmt, int is_10bit) -+{ -+ return pixfmt == V4L2_PIX_FMT_AM21C || is_10bit; -+} -+ -+/* Returns 1 if we are decoding 10-bit but outputting 8-bit NV12 */ -+static inline int codec_hevc_use_downsample(u32 pixfmt, int is_10bit) -+{ -+ return pixfmt == V4L2_PIX_FMT_NV12M && is_10bit; -+} -+ -+/** -+ * Configure decode head read mode -+ */ -+void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit); -+ -+void codec_hevc_free_fbc_buffers(struct amvdec_session *sess); -+ -+int codec_hevc_setup_buffers(struct amvdec_session *sess, int is_10bit); -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h -new file mode 100644 -index 000000000000..ba49f906be5a ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/hevc_regs.h -@@ -0,0 +1,205 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. -+ */ -+ -+#ifndef __MESON_VDEC_HEVC_REGS_H_ -+#define __MESON_VDEC_HEVC_REGS_H_ -+ -+#define HEVC_ASSIST_MBOX1_CLR_REG 0xc1d4 -+#define HEVC_ASSIST_MBOX1_MASK 0xc1d8 -+ -+#define HEVC_ASSIST_SCRATCH_0 0xc300 -+#define HEVC_ASSIST_SCRATCH_1 0xc304 -+#define HEVC_ASSIST_SCRATCH_2 0xc308 -+#define HEVC_ASSIST_SCRATCH_3 0xc30c -+#define HEVC_ASSIST_SCRATCH_4 0xc310 -+#define HEVC_ASSIST_SCRATCH_5 0xc314 -+#define HEVC_ASSIST_SCRATCH_6 0xc318 -+#define HEVC_ASSIST_SCRATCH_7 0xc31c -+#define HEVC_ASSIST_SCRATCH_8 0xc320 -+#define HEVC_ASSIST_SCRATCH_9 0xc324 -+#define HEVC_ASSIST_SCRATCH_A 0xc328 -+#define HEVC_ASSIST_SCRATCH_B 0xc32c -+#define HEVC_ASSIST_SCRATCH_C 0xc330 -+#define HEVC_ASSIST_SCRATCH_D 0xc334 -+#define HEVC_ASSIST_SCRATCH_E 0xc338 -+#define HEVC_ASSIST_SCRATCH_F 0xc33c -+#define HEVC_ASSIST_SCRATCH_G 0xc340 -+#define HEVC_ASSIST_SCRATCH_H 0xc344 -+#define HEVC_ASSIST_SCRATCH_I 0xc348 -+#define HEVC_ASSIST_SCRATCH_J 0xc34c -+#define HEVC_ASSIST_SCRATCH_K 0xc350 -+#define HEVC_ASSIST_SCRATCH_L 0xc354 -+#define HEVC_ASSIST_SCRATCH_M 0xc358 -+#define HEVC_ASSIST_SCRATCH_N 0xc35c -+ -+#define HEVC_PARSER_VERSION 0xc400 -+#define HEVC_STREAM_CONTROL 0xc404 -+#define HEVC_STREAM_START_ADDR 0xc408 -+#define HEVC_STREAM_END_ADDR 0xc40c -+#define HEVC_STREAM_WR_PTR 0xc410 -+#define HEVC_STREAM_RD_PTR 0xc414 -+#define HEVC_STREAM_LEVEL 0xc418 -+#define HEVC_STREAM_FIFO_CTL 0xc41c -+#define HEVC_SHIFT_CONTROL 0xc420 -+#define HEVC_SHIFT_STARTCODE 0xc424 -+#define HEVC_SHIFT_EMULATECODE 0xc428 -+#define HEVC_SHIFT_STATUS 0xc42c -+#define HEVC_SHIFTED_DATA 0xc430 -+#define HEVC_SHIFT_BYTE_COUNT 0xc434 -+#define HEVC_SHIFT_COMMAND 0xc438 -+#define HEVC_ELEMENT_RESULT 0xc43c -+#define HEVC_CABAC_CONTROL 0xc440 -+#define HEVC_PARSER_SLICE_INFO 0xc444 -+#define HEVC_PARSER_CMD_WRITE 0xc448 -+#define HEVC_PARSER_CORE_CONTROL 0xc44c -+#define HEVC_PARSER_CMD_FETCH 0xc450 -+#define HEVC_PARSER_CMD_STATUS 0xc454 -+#define HEVC_PARSER_LCU_INFO 0xc458 -+#define HEVC_PARSER_HEADER_INFO 0xc45c -+#define HEVC_PARSER_INT_CONTROL 0xc480 -+#define HEVC_PARSER_INT_STATUS 0xc484 -+#define HEVC_PARSER_IF_CONTROL 0xc488 -+#define HEVC_PARSER_PICTURE_SIZE 0xc48c -+#define HEVC_PARSER_LCU_START 0xc490 -+#define HEVC_PARSER_HEADER_INFO2 0xc494 -+#define HEVC_PARSER_QUANT_READ 0xc498 -+#define HEVC_PARSER_RESERVED_27 0xc49c -+#define HEVC_PARSER_CMD_SKIP_0 0xc4a0 -+#define HEVC_PARSER_CMD_SKIP_1 0xc4a4 -+#define HEVC_PARSER_CMD_SKIP_2 0xc4a8 -+#define HEVC_SAO_IF_STATUS 0xc4c0 -+#define HEVC_SAO_IF_DATA_Y 0xc4c4 -+#define HEVC_SAO_IF_DATA_U 0xc4c8 -+#define HEVC_SAO_IF_DATA_V 0xc4cc -+#define HEVC_STREAM_SWAP_ADDR 0xc4d0 -+#define HEVC_STREAM_SWAP_CTRL 0xc4d4 -+#define HEVC_IQIT_IF_WAIT_CNT 0xc4d8 -+#define HEVC_MPRED_IF_WAIT_CNT 0xc4dc -+#define HEVC_SAO_IF_WAIT_CNT 0xc4e0 -+ -+#define HEVC_MPRED_VERSION 0xc800 -+#define HEVC_MPRED_CTRL0 0xc804 -+ #define MPRED_CTRL0_NEW_PIC BIT(2) -+ #define MPRED_CTRL0_NEW_TILE BIT(3) -+ #define MPRED_CTRL0_NEW_SLI_SEG BIT(4) -+ #define MPRED_CTRL0_TMVP BIT(5) -+ #define MPRED_CTRL0_LDC BIT(6) -+ #define MPRED_CTRL0_COL_FROM_L0 BIT(7) -+ #define MPRED_CTRL0_ABOVE_EN BIT(9) -+ #define MPRED_CTRL0_MV_WR_EN BIT(10) -+ #define MPRED_CTRL0_MV_RD_EN BIT(11) -+ #define MPRED_CTRL0_BUF_LINEAR BIT(13) -+#define HEVC_MPRED_CTRL1 0xc808 -+#define HEVC_MPRED_INT_EN 0xc80c -+#define HEVC_MPRED_INT_STATUS 0xc810 -+#define HEVC_MPRED_PIC_SIZE 0xc814 -+#define HEVC_MPRED_PIC_SIZE_LCU 0xc818 -+#define HEVC_MPRED_TILE_START 0xc81c -+#define HEVC_MPRED_TILE_SIZE_LCU 0xc820 -+#define HEVC_MPRED_REF_NUM 0xc824 -+#define HEVC_MPRED_REF_EN_L0 0xc830 -+#define HEVC_MPRED_REF_EN_L1 0xc834 -+#define HEVC_MPRED_COLREF_EN_L0 0xc838 -+#define HEVC_MPRED_COLREF_EN_L1 0xc83c -+#define HEVC_MPRED_AXI_WCTRL 0xc840 -+#define HEVC_MPRED_AXI_RCTRL 0xc844 -+#define HEVC_MPRED_ABV_START_ADDR 0xc848 -+#define HEVC_MPRED_MV_WR_START_ADDR 0xc84c -+#define HEVC_MPRED_MV_RD_START_ADDR 0xc850 -+#define HEVC_MPRED_MV_WPTR 0xc854 -+#define HEVC_MPRED_MV_RPTR 0xc858 -+#define HEVC_MPRED_MV_WR_ROW_JUMP 0xc85c -+#define HEVC_MPRED_MV_RD_ROW_JUMP 0xc860 -+#define HEVC_MPRED_CURR_LCU 0xc864 -+#define HEVC_MPRED_ABV_WPTR 0xc868 -+#define HEVC_MPRED_ABV_RPTR 0xc86c -+#define HEVC_MPRED_CTRL2 0xc870 -+#define HEVC_MPRED_CTRL3 0xc874 -+#define HEVC_MPRED_L0_REF00_POC 0xc880 -+#define HEVC_MPRED_L1_REF00_POC 0xc8c0 -+ -+#define HEVC_MPRED_CUR_POC 0xc980 -+#define HEVC_MPRED_COL_POC 0xc984 -+#define HEVC_MPRED_MV_RD_END_ADDR 0xc988 -+ -+#define HEVC_MSP 0xcc00 -+#define HEVC_MPSR 0xcc04 -+#define HEVC_MCPU_INTR_MSK 0xcc10 -+#define HEVC_MCPU_INTR_REQ 0xcc14 -+#define HEVC_CPSR 0xcc84 -+ -+#define HEVC_IMEM_DMA_CTRL 0xcd00 -+#define HEVC_IMEM_DMA_ADR 0xcd04 -+#define HEVC_IMEM_DMA_COUNT 0xcd08 -+ -+#define HEVCD_IPP_TOP_CNTL 0xd000 -+#define HEVCD_IPP_LINEBUFF_BASE 0xd024 -+#define HEVCD_IPP_AXIIF_CONFIG 0xd02c -+ -+#define HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR 0xd180 -+#define HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR 0xd184 -+#define HEVCD_MPP_ANC2AXI_TBL_DATA 0xd190 -+ -+#define HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR 0xd300 -+#define HEVCD_MPP_ANC_CANVAS_DATA_ADDR 0xd304 -+#define HEVCD_MPP_DECOMP_CTL1 0xd308 -+#define HEVCD_MPP_DECOMP_CTL2 0xd30c -+#define HEVCD_MCRCC_CTL1 0xd3c0 -+#define HEVCD_MCRCC_CTL2 0xd3c4 -+#define HEVCD_MCRCC_CTL3 0xd3c8 -+ -+#define HEVC_DBLK_CFG0 0xd400 -+#define HEVC_DBLK_CFG1 0xd404 -+#define HEVC_DBLK_CFG2 0xd408 -+#define HEVC_DBLK_CFG3 0xd40c -+#define HEVC_DBLK_CFG4 0xd410 -+#define HEVC_DBLK_CFG5 0xd414 -+#define HEVC_DBLK_CFG6 0xd418 -+#define HEVC_DBLK_CFG7 0xd41c -+#define HEVC_DBLK_CFG8 0xd420 -+#define HEVC_DBLK_CFG9 0xd424 -+#define HEVC_DBLK_CFGA 0xd428 -+#define HEVC_DBLK_STS0 0xd42c -+#define HEVC_DBLK_STS1 0xd430 -+ -+#define HEVC_SAO_VERSION 0xd800 -+#define HEVC_SAO_CTRL0 0xd804 -+#define HEVC_SAO_CTRL1 0xd808 -+#define HEVC_SAO_PIC_SIZE 0xd814 -+#define HEVC_SAO_PIC_SIZE_LCU 0xd818 -+#define HEVC_SAO_TILE_START 0xd81c -+#define HEVC_SAO_TILE_SIZE_LCU 0xd820 -+#define HEVC_SAO_Y_START_ADDR 0xd82c -+#define HEVC_SAO_Y_LENGTH 0xd830 -+#define HEVC_SAO_C_START_ADDR 0xd834 -+#define HEVC_SAO_C_LENGTH 0xd838 -+#define HEVC_SAO_Y_WPTR 0xd83c -+#define HEVC_SAO_C_WPTR 0xd840 -+#define HEVC_SAO_ABV_START_ADDR 0xd844 -+#define HEVC_SAO_VB_WR_START_ADDR 0xd848 -+#define HEVC_SAO_VB_RD_START_ADDR 0xd84c -+#define HEVC_SAO_ABV_WPTR 0xd850 -+#define HEVC_SAO_ABV_RPTR 0xd854 -+#define HEVC_SAO_VB_WPTR 0xd858 -+#define HEVC_SAO_VB_RPTR 0xd85c -+#define HEVC_SAO_CTRL2 0xd880 -+#define HEVC_SAO_CTRL3 0xd884 -+#define HEVC_SAO_CTRL4 0xd888 -+#define HEVC_SAO_CTRL5 0xd88c -+#define HEVC_SAO_CTRL6 0xd890 -+#define HEVC_SAO_CTRL7 0xd894 -+#define HEVC_CM_BODY_START_ADDR 0xd898 -+#define HEVC_CM_BODY_LENGTH 0xd89c -+#define HEVC_CM_HEADER_LENGTH 0xd8a4 -+#define HEVC_CM_HEADER_OFFSET 0xd8ac -+ -+#define HEVC_IQIT_CLK_RST_CTRL 0xdc00 -+#define HEVC_IQIT_SCALELUT_WR_ADDR 0xdc08 -+#define HEVC_IQIT_SCALELUT_RD_ADDR 0xdc0c -+#define HEVC_IQIT_SCALELUT_DATA 0xdc10 -+ -+#define HEVC_PSCALE_CTRL 0xe444 -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h -index d811e7976519..210ab4b755fe 100644 ---- a/drivers/staging/media/meson/vdec/vdec.h -+++ b/drivers/staging/media/meson/vdec/vdec.h -@@ -18,7 +18,9 @@ - #include "vdec_platform.h" - - /* 32 buffers in 3-plane YUV420 */ --#define MAX_CANVAS (32 * 3) -+#define MAX_CANVAS (32 * 3) -+ -+#define MAX_REF_PIC_NUM 24 - - struct amvdec_buffer { - struct list_head list; -@@ -258,6 +260,9 @@ struct amvdec_session { - u32 wrap_count; - u32 fw_idx_to_vb2_idx[32]; - -+ void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; -+ dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; -+ - enum amvdec_status status; - void *priv; - }; -diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c -new file mode 100644 -index 000000000000..b1406a5638da ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/vdec_hevc.c -@@ -0,0 +1,191 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ * -+ * VDEC_HEVC is a video decoding block that allows decoding of -+ * HEVC, VP9 -+ */ -+ -+#include -+#include -+ -+#include "vdec_1.h" -+#include "vdec_helpers.h" -+#include "hevc_regs.h" -+#include "dos_regs.h" -+ -+/* AO Registers */ -+#define AO_RTI_GEN_PWR_SLEEP0 0xe8 -+#define AO_RTI_GEN_PWR_ISO0 0xec -+ #define GEN_PWR_VDEC_HEVC (BIT(7) | BIT(6)) -+ -+#define MC_SIZE (4096 * 4) -+ -+static int vdec_hevc_load_firmware(struct amvdec_session *sess, const char* fwname) -+{ -+ struct amvdec_core *core = sess->core; -+ struct device *dev = core->dev_dec; -+ const struct firmware *fw; -+ static void *mc_addr; -+ static dma_addr_t mc_addr_map; -+ int ret; -+ u32 i = 100; -+ -+ ret = request_firmware(&fw, fwname, dev); -+ if (ret < 0) { -+ dev_err(dev, "Unable to request firmware %s\n", fwname); -+ return ret; -+ } -+ -+ if (fw->size < MC_SIZE) { -+ dev_err(dev, "Firmware size %zu is too small. Expected %u.\n", -+ fw->size, MC_SIZE); -+ ret = -EINVAL; -+ goto release_firmware; -+ } -+ -+ mc_addr = dma_alloc_coherent(core->dev, MC_SIZE, &mc_addr_map, GFP_KERNEL); -+ if (!mc_addr) { -+ dev_err(dev, "Failed allocating memory for firmware loading\n"); -+ ret = -ENOMEM; -+ goto release_firmware; -+ } -+ -+ memcpy(mc_addr, fw->data, MC_SIZE); -+ -+ amvdec_write_dos(core, HEVC_MPSR, 0); -+ amvdec_write_dos(core, HEVC_CPSR, 0); -+ -+ amvdec_write_dos(core, HEVC_IMEM_DMA_ADR, mc_addr_map); -+ amvdec_write_dos(core, HEVC_IMEM_DMA_COUNT, MC_SIZE / 4); -+ amvdec_write_dos(core, HEVC_IMEM_DMA_CTRL, (0x8000 | (7 << 16))); -+ -+ while (--i && readl(core->dos_base + HEVC_IMEM_DMA_CTRL) & 0x8000) { } -+ -+ if (i == 0) { -+ dev_err(dev, "Firmware load fail (DMA hang?)\n"); -+ ret = -ENODEV; -+ } -+ -+ dma_free_coherent(core->dev, MC_SIZE, mc_addr, mc_addr_map); -+release_firmware: -+ release_firmware(fw); -+ return ret; -+} -+ -+static void vdec_hevc_stbuf_init(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ -+ amvdec_write_dos(core, HEVC_STREAM_CONTROL, amvdec_read_dos(core, HEVC_STREAM_CONTROL) & ~1); -+ amvdec_write_dos(core, HEVC_STREAM_START_ADDR, sess->vififo_paddr); -+ amvdec_write_dos(core, HEVC_STREAM_END_ADDR, sess->vififo_paddr + sess->vififo_size); -+ amvdec_write_dos(core, HEVC_STREAM_RD_PTR, sess->vififo_paddr); -+ amvdec_write_dos(core, HEVC_STREAM_WR_PTR, sess->vififo_paddr); -+} -+ -+/* VDEC_HEVC specific ESPARSER configuration */ -+static void vdec_hevc_conf_esparser(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ -+ /* set vififo_vbuf_rp_sel=>vdec_hevc */ -+ amvdec_write_dos(core, DOS_GEN_CTRL0, 3 << 1); -+ amvdec_write_dos(core, HEVC_STREAM_CONTROL, amvdec_read_dos(core, HEVC_STREAM_CONTROL) | BIT(3)); -+ amvdec_write_dos(core, HEVC_STREAM_CONTROL, amvdec_read_dos(core, HEVC_STREAM_CONTROL) | 1); -+ amvdec_write_dos(core, HEVC_STREAM_FIFO_CTL, amvdec_read_dos(core, HEVC_STREAM_FIFO_CTL) | BIT(29)); -+} -+ -+static u32 vdec_hevc_vififo_level(struct amvdec_session *sess) -+{ -+ return readl_relaxed(sess->core->dos_base + HEVC_STREAM_LEVEL); -+} -+ -+static int vdec_hevc_stop(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; -+ -+ /* Disable interrupt */ -+ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_MASK, 0); -+ /* Disable firmware processor */ -+ amvdec_write_dos(core, HEVC_MPSR, 0); -+ -+ if (sess->priv) -+ codec_ops->stop(sess); -+ -+ /* Enable VDEC_HEVC Isolation */ -+ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_ISO0, 0xc00, 0xc00); -+ -+ /* VDEC_HEVC Memories */ -+ amvdec_write_dos(core, DOS_MEM_PD_HEVC, 0xffffffffUL); -+ -+ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, -+ GEN_PWR_VDEC_HEVC, GEN_PWR_VDEC_HEVC); -+ -+ clk_disable_unprepare(core->vdec_hevc_clk); -+ -+ return 0; -+} -+ -+static int vdec_hevc_start(struct amvdec_session *sess) -+{ -+ int ret; -+ struct amvdec_core *core = sess->core; -+ struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; -+ -+ clk_set_rate(core->vdec_hevc_clk, 666666666); -+ ret = clk_prepare_enable(core->vdec_hevc_clk); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, -+ GEN_PWR_VDEC_HEVC, 0); -+ udelay(10); -+ -+ /* Reset VDEC_HEVC*/ -+ amvdec_write_dos(core, DOS_SW_RESET3, 0xffffffff); -+ amvdec_write_dos(core, DOS_SW_RESET3, 0x00000000); -+ -+ amvdec_write_dos(core, DOS_GCLK_EN3, 0xffffffff); -+ -+ /* VDEC_HEVC Memories */ -+ amvdec_write_dos(core, DOS_MEM_PD_HEVC, 0x00000000); -+ -+ /* Remove VDEC_HEVC Isolation */ -+ regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_ISO0, 0xc00, 0); -+ -+ amvdec_write_dos(core, DOS_SW_RESET3, 0xffffffff); -+ amvdec_write_dos(core, DOS_SW_RESET3, 0x00000000); -+ -+ vdec_hevc_stbuf_init(sess); -+ -+ ret = vdec_hevc_load_firmware(sess, sess->fmt_out->firmware_path); -+ if (ret) -+ goto stop; -+ -+ ret = codec_ops->start(sess); -+ if (ret) -+ goto stop; -+ -+ amvdec_write_dos(core, DOS_SW_RESET3, BIT(12)|BIT(11)); -+ amvdec_write_dos(core, DOS_SW_RESET3, 0); -+ amvdec_read_dos(core, DOS_SW_RESET3); -+ -+ amvdec_write_dos(core, HEVC_MPSR, 1); -+ /* Let the firmware settle */ -+ udelay(10); -+ -+ return 0; -+ -+stop: -+ vdec_hevc_stop(sess); -+ return ret; -+} -+ -+struct amvdec_ops vdec_hevc_ops = { -+ .start = vdec_hevc_start, -+ .stop = vdec_hevc_stop, -+ .conf_esparser = vdec_hevc_conf_esparser, -+ .vififo_level = vdec_hevc_vififo_level, -+}; -diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.h b/drivers/staging/media/meson/vdec/vdec_hevc.h -new file mode 100644 -index 000000000000..54a611aded16 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/vdec_hevc.h -@@ -0,0 +1,22 @@ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ */ -+ -+#ifndef __MESON_VDEC_VDEC_HEVC_H_ -+#define __MESON_VDEC_VDEC_HEVC_H_ -+ -+#include "vdec.h" -+ -+extern struct amvdec_ops vdec_hevc_ops; -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -index fb714d74753f..7318d7102874 100644 ---- a/drivers/staging/media/meson/vdec/vdec_platform.c -+++ b/drivers/staging/media/meson/vdec/vdec_platform.c -@@ -8,13 +8,25 @@ - #include "vdec.h" - - #include "vdec_1.h" -+#include "vdec_hevc.h" - #include "codec_mpeg12.h" - #include "codec_h264.h" - #include "codec_mpeg4.h" - #include "codec_mjpeg.h" -+#include "codec_hevc.h" - - static const struct amvdec_format vdec_formats_gxbb[] = { - { -+ .pixfmt = V4L2_PIX_FMT_HEVC, -+ .min_buffers = 16, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_hevc_ops, -+ .firmware_path = "meson/gx/vh265_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_MJPEG, - .min_buffers = 4, - .max_buffers = 4, -@@ -89,6 +101,16 @@ static const struct amvdec_format vdec_formats_gxbb[] = { - - static const struct amvdec_format vdec_formats_gxl[] = { - { -+ .pixfmt = V4L2_PIX_FMT_HEVC, -+ .min_buffers = 16, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_hevc_ops, -+ .firmware_path = "meson/gx/vh265_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_MJPEG, - .min_buffers = 4, - .max_buffers = 4, -@@ -163,6 +185,16 @@ static const struct amvdec_format vdec_formats_gxl[] = { - - static const struct amvdec_format vdec_formats_gxm[] = { - { -+ .pixfmt = V4L2_PIX_FMT_HEVC, -+ .min_buffers = 16, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_hevc_ops, -+ .firmware_path = "meson/gx/vh265_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, { - .pixfmt = V4L2_PIX_FMT_MJPEG, - .min_buffers = 4, - .max_buffers = 4, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0124-FROMLIST-arm64-dts-meson-khadas-vim3-move-model-to-g.patch b/packages/linux/patches/amlogic/amlogic-0124-FROMLIST-arm64-dts-meson-khadas-vim3-move-model-to-g.patch new file mode 100644 index 0000000000..e67519bb43 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0124-FROMLIST-arm64-dts-meson-khadas-vim3-move-model-to-g.patch @@ -0,0 +1,46 @@ +From 674d727336b1fe8e943fa1ccc58a743ea5265545 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 21 Feb 2020 04:49:36 +0000 +Subject: [PATCH 124/146] FROMLIST: arm64: dts: meson: khadas-vim3: move model + to g12b-khadas-vim3 dtsi + +The common meson-khadas-vim3.dtsi is now shared with VIM3L so move the +VIM3 model namne to meson-g12b-khadas-vim3.dtsi. + +meson-sm1-khadas-vim3l.dts contains the VIM3L model name. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 2 ++ + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 2 -- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +index 554863429aa6..2b2d72c7746b 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +@@ -8,6 +8,8 @@ + #include + + / { ++ model = "Khadas VIM3"; ++ + vddcpu_a: regulator-vddcpu-a { + /* + * MP8756GD Regulator. +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 90815fa25ec6..0ef60c7151cb 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -9,8 +9,6 @@ + #include + + / { +- model = "Khadas VIM3"; +- + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0124-TEMP-media-meson-vdec-add-VP9-input-support.patch b/packages/linux/patches/amlogic/amlogic-0124-TEMP-media-meson-vdec-add-VP9-input-support.patch deleted file mode 100644 index ead5e89a5c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0124-TEMP-media-meson-vdec-add-VP9-input-support.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 714cf04b3a007ff235eeb1239d6d6535c8552c88 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Thu, 17 Jan 2019 16:59:11 +0100 -Subject: [PATCH 124/187] TEMP: media: meson: vdec: add VP9 input support - -Amlogic VP9 decoder requires an additional 16-byte payload before every -frame header. - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/esparser.c | 101 +++++++++++++++++++- - 1 file changed, 97 insertions(+), 4 deletions(-) - -diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c -index 3a21a8cec799..97a4cd409c5f 100644 ---- a/drivers/staging/media/meson/vdec/esparser.c -+++ b/drivers/staging/media/meson/vdec/esparser.c -@@ -52,6 +52,7 @@ - #define PARSER_VIDEO_HOLE 0x90 - - #define SEARCH_PATTERN_LEN 512 -+#define VP9_HEADER_SIZE 16 - - static DECLARE_WAIT_QUEUE_HEAD(wq); - static int search_done; -@@ -74,14 +75,103 @@ static irqreturn_t esparser_isr(int irq, void *dev) - return IRQ_HANDLED; - } - -+/** -+ * VP9 frame headers need to be appended by a 16-byte long -+ * Amlogic custom header -+ */ -+static int vp9_update_header(struct vb2_buffer *buf) -+{ -+ uint8_t *dp; -+ uint8_t marker; -+ int dsize; -+ int num_frames, cur_frame; -+ int cur_mag, mag, mag_ptr; -+ int frame_size[8], tot_frame_size[8]; -+ int total_datasize = 0; -+ int new_frame_size; -+ unsigned char *old_header = NULL; -+ -+ dp = (uint8_t *) vb2_plane_vaddr(buf, 0); -+ dsize = vb2_get_plane_payload(buf, 0); -+ -+ marker = dp[dsize - 1]; -+ if ((marker & 0xe0) == 0xc0) { -+ num_frames = (marker & 0x7) + 1; -+ mag = ((marker >> 3) & 0x3) + 1; -+ mag_ptr = dsize - mag * num_frames - 2; -+ if (dp[mag_ptr] != marker) { -+ return 0; -+ } -+ mag_ptr++; -+ for (cur_frame = 0; cur_frame < num_frames; cur_frame++) { -+ frame_size[cur_frame] = 0; -+ for (cur_mag = 0; cur_mag < mag; cur_mag++) { -+ frame_size[cur_frame] |= (dp[mag_ptr] << (cur_mag * 8)); -+ mag_ptr++; -+ } -+ if (cur_frame == 0) -+ tot_frame_size[cur_frame] = frame_size[cur_frame]; -+ else -+ tot_frame_size[cur_frame] = tot_frame_size[cur_frame - 1] + frame_size[cur_frame]; -+ total_datasize += frame_size[cur_frame]; -+ } -+ } else { -+ num_frames = 1; -+ frame_size[0] = dsize; -+ tot_frame_size[0] = dsize; -+ total_datasize = dsize; -+ } -+ -+ new_frame_size = total_datasize + num_frames * VP9_HEADER_SIZE; -+ -+ for (cur_frame = num_frames - 1; cur_frame >= 0; cur_frame--) { -+ int framesize = frame_size[cur_frame]; -+ int framesize_header = framesize + 4; -+ int oldframeoff = tot_frame_size[cur_frame] - framesize; -+ int outheaderoff = oldframeoff + cur_frame * VP9_HEADER_SIZE; -+ uint8_t *fdata = dp + outheaderoff; -+ uint8_t *old_framedata = dp + oldframeoff; -+ -+ memmove(fdata + VP9_HEADER_SIZE, old_framedata, framesize); -+ -+ fdata[0] = (framesize_header >> 24) & 0xff; -+ fdata[1] = (framesize_header >> 16) & 0xff; -+ fdata[2] = (framesize_header >> 8) & 0xff; -+ fdata[3] = (framesize_header >> 0) & 0xff; -+ fdata[4] = ((framesize_header >> 24) & 0xff) ^0xff; -+ fdata[5] = ((framesize_header >> 16) & 0xff) ^0xff; -+ fdata[6] = ((framesize_header >> 8) & 0xff) ^0xff; -+ fdata[7] = ((framesize_header >> 0) & 0xff) ^0xff; -+ fdata[8] = 0; -+ fdata[9] = 0; -+ fdata[10] = 0; -+ fdata[11] = 1; -+ fdata[12] = 'A'; -+ fdata[13] = 'M'; -+ fdata[14] = 'L'; -+ fdata[15] = 'V'; -+ -+ if (!old_header) { -+ /* nothing */ -+ } else if (old_header > fdata + 16 + framesize) { -+ printk("data has gaps, setting to 0\n"); -+ memset(fdata + 16 + framesize, 0, (old_header - fdata + 16 + framesize)); -+ } else if (old_header < fdata + 16 + framesize) { -+ printk("data overwritten\n"); -+ } -+ old_header = fdata; -+ } -+ -+ return new_frame_size; -+} -+ - /* Pad the packet to at least 4KiB bytes otherwise the VDEC unit won't trigger - * ISRs. - * Also append a start code 000001ff at the end to trigger - * the ESPARSER interrupt. - */ --static u32 esparser_pad_start_code(struct vb2_buffer *vb) -+static u32 esparser_pad_start_code(struct vb2_buffer *vb, u32 payload_size) - { -- u32 payload_size = vb2_get_plane_payload(vb, 0); - u32 pad_size = 0; - u8 *vaddr = vb2_plane_vaddr(vb, 0) + payload_size; - -@@ -190,7 +280,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) - if (codec_ops->num_pending_bufs) - num_dst_bufs = codec_ops->num_pending_bufs(sess); - -- num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); -+ num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx) - 1; - - if (esparser_vififo_get_free_space(sess) < payload_size || - atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs) -@@ -204,7 +294,10 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) - dev_dbg(core->dev, "esparser: ts = %llu pld_size = %u offset = %08X\n", - vb->timestamp, payload_size, offset); - -- pad_size = esparser_pad_start_code(vb); -+ if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9) -+ payload_size = vp9_update_header(vb); -+ -+ pad_size = esparser_pad_start_code(vb, payload_size); - ret = esparser_write_data(core, phy, payload_size + pad_size); - - if (ret <= 0) { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch b/packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch new file mode 100644 index 0000000000..6465d5127e --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch @@ -0,0 +1,32 @@ +From a2e2208abbb5cc9b65432626c57d593e92f5ffd9 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 28 Feb 2020 19:08:03 +0000 +Subject: [PATCH 125/146] FROMLIST: dt-bindings: add vendor prefix for + Smartlabs LLC + +Smartlabs LLC are a professional integrator of Interactive TV solutions +and IPTV/VOD devices [1]. + +[1] https://www.smartlabs.tv/en/about/ + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml +index 9e67944bec9c..a34ed82ecead 100644 +--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml ++++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml +@@ -901,6 +901,8 @@ patternProperties: + description: Sitronix Technology Corporation + "^skyworks,.*": + description: Skyworks Solutions, Inc. ++ "^smartlabs,.*": ++ description: SmartLabs LLC + "^smsc,.*": + description: Standard Microsystems Corporation + "^snps,.*": +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0125-TEMP-media-meson-vdec-add-VP9-support.patch b/packages/linux/patches/amlogic/amlogic-0125-TEMP-media-meson-vdec-add-VP9-support.patch deleted file mode 100644 index 170ccbee3f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0125-TEMP-media-meson-vdec-add-VP9-support.patch +++ /dev/null @@ -1,1235 +0,0 @@ -From 806b54cec30704b92b31e4e6e5417c1ee09a2326 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Thu, 17 Jan 2019 17:00:11 +0100 -Subject: [PATCH 125/187] TEMP: media: meson: vdec: add VP9 support - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/Makefile | 2 +- - drivers/staging/media/meson/vdec/codec_vp9.c | 1083 +++++++++++++++++ - drivers/staging/media/meson/vdec/codec_vp9.h | 13 + - drivers/staging/media/meson/vdec/esparser.c | 4 +- - drivers/staging/media/meson/vdec/hevc_regs.h | 7 + - .../staging/media/meson/vdec/vdec_platform.c | 23 + - 6 files changed, 1130 insertions(+), 2 deletions(-) - create mode 100644 drivers/staging/media/meson/vdec/codec_vp9.c - create mode 100644 drivers/staging/media/meson/vdec/codec_vp9.h - -diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile -index 900dde088da0..aaa9c4310150 100644 ---- a/drivers/staging/media/meson/vdec/Makefile -+++ b/drivers/staging/media/meson/vdec/Makefile -@@ -3,6 +3,6 @@ - - meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o - meson-vdec-objs += vdec_1.o vdec_hevc.o --meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o codec_mjpeg.o codec_hevc_common.o codec_hevc.o -+meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_mpeg4.o codec_mjpeg.o codec_hevc_common.o codec_hevc.o codec_vp9.o - - obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o -diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c -new file mode 100644 -index 000000000000..731119b9ee17 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_vp9.c -@@ -0,0 +1,1083 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. -+ */ -+ -+#include -+#include -+ -+#include "codec_hevc.h" -+#include "dos_regs.h" -+#include "hevc_regs.h" -+#include "vdec_helpers.h" -+#include "codec_hevc_common.h" -+ -+/* HEVC reg mapping */ -+#define VP9_DEC_STATUS_REG HEVC_ASSIST_SCRATCH_0 -+ #define VP9_10B_DECODE_SLICE 5 -+ #define VP9_HEAD_PARSER_DONE 0xf0 -+#define VP9_RPM_BUFFER HEVC_ASSIST_SCRATCH_1 -+#define VP9_SHORT_TERM_RPS HEVC_ASSIST_SCRATCH_2 -+#define VP9_ADAPT_PROB_REG HEVC_ASSIST_SCRATCH_3 -+#define VP9_MMU_MAP_BUFFER HEVC_ASSIST_SCRATCH_4 -+#define VP9_PPS_BUFFER HEVC_ASSIST_SCRATCH_5 -+#define VP9_SAO_UP HEVC_ASSIST_SCRATCH_6 -+#define VP9_STREAM_SWAP_BUFFER HEVC_ASSIST_SCRATCH_7 -+#define VP9_STREAM_SWAP_BUFFER2 HEVC_ASSIST_SCRATCH_8 -+#define VP9_PROB_SWAP_BUFFER HEVC_ASSIST_SCRATCH_9 -+#define VP9_COUNT_SWAP_BUFFER HEVC_ASSIST_SCRATCH_A -+#define VP9_SEG_MAP_BUFFER HEVC_ASSIST_SCRATCH_B -+#define VP9_SCALELUT HEVC_ASSIST_SCRATCH_D -+#define VP9_WAIT_FLAG HEVC_ASSIST_SCRATCH_E -+#define LMEM_DUMP_ADR HEVC_ASSIST_SCRATCH_F -+#define NAL_SEARCH_CTL HEVC_ASSIST_SCRATCH_I -+#define VP9_DECODE_MODE HEVC_ASSIST_SCRATCH_J -+ #define DECODE_MODE_SINGLE 0 -+#define DECODE_STOP_POS HEVC_ASSIST_SCRATCH_K -+#define HEVC_DECODE_COUNT HEVC_ASSIST_SCRATCH_M -+#define HEVC_DECODE_SIZE HEVC_ASSIST_SCRATCH_N -+ -+/* VP9 Constants */ -+#define LCU_SIZE 64 -+#define MAX_REF_PIC_NUM 24 -+#define REFS_PER_FRAME 3 -+#define REF_FRAMES 8 -+#define MV_MEM_UNIT 0x240 -+ -+enum FRAME_TYPE { -+ KEY_FRAME = 0, -+ INTER_FRAME = 1, -+ FRAME_TYPES, -+}; -+ -+/* VP9 Workspace layout */ -+#define MPRED_MV_BUF_SIZE 0x120000 -+ -+#define IPP_SIZE 0x4000 -+#define SAO_ABV_SIZE 0x30000 -+#define SAO_VB_SIZE 0x30000 -+#define SH_TM_RPS_SIZE 0x800 -+#define VPS_SIZE 0x800 -+#define SPS_SIZE 0x800 -+#define PPS_SIZE 0x2000 -+#define SAO_UP_SIZE 0x2800 -+#define SWAP_BUF_SIZE 0x800 -+#define SWAP_BUF2_SIZE 0x800 -+#define SCALELUT_SIZE 0x8000 -+#define DBLK_PARA_SIZE 0x80000 -+#define DBLK_DATA_SIZE 0x80000 -+#define SEG_MAP_SIZE 0xd800 -+#define PROB_SIZE 0x5000 -+#define COUNT_SIZE 0x3000 -+#define MMU_VBH_SIZE 0x5000 -+#define MPRED_ABV_SIZE 0x10000 -+#define MPRED_MV_SIZE (MPRED_MV_BUF_SIZE * MAX_REF_PIC_NUM) -+#define RPM_BUF_SIZE 0x100 -+#define LMEM_SIZE 0x800 -+ -+#define IPP_OFFSET 0x00 -+#define SAO_ABV_OFFSET (IPP_OFFSET + IPP_SIZE) -+#define SAO_VB_OFFSET (SAO_ABV_OFFSET + SAO_ABV_SIZE) -+#define SH_TM_RPS_OFFSET (SAO_VB_OFFSET + SAO_VB_SIZE) -+#define VPS_OFFSET (SH_TM_RPS_OFFSET + SH_TM_RPS_SIZE) -+#define SPS_OFFSET (VPS_OFFSET + VPS_SIZE) -+#define PPS_OFFSET (SPS_OFFSET + SPS_SIZE) -+#define SAO_UP_OFFSET (PPS_OFFSET + PPS_SIZE) -+#define SWAP_BUF_OFFSET (SAO_UP_OFFSET + SAO_UP_SIZE) -+#define SWAP_BUF2_OFFSET (SWAP_BUF_OFFSET + SWAP_BUF_SIZE) -+#define SCALELUT_OFFSET (SWAP_BUF2_OFFSET + SWAP_BUF2_SIZE) -+#define DBLK_PARA_OFFSET (SCALELUT_OFFSET + SCALELUT_SIZE) -+#define DBLK_DATA_OFFSET (DBLK_PARA_OFFSET + DBLK_PARA_SIZE) -+#define SEG_MAP_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) -+#define PROB_OFFSET (SEG_MAP_OFFSET + SEG_MAP_SIZE) -+#define COUNT_OFFSET (PROB_OFFSET + PROB_SIZE) -+#define MMU_VBH_OFFSET (COUNT_OFFSET + COUNT_SIZE) -+#define MPRED_ABV_OFFSET (MMU_VBH_OFFSET + MMU_VBH_SIZE) -+#define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) -+#define RPM_OFFSET (MPRED_MV_OFFSET + MPRED_MV_SIZE) -+#define LMEM_OFFSET (RPM_OFFSET + RPM_BUF_SIZE) -+ -+#define SIZE_WORKSPACE ALIGN(LMEM_OFFSET + LMEM_SIZE, 64 * SZ_1K) -+ -+#define NONE -1 -+#define INTRA_FRAME 0 -+#define LAST_FRAME 1 -+#define GOLDEN_FRAME 2 -+#define ALTREF_FRAME 3 -+#define MAX_REF_FRAMES 4 -+ -+/* -+ * Defines, declarations, sub-functions for vp9 de-block loop -+ filter Thr/Lvl table update -+ * - struct segmentation is for loop filter only (removed something) -+ * - function "vp9_loop_filter_init" and "vp9_loop_filter_frame_init" will -+ be instantiated in C_Entry -+ * - vp9_loop_filter_init run once before decoding start -+ * - vp9_loop_filter_frame_init run before every frame decoding start -+ * - set video format to VP9 is in vp9_loop_filter_init -+ */ -+#define MAX_LOOP_FILTER 63 -+#define MAX_REF_LF_DELTAS 4 -+#define MAX_MODE_LF_DELTAS 2 -+#define SEGMENT_DELTADATA 0 -+#define SEGMENT_ABSDATA 1 -+#define MAX_SEGMENTS 8 -+ -+union rpm_param { -+ struct { -+ u16 data[RPM_BUF_SIZE]; -+ } l; -+ struct { -+ u16 profile; -+ u16 show_existing_frame; -+ u16 frame_to_show_idx; -+ u16 frame_type; /*1 bit*/ -+ u16 show_frame; /*1 bit*/ -+ u16 error_resilient_mode; /*1 bit*/ -+ u16 intra_only; /*1 bit*/ -+ u16 display_size_present; /*1 bit*/ -+ u16 reset_frame_context; -+ u16 refresh_frame_flags; -+ u16 width; -+ u16 height; -+ u16 display_width; -+ u16 display_height; -+ u16 ref_info; -+ u16 same_frame_size; -+ u16 mode_ref_delta_enabled; -+ u16 ref_deltas[4]; -+ u16 mode_deltas[2]; -+ u16 filter_level; -+ u16 sharpness_level; -+ u16 bit_depth; -+ u16 seg_quant_info[8]; -+ u16 seg_enabled; -+ u16 seg_abs_delta; -+ /* bit 15: feature enabled; bit 8, sign; bit[5:0], data */ -+ u16 seg_lf_info[8]; -+ } p; -+}; -+ -+enum SEG_LVL_FEATURES { -+ SEG_LVL_ALT_Q = 0, /* Use alternate Quantizer */ -+ SEG_LVL_ALT_LF = 1, /* Use alternate loop filter value */ -+ SEG_LVL_REF_FRAME = 2, /* Optional Segment reference frame */ -+ SEG_LVL_SKIP = 3, /* Optional Segment (0,0) + skip mode */ -+ SEG_LVL_MAX = 4 /* Number of features supported */ -+}; -+ -+struct segmentation { -+ uint8_t enabled; -+ uint8_t update_map; -+ uint8_t update_data; -+ uint8_t abs_delta; -+ uint8_t temporal_update; -+ int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX]; -+ unsigned int feature_mask[MAX_SEGMENTS]; -+}; -+ -+struct loop_filter_thresh { -+ uint8_t mblim; -+ uint8_t lim; -+ uint8_t hev_thr; -+}; -+ -+struct loop_filter_info_n { -+ struct loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1]; -+ uint8_t lvl[MAX_SEGMENTS][MAX_REF_FRAMES][MAX_MODE_LF_DELTAS]; -+}; -+ -+struct loopfilter { -+ int filter_level; -+ -+ int sharpness_level; -+ int last_sharpness_level; -+ -+ uint8_t mode_ref_delta_enabled; -+ uint8_t mode_ref_delta_update; -+ -+ /*0 = Intra, Last, GF, ARF*/ -+ signed char ref_deltas[MAX_REF_LF_DELTAS]; -+ signed char last_ref_deltas[MAX_REF_LF_DELTAS]; -+ -+ /*0 = ZERO_MV, MV*/ -+ signed char mode_deltas[MAX_MODE_LF_DELTAS]; -+ signed char last_mode_deltas[MAX_MODE_LF_DELTAS]; -+}; -+ -+struct vp9_frame { -+ struct list_head list; -+ struct vb2_v4l2_buffer *vbuf; -+ int index; -+ int intra_only; -+ int show; -+ int type; -+ int done; -+}; -+ -+struct codec_vp9 { -+ struct mutex lock; -+ -+ /* Buffer for the VP9 Workspace */ -+ void *workspace_vaddr; -+ dma_addr_t workspace_paddr; -+ -+ /* Contains many information parsed from the bitstream */ -+ union rpm_param rpm_param; -+ -+ /* Whether we detected the bitstream as 10-bit */ -+ int is_10bit; -+ -+ /* Coded resolution reported by the hardware */ -+ u32 width, height; -+ -+ /* All ref frames used by the HW at a given time */ -+ struct list_head ref_frames_list; -+ u32 frames_num; -+ -+ /* In case of downsampling (decoding with FBC but outputting in NV12M), -+ * we need to allocate additional buffers for FBC. -+ */ -+ void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; -+ dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; -+ -+ int ref_frame_map[REF_FRAMES]; -+ int next_ref_frame_map[REF_FRAMES]; -+ struct vp9_frame* frame_refs[REFS_PER_FRAME]; -+ -+ u32 lcu_total; -+ -+ /* loop filter */ -+ int default_filt_lvl; -+ struct loop_filter_info_n lfi; -+ struct loopfilter lf; -+ struct segmentation seg_4lf; -+ -+ struct vp9_frame *cur_frame; -+ struct vp9_frame *prev_frame; -+}; -+ -+static int vp9_clamp(int value, int low, int high) -+{ -+ return value < low ? low : (value > high ? high : value); -+} -+ -+static int segfeature_active(struct segmentation *seg, -+ int segment_id, -+ enum SEG_LVL_FEATURES feature_id) -+{ -+ return seg->enabled && -+ (seg->feature_mask[segment_id] & (1 << feature_id)); -+} -+ -+static int get_segdata(struct segmentation *seg, int segment_id, -+ enum SEG_LVL_FEATURES feature_id) -+{ -+ return seg->feature_data[segment_id][feature_id]; -+} -+ -+static void vp9_update_sharpness(struct loop_filter_info_n *lfi, -+ int sharpness_lvl) -+{ -+ int lvl; -+ /*For each possible value for the loop filter fill out limits*/ -+ for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++) { -+ /*Set loop filter parameters that control sharpness.*/ -+ int block_inside_limit = lvl >> ((sharpness_lvl > 0) + -+ (sharpness_lvl > 4)); -+ -+ if (sharpness_lvl > 0) { -+ if (block_inside_limit > (9 - sharpness_lvl)) -+ block_inside_limit = (9 - sharpness_lvl); -+ } -+ -+ if (block_inside_limit < 1) -+ block_inside_limit = 1; -+ -+ lfi->lfthr[lvl].lim = (uint8_t)block_inside_limit; -+ lfi->lfthr[lvl].mblim = (uint8_t)(2 * (lvl + 2) + -+ block_inside_limit); -+ } -+} -+ -+/*instantiate this function once when decode is started*/ -+static void -+vp9_loop_filter_init(struct amvdec_core *core, struct codec_vp9 *vp9) -+{ -+ struct loop_filter_info_n *lfi = &vp9->lfi; -+ struct loopfilter *lf = &vp9->lf; -+ struct segmentation *seg_4lf = &vp9->seg_4lf; -+ int i; -+ -+ memset(lfi, 0, sizeof(struct loop_filter_info_n)); -+ memset(lf, 0, sizeof(struct loopfilter)); -+ memset(seg_4lf, 0, sizeof(struct segmentation)); -+ lf->sharpness_level = 0; -+ vp9_update_sharpness(lfi, lf->sharpness_level); -+ lf->last_sharpness_level = lf->sharpness_level; -+ -+ for (i = 0; i < 32; i++) { -+ unsigned int thr; -+ thr = ((lfi->lfthr[i * 2 + 1].lim & 0x3f)<<8) | -+ (lfi->lfthr[i * 2 + 1].mblim & 0xff); -+ thr = (thr<<16) | ((lfi->lfthr[i*2].lim & 0x3f)<<8) | -+ (lfi->lfthr[i * 2].mblim & 0xff); -+ amvdec_write_dos(core, HEVC_DBLK_CFG9, thr); -+ } -+ -+ amvdec_write_dos(core, HEVC_DBLK_CFGB, 0x40400001); -+} -+ -+static void -+vp9_loop_filter_frame_init(struct amvdec_core *core, struct segmentation *seg, -+ struct loop_filter_info_n *lfi, -+ struct loopfilter *lf, int default_filt_lvl) -+{ -+ int i; -+ int seg_id; -+ /*n_shift is the multiplier for lf_deltas -+ the multiplier is 1 for when filter_lvl is between 0 and 31; -+ 2 when filter_lvl is between 32 and 63*/ -+ const int scale = 1 << (default_filt_lvl >> 5); -+ -+ /*update limits if sharpness has changed*/ -+ if (lf->last_sharpness_level != lf->sharpness_level) { -+ vp9_update_sharpness(lfi, lf->sharpness_level); -+ lf->last_sharpness_level = lf->sharpness_level; -+ -+ /*Write to register*/ -+ for (i = 0; i < 32; i++) { -+ unsigned int thr; -+ thr = ((lfi->lfthr[i * 2 + 1].lim & 0x3f) << 8) -+ | (lfi->lfthr[i * 2 + 1].mblim & 0xff); -+ thr = (thr << 16) | ((lfi->lfthr[i * 2].lim & 0x3f) << 8) -+ | (lfi->lfthr[i * 2].mblim & 0xff); -+ amvdec_write_dos(core, HEVC_DBLK_CFG9, thr); -+ } -+ } -+ -+ for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) {/*MAX_SEGMENTS = 8*/ -+ int lvl_seg = default_filt_lvl; -+ if (segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) { -+ const int data = get_segdata(seg, seg_id, -+ SEG_LVL_ALT_LF); -+ lvl_seg = vp9_clamp(seg->abs_delta == SEGMENT_ABSDATA ? -+ data : default_filt_lvl + data, -+ 0, MAX_LOOP_FILTER); -+ } -+ -+ if (!lf->mode_ref_delta_enabled) { -+ /*we could get rid of this if we assume that deltas are set to -+ zero when not in use; encoder always uses deltas*/ -+ memset(lfi->lvl[seg_id], lvl_seg, sizeof(lfi->lvl[seg_id])); -+ } else { -+ int ref, mode; -+ const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] -+ * scale; -+ lfi->lvl[seg_id][INTRA_FRAME][0] = -+ vp9_clamp(intra_lvl, 0, MAX_LOOP_FILTER); -+ -+ for (ref = LAST_FRAME; ref < MAX_REF_FRAMES; ++ref) { -+ /* LAST_FRAME = 1, MAX_REF_FRAMES = 4*/ -+ for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) { -+ /*MAX_MODE_LF_DELTAS = 2*/ -+ const int inter_lvl = -+ lvl_seg + lf->ref_deltas[ref] * scale -+ + lf->mode_deltas[mode] * scale; -+ lfi->lvl[seg_id][ref][mode] = -+ vp9_clamp(inter_lvl, 0, -+ MAX_LOOP_FILTER); -+ } -+ } -+ } -+ } -+ -+ for (i = 0; i < 16; i++) { -+ unsigned int level; -+ level = ((lfi->lvl[i >> 1][3][i & 1] & 0x3f) << 24) | -+ ((lfi->lvl[i >> 1][2][i & 1] & 0x3f) << 16) | -+ ((lfi->lvl[i >> 1][1][i & 1] & 0x3f) << 8) | -+ (lfi->lvl[i >> 1][0][i & 1] & 0x3f); -+ if (!default_filt_lvl) -+ level = 0; -+ amvdec_write_dos(core, HEVC_DBLK_CFGA, level); -+ } -+} -+ -+static void codec_vp9_flush_output(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ struct vp9_frame *tmp, *n; -+ -+ list_for_each_entry_safe(tmp, n, &vp9->ref_frames_list, list) { -+ if (!tmp->done) { -+ if (tmp->show) -+ amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE); -+ else -+ v4l2_m2m_buf_queue(sess->m2m_ctx, tmp->vbuf); -+ vp9->frames_num--; -+ } -+ -+ list_del(&tmp->list); -+ kfree(tmp); -+ } -+} -+ -+static u32 codec_vp9_num_pending_bufs(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ -+ if (!vp9) -+ return 0; -+ -+ return vp9->frames_num; -+} -+ -+static int -+codec_vp9_setup_workspace(struct amvdec_core *core, struct codec_vp9 *vp9) -+{ -+ dma_addr_t wkaddr; -+ -+ /* Allocate some memory for the VP9 decoder's state */ -+ vp9->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, -+ &wkaddr, GFP_KERNEL); -+ if (!vp9->workspace_vaddr) { -+ dev_err(core->dev, "Failed to allocate VP9 Workspace\n"); -+ return -ENOMEM; -+ } -+ -+ vp9->workspace_paddr = wkaddr; -+ -+ amvdec_write_dos(core, HEVCD_IPP_LINEBUFF_BASE, wkaddr + IPP_OFFSET); -+ amvdec_write_dos(core, VP9_RPM_BUFFER, wkaddr + RPM_OFFSET); -+ amvdec_write_dos(core, VP9_SHORT_TERM_RPS, wkaddr + SH_TM_RPS_OFFSET); -+ amvdec_write_dos(core, VP9_PPS_BUFFER, wkaddr + PPS_OFFSET); -+ amvdec_write_dos(core, VP9_SAO_UP, wkaddr + SAO_UP_OFFSET); -+ -+ /* No MMU */ -+ amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER, -+ wkaddr + SWAP_BUF_OFFSET); -+ amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER2, -+ wkaddr + SWAP_BUF2_OFFSET); -+ amvdec_write_dos(core, VP9_SCALELUT, wkaddr + SCALELUT_OFFSET); -+ amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); -+ amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); -+ amvdec_write_dos(core, VP9_SEG_MAP_BUFFER, wkaddr + SEG_MAP_OFFSET); -+ amvdec_write_dos(core, VP9_PROB_SWAP_BUFFER, wkaddr + PROB_OFFSET); -+ amvdec_write_dos(core, VP9_COUNT_SWAP_BUFFER, wkaddr + COUNT_OFFSET); -+ -+ return 0; -+} -+ -+static int codec_vp9_start(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_vp9 *vp9; -+ u32 val; -+ int i; -+ int ret; -+ -+ vp9 = kzalloc(sizeof(*vp9), GFP_KERNEL); -+ if (!vp9) -+ return -ENOMEM; -+ -+ ret = codec_vp9_setup_workspace(core, vp9); -+ if (ret) -+ goto free_vp9; -+ -+ amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); -+ -+ val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x7fffffff; -+ val |= (3 << 29) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | BIT(0); -+ amvdec_write_dos(core, HEVC_PARSER_INT_CONTROL, val); -+ amvdec_write_dos_bits(core, HEVC_SHIFT_STATUS, BIT(0)); -+ amvdec_write_dos(core, HEVC_SHIFT_CONTROL, BIT(10) | BIT(9) | -+ (3 << 6) | BIT(5) | BIT(2) | BIT(1) | BIT(0)); -+ amvdec_write_dos(core, HEVC_CABAC_CONTROL, BIT(0)); -+ amvdec_write_dos(core, HEVC_PARSER_CORE_CONTROL, BIT(0)); -+ amvdec_write_dos(core, HEVC_SHIFT_STARTCODE, 0x00000001); -+ -+ amvdec_write_dos(core, VP9_DEC_STATUS_REG, 0); -+ -+ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, BIT(16)); -+ for (i = 0; i < ARRAY_SIZE(vdec_hevc_parser_cmd); ++i) -+ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, -+ vdec_hevc_parser_cmd[i]); -+ -+ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_0, PARSER_CMD_SKIP_CFG_0); -+ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_1, PARSER_CMD_SKIP_CFG_1); -+ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_2, PARSER_CMD_SKIP_CFG_2); -+ amvdec_write_dos(core, HEVC_PARSER_IF_CONTROL, -+ BIT(5) | BIT(2) | BIT(0)); -+ -+ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(0)); -+ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(1)); -+ -+ amvdec_write_dos(core, VP9_WAIT_FLAG, 1); -+ -+ /* clear mailbox interrupt */ -+ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_CLR_REG, 1); -+ /* enable mailbox interrupt */ -+ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_MASK, 1); -+ /* disable PSCALE for hardware sharing */ -+ amvdec_write_dos(core, HEVC_PSCALE_CTRL, 0); -+ /* Let the uCode do all the parsing */ -+ amvdec_write_dos(core, NAL_SEARCH_CTL, 0x8); -+ -+ amvdec_write_dos(core, DECODE_STOP_POS, 0); -+ amvdec_write_dos(core, VP9_DECODE_MODE, DECODE_MODE_SINGLE); -+ -+ printk("decode_count: %u; decode_size: %u\n", amvdec_read_dos(core, HEVC_DECODE_COUNT), amvdec_read_dos(core, HEVC_DECODE_SIZE)); -+ -+ vp9_loop_filter_init(core, vp9); -+ -+ INIT_LIST_HEAD(&vp9->ref_frames_list); -+ mutex_init(&vp9->lock); -+ memset(&vp9->ref_frame_map, -1, sizeof(vp9->ref_frame_map)); -+ memset(&vp9->next_ref_frame_map, -1, sizeof(vp9->next_ref_frame_map)); -+ sess->priv = vp9; -+ -+ return 0; -+ -+free_vp9: -+ kfree(vp9); -+ return ret; -+} -+ -+static int codec_vp9_stop(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_vp9 *vp9 = sess->priv; -+ -+ if (vp9->workspace_vaddr) -+ dma_free_coherent(core->dev, SIZE_WORKSPACE, -+ vp9->workspace_vaddr, -+ vp9->workspace_paddr); -+ -+ codec_hevc_free_fbc_buffers(sess); -+ return 0; -+} -+ -+static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_vp9 *vp9 = sess->priv; -+ -+ dma_addr_t buf_y_paddr; -+ dma_addr_t buf_u_v_paddr; -+ u32 val; -+ -+ if (codec_hevc_use_downsample(sess->pixfmt_cap, vp9->is_10bit)) -+ buf_y_paddr = -+ sess->fbc_buffer_paddr[vb->index]; -+ else -+ buf_y_paddr = -+ vb2_dma_contig_plane_dma_addr(vb, 0); -+ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { -+ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200; -+ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); -+ amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); -+ } -+ -+ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { -+ buf_y_paddr = -+ vb2_dma_contig_plane_dma_addr(vb, 0); -+ buf_u_v_paddr = -+ vb2_dma_contig_plane_dma_addr(vb, 1); -+ amvdec_write_dos(core, HEVC_SAO_Y_START_ADDR, buf_y_paddr); -+ amvdec_write_dos(core, HEVC_SAO_C_START_ADDR, buf_u_v_paddr); -+ amvdec_write_dos(core, HEVC_SAO_Y_WPTR, buf_y_paddr); -+ amvdec_write_dos(core, HEVC_SAO_C_WPTR, buf_u_v_paddr); -+ } -+ -+ amvdec_write_dos(core, HEVC_SAO_Y_LENGTH, -+ amvdec_get_output_size(sess)); -+ amvdec_write_dos(core, HEVC_SAO_C_LENGTH, -+ (amvdec_get_output_size(sess) / 2)); -+ -+ val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff3; -+ val |= 0xff0; /* Set endianness for 2-bytes swaps (nv12) */ -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) -+ val |= BIT(0); /* disable cm compression */ -+ else if (sess->pixfmt_cap == V4L2_PIX_FMT_AM21C) -+ val |= BIT(1); /* Disable double write */ -+ -+ amvdec_write_dos(core, HEVC_SAO_CTRL1, val); -+ -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { -+ /* no downscale for NV12 */ -+ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0000; -+ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); -+ } -+ -+ val = amvdec_read_dos(core, HEVCD_IPP_AXIIF_CONFIG) & ~0x30; -+ val |= 0xf; -+ amvdec_write_dos(core, HEVCD_IPP_AXIIF_CONFIG, val); -+} -+ -+static dma_addr_t codec_vp9_get_frame_mv_paddr(struct codec_vp9 *vp9, -+ struct vp9_frame *frame) -+{ -+ return vp9->workspace_paddr + MPRED_MV_OFFSET + -+ (frame->index * MPRED_MV_BUF_SIZE); -+} -+ -+static void codec_vp9_set_mpred_mv(struct amvdec_core *core, -+ struct codec_vp9 *vp9) -+{ -+ int mpred_mv_rd_end_addr; -+ int use_prev_frame_mvs = !vp9->prev_frame->intra_only && -+ vp9->prev_frame->show && -+ vp9->prev_frame->type != KEY_FRAME; -+ -+ amvdec_write_dos(core, HEVC_MPRED_CTRL3, 0x24122412); -+ amvdec_write_dos(core, HEVC_MPRED_ABV_START_ADDR, -+ vp9->workspace_paddr + MPRED_ABV_OFFSET); -+ -+ amvdec_clear_dos_bits(core, HEVC_MPRED_CTRL4, BIT(6)); -+ if (use_prev_frame_mvs) -+ amvdec_write_dos_bits(core, HEVC_MPRED_CTRL4, BIT(6)); -+ -+ amvdec_write_dos(core, HEVC_MPRED_MV_WR_START_ADDR, -+ codec_vp9_get_frame_mv_paddr(vp9, vp9->cur_frame)); -+ amvdec_write_dos(core, HEVC_MPRED_MV_WPTR, -+ codec_vp9_get_frame_mv_paddr(vp9, vp9->cur_frame)); -+ -+ amvdec_write_dos(core, HEVC_MPRED_MV_RD_START_ADDR, -+ codec_vp9_get_frame_mv_paddr(vp9, vp9->prev_frame)); -+ amvdec_write_dos(core, HEVC_MPRED_MV_RPTR, -+ codec_vp9_get_frame_mv_paddr(vp9, vp9->prev_frame)); -+ -+ mpred_mv_rd_end_addr = codec_vp9_get_frame_mv_paddr(vp9, vp9->prev_frame) -+ + (vp9->lcu_total * MV_MEM_UNIT); -+ amvdec_write_dos(core, HEVC_MPRED_MV_RD_END_ADDR, mpred_mv_rd_end_addr); -+} -+ -+static void codec_vp9_update_next_ref(struct codec_vp9 *vp9) -+{ -+ union rpm_param *param = &vp9->rpm_param; -+ u32 buf_idx = vp9->cur_frame->index; -+ int ref_index = 0; -+ int refresh_frame_flags; -+ int mask; -+ -+ refresh_frame_flags = vp9->cur_frame->type == KEY_FRAME ? 0xff : -+ param->p.refresh_frame_flags; -+ -+ for (mask = refresh_frame_flags; mask; mask >>= 1) { -+ //printk("mask=%08X; ref_index=%d\n", mask, ref_index); -+ if (mask & 1) -+ vp9->next_ref_frame_map[ref_index] = buf_idx; -+ else -+ vp9->next_ref_frame_map[ref_index] = -+ vp9->ref_frame_map[ref_index]; -+ -+ ++ref_index; -+ } -+ -+ for (; ref_index < REF_FRAMES; ++ref_index) -+ vp9->next_ref_frame_map[ref_index] = -+ vp9->ref_frame_map[ref_index]; -+} -+ -+static void codec_vp9_update_ref(struct codec_vp9 *vp9) -+{ -+ union rpm_param *param = &vp9->rpm_param; -+ int ref_index = 0; -+ int mask; -+ int refresh_frame_flags; -+ -+ if (!vp9->cur_frame) -+ return; -+ -+ refresh_frame_flags = vp9->cur_frame->type == KEY_FRAME ? -+ 0xff : -+ param->p.refresh_frame_flags; -+ -+ for (mask = refresh_frame_flags; mask; mask >>= 1) { -+ vp9->ref_frame_map[ref_index] = -+ vp9->next_ref_frame_map[ref_index]; -+ ++ref_index; -+ } -+ -+ if (param->p.show_existing_frame) -+ return; -+ -+ for (; ref_index < REF_FRAMES; ++ref_index) -+ vp9->ref_frame_map[ref_index] = -+ vp9->next_ref_frame_map[ref_index]; -+} -+ -+static struct vp9_frame * codec_vp9_get_frame_by_idx(struct codec_vp9 *vp9, int idx) -+{ -+ struct vp9_frame *frame; -+ -+ list_for_each_entry(frame, &vp9->ref_frames_list, list) { -+ if (frame->index == idx) -+ return frame; -+ } -+ -+ return NULL; -+} -+ -+static void codec_vp9_sync_ref(struct codec_vp9 *vp9) -+{ -+ union rpm_param *param = &vp9->rpm_param; -+ int i; -+ -+ for (i = 0; i < REFS_PER_FRAME; ++i) { -+ const int ref = (param->p.ref_info >> -+ (((REFS_PER_FRAME-i-1)*4)+1)) & 0x7; -+ const int idx = vp9->ref_frame_map[ref]; -+ -+ vp9->frame_refs[i] = codec_vp9_get_frame_by_idx(vp9, idx); -+ } -+} -+ -+static void codec_vp9_set_refs(struct amvdec_session *sess, -+ struct codec_vp9 *vp9) -+{ -+ struct amvdec_core *core = sess->core; -+ int i; -+ -+ for (i = 0; i < REFS_PER_FRAME; ++i) { -+ struct vp9_frame *frame = vp9->frame_refs[i]; -+ int id_y; -+ int id_u_v; -+ -+ if (!frame) -+ continue; -+ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { -+ id_y = frame->index; -+ id_u_v = id_y; -+ } else { -+ id_y = frame->index * 2; -+ id_u_v = id_y + 1; -+ } -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, -+ (id_u_v << 16) | (id_u_v << 8) | id_y); -+ } -+} -+ -+static void codec_vp9_set_mc(struct amvdec_session *sess, -+ struct codec_vp9 *vp9) -+{ -+ struct amvdec_core *core = sess->core; -+ int i; -+ -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); -+ codec_vp9_set_refs(sess, vp9); -+ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, (16 << 8) | 1); -+ codec_vp9_set_refs(sess, vp9); -+ -+ amvdec_write_dos(core, VP9D_MPP_REFINFO_TBL_ACCCONFIG, BIT(2)); -+ for (i = 0; i < REFS_PER_FRAME; ++i) { -+ if (!vp9->frame_refs[i]) -+ continue; -+ -+ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, vp9->width); -+ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, vp9->height); -+ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, -+ (vp9->width << 14) / vp9->width); -+ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, -+ (vp9->height << 14) / vp9->height); -+ amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, -+ amvdec_am21c_body_size(vp9->width, vp9->height) >> 5); -+ } -+ -+ amvdec_write_dos(core, VP9D_MPP_REF_SCALE_ENBL, 0); -+} -+ -+static struct vp9_frame *codec_vp9_get_new_frame(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ union rpm_param *param = &vp9->rpm_param; -+ struct vb2_v4l2_buffer *vbuf; -+ struct vp9_frame *new_frame; -+ -+ new_frame = kzalloc(sizeof(*new_frame), GFP_KERNEL); -+ if (!new_frame) -+ return NULL; -+ -+ vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); -+ if (!vbuf) { -+ dev_err(sess->core->dev, "No dst buffer available\n"); -+ kfree(new_frame); -+ return NULL; -+ } -+ -+ while (codec_vp9_get_frame_by_idx(vp9, vbuf->vb2_buf.index)) { -+ struct vb2_v4l2_buffer *old_vbuf = vbuf; -+ vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); -+ v4l2_m2m_buf_queue(sess->m2m_ctx, old_vbuf); -+ if (!vbuf) { -+ dev_err(sess->core->dev, "No dst buffer available\n"); -+ kfree(new_frame); -+ return NULL; -+ } -+ } -+ -+ new_frame->vbuf = vbuf; -+ new_frame->index = vbuf->vb2_buf.index; -+ new_frame->intra_only = param->p.intra_only; -+ new_frame->show = param->p.show_frame; -+ new_frame->type = param->p.frame_type; -+ list_add_tail(&new_frame->list, &vp9->ref_frames_list); -+ vp9->frames_num++; -+ -+ return new_frame; -+} -+ -+static void codec_vp9_show_existing_frame(struct codec_vp9 *vp9) -+{ -+ union rpm_param *param = &vp9->rpm_param; -+ -+ if (!param->p.show_existing_frame) -+ return; -+ -+ printk("showing frame %u\n", param->p.frame_to_show_idx); -+} -+ -+static void codec_vp9_rm_noshow_frame(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ struct vp9_frame *tmp; -+ -+ list_for_each_entry(tmp, &vp9->ref_frames_list, list) { -+ if (tmp->show) -+ continue; -+ -+ printk("rm noshow: %u\n", tmp->index); -+ v4l2_m2m_buf_queue(sess->m2m_ctx, tmp->vbuf); -+ list_del(&tmp->list); -+ kfree(tmp); -+ vp9->frames_num--; -+ return; -+ } -+} -+ -+static void codec_vp9_process_frame(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_vp9 *vp9 = sess->priv; -+ union rpm_param *param = &vp9->rpm_param; -+ int intra_only; -+ -+ if (!param->p.show_frame) -+ codec_vp9_rm_noshow_frame(sess); -+ -+ vp9->cur_frame = codec_vp9_get_new_frame(sess); -+ if (!vp9->cur_frame) -+ return; -+ -+ printk("frame type: %08X; show_exist: %u; show: %u, intra_only: %u\n", param->p.frame_type, param->p.show_existing_frame, param->p.show_frame, param->p.intra_only); -+ codec_vp9_sync_ref(vp9); -+ codec_vp9_update_next_ref(vp9); -+ codec_vp9_show_existing_frame(vp9); -+ -+ intra_only = param->p.show_frame ? 0 : param->p.intra_only; -+ /* clear mpred (for keyframe only) */ -+ if (param->p.frame_type != KEY_FRAME && !intra_only) { -+ codec_vp9_set_mc(sess, vp9); -+ codec_vp9_set_mpred_mv(core, vp9); -+ } else { -+ amvdec_clear_dos_bits(core, HEVC_MPRED_CTRL4, BIT(6)); -+ } -+ -+ amvdec_write_dos(core, HEVC_PARSER_PICTURE_SIZE, -+ (vp9->height << 16) | vp9->width); -+ codec_vp9_set_sao(sess, &vp9->cur_frame->vbuf->vb2_buf); -+ -+ vp9_loop_filter_frame_init(core, &vp9->seg_4lf, -+ &vp9->lfi, &vp9->lf, vp9->default_filt_lvl); -+ -+ /* ask uCode to start decoding */ -+ amvdec_write_dos(core, VP9_DEC_STATUS_REG, VP9_10B_DECODE_SLICE); -+} -+ -+static void codec_vp9_process_lf(struct codec_vp9 *vp9) -+{ -+ union rpm_param *param = &vp9->rpm_param; -+ int i; -+ -+ vp9->lf.mode_ref_delta_enabled = param->p.mode_ref_delta_enabled; -+ vp9->lf.sharpness_level = param->p.sharpness_level; -+ vp9->default_filt_lvl = param->p.filter_level; -+ vp9->seg_4lf.enabled = param->p.seg_enabled; -+ vp9->seg_4lf.abs_delta = param->p.seg_abs_delta; -+ -+ for (i = 0; i < 4; i++) -+ vp9->lf.ref_deltas[i] = param->p.ref_deltas[i]; -+ -+ for (i = 0; i < 2; i++) -+ vp9->lf.mode_deltas[i] = param->p.mode_deltas[i]; -+ -+ for (i = 0; i < MAX_SEGMENTS; i++) -+ vp9->seg_4lf.feature_mask[i] = (param->p.seg_lf_info[i] & -+ 0x8000) ? (1 << SEG_LVL_ALT_LF) : 0; -+ -+ for (i = 0; i < MAX_SEGMENTS; i++) -+ vp9->seg_4lf.feature_data[i][SEG_LVL_ALT_LF] -+ = (param->p.seg_lf_info[i] -+ & 0x100) ? -(param->p.seg_lf_info[i] -+ & 0x3f) : (param->p.seg_lf_info[i] & 0x3f); -+} -+ -+static void codec_vp9_resume(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ -+ if (codec_hevc_setup_buffers(sess, vp9->is_10bit)) { -+ amvdec_abort(sess); -+ return; -+ } -+ -+ codec_hevc_setup_decode_head(sess, vp9->is_10bit); -+ codec_vp9_process_lf(vp9); -+ codec_vp9_process_frame(sess); -+} -+ -+/** -+ * The RPM section within the workspace contains -+ * many information regarding the parsed bitstream -+ */ -+static void codec_vp9_fetch_rpm(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ u16 *rpm_vaddr = vp9->workspace_vaddr + RPM_OFFSET; -+ int i, j; -+ -+ for (i = 0; i < RPM_BUF_SIZE; i += 4) -+ for (j = 0; j < 4; j++) -+ vp9->rpm_param.l.data[i + j] = rpm_vaddr[i + 3 - j]; -+} -+ -+static int codec_vp9_process_rpm(struct codec_vp9 *vp9) -+{ -+ union rpm_param *param = &vp9->rpm_param; -+ int src_changed = 0; -+ int is_10bit = 0; -+ int pic_width_64 = ALIGN(param->p.width, 64); -+ int pic_height_32 = ALIGN(param->p.height, 32); -+ int pic_width_lcu = (pic_width_64 % LCU_SIZE) ? -+ pic_width_64 / LCU_SIZE + 1 -+ : pic_width_64 / LCU_SIZE; -+ int pic_height_lcu = (pic_height_32 % LCU_SIZE) ? -+ pic_height_32 / LCU_SIZE + 1 -+ : pic_height_32 / LCU_SIZE; -+ vp9->lcu_total = pic_width_lcu * pic_height_lcu; -+ -+ if (param->p.bit_depth == 10) -+ is_10bit = 1; -+ -+ if (vp9->width != param->p.width || -+ vp9->height != param->p.height || -+ vp9->is_10bit != is_10bit) -+ src_changed = 1; -+ -+ vp9->width = param->p.width; -+ vp9->height = param->p.height; -+ vp9->is_10bit = is_10bit; -+ -+ printk("width: %u; height: %u; is_10bit: %d; src_changed: %d\n", vp9->width, vp9->height, is_10bit, src_changed); -+ return src_changed; -+} -+ -+static bool codec_vp9_is_ref(struct codec_vp9 *vp9, struct vp9_frame *frame) -+{ -+ int i; -+ -+ for (i = 0; i < REFS_PER_FRAME; ++i) -+ if (vp9->frame_refs[i] == frame) -+ return true; -+ -+ return false; -+} -+ -+static void codec_vp9_show_frame(struct amvdec_session *sess) -+{ -+ struct codec_vp9 *vp9 = sess->priv; -+ struct vp9_frame *tmp, *n; -+ -+ list_for_each_entry_safe(tmp, n, &vp9->ref_frames_list, list) { -+ if (!tmp->show || tmp == vp9->cur_frame) -+ continue; -+ -+ if (!tmp->done) { -+ printk("Doning %u\n", tmp->index); -+ amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE); -+ tmp->done = 1; -+ vp9->frames_num--; -+ } -+ -+ if (codec_vp9_is_ref(vp9, tmp)) -+ continue; -+ -+ printk("deleting %d\n", tmp->index); -+ list_del(&tmp->list); -+ kfree(tmp); -+ } -+} -+ -+static irqreturn_t codec_vp9_threaded_isr(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_vp9 *vp9 = sess->priv; -+ u32 dec_status = amvdec_read_dos(core, VP9_DEC_STATUS_REG); -+ u32 prob_status = amvdec_read_dos(core, VP9_ADAPT_PROB_REG); -+ int i; -+ -+ if (!vp9) -+ return IRQ_HANDLED; -+ -+ mutex_lock(&vp9->lock); -+ if (dec_status != VP9_HEAD_PARSER_DONE) { -+ dev_err(core->dev_dec, "Unrecognized dec_status: %08X\n", -+ dec_status); -+ amvdec_abort(sess); -+ goto unlock; -+ } -+ -+ printk("ISR: %08X;%08X\n", dec_status, prob_status); -+ sess->keyframe_found = 1; -+ -+ /* Invalidate first 3 refs */ -+ for (i = 0; i < 3; ++i) -+ vp9->frame_refs[i] = NULL; -+ -+ vp9->prev_frame = vp9->cur_frame; -+ codec_vp9_update_ref(vp9); -+ -+ codec_vp9_fetch_rpm(sess); -+ if (codec_vp9_process_rpm(vp9)) { -+ amvdec_src_change(sess, vp9->width, vp9->height, 16); -+ goto unlock; -+ } -+ -+ codec_vp9_process_lf(vp9); -+ codec_vp9_process_frame(sess); -+ codec_vp9_show_frame(sess); -+ -+unlock: -+ mutex_unlock(&vp9->lock); -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t codec_vp9_isr(struct amvdec_session *sess) -+{ -+ return IRQ_WAKE_THREAD; -+} -+ -+struct amvdec_codec_ops codec_vp9_ops = { -+ .start = codec_vp9_start, -+ .stop = codec_vp9_stop, -+ .isr = codec_vp9_isr, -+ .threaded_isr = codec_vp9_threaded_isr, -+ .num_pending_bufs = codec_vp9_num_pending_bufs, -+ .drain = codec_vp9_flush_output, -+ .resume = codec_vp9_resume, -+}; -diff --git a/drivers/staging/media/meson/vdec/codec_vp9.h b/drivers/staging/media/meson/vdec/codec_vp9.h -new file mode 100644 -index 000000000000..62db65a2b939 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_vp9.h -@@ -0,0 +1,13 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2018 Maxime Jourdan -+ */ -+ -+#ifndef __MESON_VDEC_CODEC_VP9_H_ -+#define __MESON_VDEC_CODEC_VP9_H_ -+ -+#include "vdec.h" -+ -+extern struct amvdec_codec_ops codec_vp9_ops; -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c -index 97a4cd409c5f..12c26d98bd65 100644 ---- a/drivers/staging/media/meson/vdec/esparser.c -+++ b/drivers/staging/media/meson/vdec/esparser.c -@@ -280,7 +280,9 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) - if (codec_ops->num_pending_bufs) - num_dst_bufs = codec_ops->num_pending_bufs(sess); - -- num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx) - 1; -+ num_dst_bufs += v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); -+ if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9) -+ num_dst_bufs -= 2; - - if (esparser_vififo_get_free_space(sess) < payload_size || - atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs) -diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h -index ba49f906be5a..c80479d7c9c3 100644 ---- a/drivers/staging/media/meson/vdec/hevc_regs.h -+++ b/drivers/staging/media/meson/vdec/hevc_regs.h -@@ -120,6 +120,8 @@ - #define HEVC_MPRED_L0_REF00_POC 0xc880 - #define HEVC_MPRED_L1_REF00_POC 0xc8c0 - -+#define HEVC_MPRED_CTRL4 0xc930 -+ - #define HEVC_MPRED_CUR_POC 0xc980 - #define HEVC_MPRED_COL_POC 0xc984 - #define HEVC_MPRED_MV_RD_END_ADDR 0xc988 -@@ -138,6 +140,10 @@ - #define HEVCD_IPP_LINEBUFF_BASE 0xd024 - #define HEVCD_IPP_AXIIF_CONFIG 0xd02c - -+#define VP9D_MPP_REF_SCALE_ENBL 0xd104 -+#define VP9D_MPP_REFINFO_TBL_ACCCONFIG 0xd108 -+#define VP9D_MPP_REFINFO_DATA 0xd10c -+ - #define HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR 0xd180 - #define HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR 0xd184 - #define HEVCD_MPP_ANC2AXI_TBL_DATA 0xd190 -@@ -162,6 +168,7 @@ - #define HEVC_DBLK_CFG9 0xd424 - #define HEVC_DBLK_CFGA 0xd428 - #define HEVC_DBLK_STS0 0xd42c -+#define HEVC_DBLK_CFGB 0xd42c - #define HEVC_DBLK_STS1 0xd430 - - #define HEVC_SAO_VERSION 0xd800 -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -index 7318d7102874..3c51bf991a3b 100644 ---- a/drivers/staging/media/meson/vdec/vdec_platform.c -+++ b/drivers/staging/media/meson/vdec/vdec_platform.c -@@ -14,6 +14,7 @@ - #include "codec_mpeg4.h" - #include "codec_mjpeg.h" - #include "codec_hevc.h" -+#include "codec_vp9.h" - - static const struct amvdec_format vdec_formats_gxbb[] = { - { -@@ -100,6 +101,17 @@ static const struct amvdec_format vdec_formats_gxbb[] = { - }; - - static const struct amvdec_format vdec_formats_gxl[] = { -+ { -+ .pixfmt = V4L2_PIX_FMT_VP9, -+ .min_buffers = 16, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_vp9_ops, -+ .firmware_path = "meson/gx/vvp9_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, - { - .pixfmt = V4L2_PIX_FMT_HEVC, - .min_buffers = 16, -@@ -184,6 +196,17 @@ static const struct amvdec_format vdec_formats_gxl[] = { - }; - - static const struct amvdec_format vdec_formats_gxm[] = { -+ { -+ .pixfmt = V4L2_PIX_FMT_VP9, -+ .min_buffers = 16, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_vp9_ops, -+ .firmware_path = "meson/gx/vvp9_mc", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, - { - .pixfmt = V4L2_PIX_FMT_HEVC, - .min_buffers = 16, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch b/packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch new file mode 100644 index 0000000000..d6b92432d6 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch @@ -0,0 +1,43 @@ +From 9ec6b55b58f139de946d00bac39e0b650da1f476 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 28 Feb 2020 19:10:01 +0000 +Subject: [PATCH 126/146] FROMLIST: dt-bindings: arm: amlogic: add support for + the Smartlabs SML-5442TW + +The SML-5442TW is an STB for O2 Czech IPTV/VOD and DVB-T/T2 based on the +Amlogic P231 reference design using the S905D chipset. Specs: + +2GB DDR3 RAM +8GB eMMC storage +10/100 Base-T Ethernet +802.11 a/b/g/n/ac + BT 4.1 HS sdio wireless module (QCA9377) +2x single colour and 1x dual colour LEDs on the front panel +1x reset button on the front panel +HDMI 2.0 (4k@60p) video +Composite video + 2-channel audio output on 3.5mm jack +S/PDIF audio output +Single DVB-T/T2 tuner (AVL6762/MxL608) +2x USB 2.0 ports +1x micro SD card slot +UART pins (internal) + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml +index f74aba48cec1..c0c0f6619fb3 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -107,6 +107,7 @@ properties: + - amlogic,p231 + - libretech,aml-s905d-pc + - phicomm,n1 ++ - smartlabs,sml5442tw + - const: amlogic,s905d + - const: amlogic,meson-gxl + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0126-TEMP-media-meson-vdec-add-g12a-platform.patch b/packages/linux/patches/amlogic/amlogic-0126-TEMP-media-meson-vdec-add-g12a-platform.patch deleted file mode 100644 index 093657f400..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0126-TEMP-media-meson-vdec-add-g12a-platform.patch +++ /dev/null @@ -1,458 +0,0 @@ -From b6827348199cda17b5856ebf857d4d352fac1de3 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Thu, 7 Feb 2019 17:37:34 +0100 -Subject: [PATCH 126/187] TEMP: media: meson: vdec: add g12a platform - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/codec_hevc.c | 38 +++++-- - .../media/meson/vdec/codec_hevc_common.c | 9 -- - drivers/staging/media/meson/vdec/codec_vp9.c | 54 ++++++++-- - drivers/staging/media/meson/vdec/hevc_regs.h | 1 + - drivers/staging/media/meson/vdec/vdec.c | 13 ++- - drivers/staging/media/meson/vdec/vdec.h | 1 + - drivers/staging/media/meson/vdec/vdec_hevc.c | 9 ++ - .../staging/media/meson/vdec/vdec_platform.c | 101 ++++++++++++++++++ - .../staging/media/meson/vdec/vdec_platform.h | 2 + - 9 files changed, 204 insertions(+), 24 deletions(-) - -diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c -index 03f00f969f02..e16e937d56e8 100644 ---- a/drivers/staging/media/meson/vdec/codec_hevc.c -+++ b/drivers/staging/media/meson/vdec/codec_hevc.c -@@ -68,7 +68,8 @@ - #define SWAP_BUF2_SIZE 0x800 - #define SCALELUT_SIZE 0x8000 - #define DBLK_PARA_SIZE 0x20000 --#define DBLK_DATA_SIZE 0x40000 -+#define DBLK_DATA_SIZE 0x80000 -+#define DBLK_DATA2_SIZE 0x80000 - #define MMU_VBH_SIZE 0x5000 - #define MPRED_ABV_SIZE 0x8000 - #define MPRED_MV_SIZE (MPRED_MV_BUF_SIZE * MAX_REF_PIC_NUM) -@@ -88,7 +89,8 @@ - #define SCALELUT_OFFSET (SWAP_BUF2_OFFSET + SWAP_BUF2_SIZE) - #define DBLK_PARA_OFFSET (SCALELUT_OFFSET + SCALELUT_SIZE) - #define DBLK_DATA_OFFSET (DBLK_PARA_OFFSET + DBLK_PARA_SIZE) --#define MMU_VBH_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) -+#define DBLK_DATA2_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) -+#define MMU_VBH_OFFSET (DBLK_DATA2_OFFSET + DBLK_DATA2_SIZE) - #define MPRED_ABV_OFFSET (MMU_VBH_OFFSET + MMU_VBH_SIZE) - #define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) - #define RPM_OFFSET (MPRED_MV_OFFSET + MPRED_MV_SIZE) -@@ -523,6 +525,7 @@ codec_hevc_setup_workspace(struct amvdec_core *core, struct codec_hevc *hevc) - amvdec_write_dos(core, HEVC_SCALELUT, wkaddr + SCALELUT_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); -+ amvdec_write_dos(core, HEVC_DBLK_CFGE, wkaddr + DBLK_DATA2_OFFSET); - - return 0; - } -@@ -547,6 +550,8 @@ static int codec_hevc_start(struct amvdec_session *sess) - goto free_hevc; - - amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); -+ if (core->platform->revision == VDEC_REVISION_G12A) -+ amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, (0xf << 25)); - - val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x03ffffff; - val |= (3 << 29) | BIT(27) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | -@@ -755,6 +760,25 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - (amvdec_get_output_size(sess) / 2)); - - if (frame->cur_slice_idx == 0) { -+ if (core->platform->revision >= VDEC_REVISION_G12A) { -+ val = 0x54 << 8; -+ -+ /* enable first, compressed write */ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) -+ val |= BIT(8); -+ -+ /* enable second, uncompressed write */ -+ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) -+ val |= BIT(9); -+ -+ /* dblk pipeline mode=1 for performance */ -+ if (hevc->width >= 1280) -+ val |= BIT(4); -+ -+ amvdec_write_dos(core, HEVC_DBLK_CFGB, val); -+ amvdec_write_dos(core, HEVC_DBLK_STS1 + 4, BIT(28)); -+ } -+ - amvdec_write_dos(core, HEVC_DBLK_CFG2, - hevc->width | (hevc->height << 16)); - -@@ -770,10 +794,12 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - - val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff3; - val |= 0xff0; /* Set endianness for 2-bytes swaps (nv12) */ -- if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) -- val |= BIT(0); /* disable cm compression */ -- else if (sess->pixfmt_cap == V4L2_PIX_FMT_AM21C) -- val |= BIT(1); /* Disable double write */ -+ if (core->platform->revision < VDEC_REVISION_G12A) { -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) -+ val |= BIT(0); /* disable cm compression */ -+ else if (sess->pixfmt_cap == V4L2_PIX_FMT_AM21C) -+ val |= BIT(1); /* Disable double write */ -+ } - - amvdec_write_dos(core, HEVC_SAO_CTRL1, val); - -diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c -index 2b296beb5d88..5c372a9b0f03 100644 ---- a/drivers/staging/media/meson/vdec/codec_hevc_common.c -+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c -@@ -111,15 +111,6 @@ codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, int is_10bit) - } - } - -- /* Fill the remaining unused slots with the last buffer's Y addr */ -- for (i = buf_num; i < MAX_REF_PIC_NUM; ++i) { -- amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, -- buf_y_paddr >> 5); -- if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) -- amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, -- buf_uv_paddr >> 5); -- } -- - amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 1); - amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); - for (i = 0; i < 32; ++i) -diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c -index 731119b9ee17..39e8eb5937bf 100644 ---- a/drivers/staging/media/meson/vdec/codec_vp9.c -+++ b/drivers/staging/media/meson/vdec/codec_vp9.c -@@ -90,8 +90,8 @@ enum FRAME_TYPE { - #define DBLK_PARA_OFFSET (SCALELUT_OFFSET + SCALELUT_SIZE) - #define DBLK_DATA_OFFSET (DBLK_PARA_OFFSET + DBLK_PARA_SIZE) - #define SEG_MAP_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) --#define PROB_OFFSET (SEG_MAP_OFFSET + SEG_MAP_SIZE) --#define COUNT_OFFSET (PROB_OFFSET + PROB_SIZE) -+#define PROB_OFFSET (SEG_MAP_OFFSET + SEG_MAP_SIZE) -+#define COUNT_OFFSET (PROB_OFFSET + PROB_SIZE) - #define MMU_VBH_OFFSET (COUNT_OFFSET + COUNT_SIZE) - #define MPRED_ABV_OFFSET (MMU_VBH_OFFSET + MMU_VBH_SIZE) - #define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) -@@ -326,7 +326,11 @@ vp9_loop_filter_init(struct amvdec_core *core, struct codec_vp9 *vp9) - amvdec_write_dos(core, HEVC_DBLK_CFG9, thr); - } - -- amvdec_write_dos(core, HEVC_DBLK_CFGB, 0x40400001); -+ if (core->platform->revision == VDEC_REVISION_G12A) -+ /* VP9 video format */ -+ amvdec_write_dos(core, HEVC_DBLK_CFGB, (0x54 << 8) | BIT(0)); -+ else -+ amvdec_write_dos(core, HEVC_DBLK_CFGB, 0x40400001); - } - - static void -@@ -447,6 +451,13 @@ codec_vp9_setup_workspace(struct amvdec_core *core, struct codec_vp9 *vp9) - return -ENOMEM; - } - -+ memset(vp9->workspace_vaddr + DBLK_PARA_OFFSET, 0, DBLK_PARA_SIZE); -+ memset(vp9->workspace_vaddr + COUNT_OFFSET, 0, COUNT_SIZE); -+ memset(vp9->workspace_vaddr + PROB_OFFSET, 0, PROB_SIZE); -+ -+ printk("Workspace: %08X-%08X\n", wkaddr, wkaddr + SIZE_WORKSPACE); -+ printk("DBLK_PARA: %08X\n", wkaddr + DBLK_PARA_OFFSET); -+ - vp9->workspace_paddr = wkaddr; - - amvdec_write_dos(core, HEVCD_IPP_LINEBUFF_BASE, wkaddr + IPP_OFFSET); -@@ -461,11 +472,17 @@ codec_vp9_setup_workspace(struct amvdec_core *core, struct codec_vp9 *vp9) - amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER2, - wkaddr + SWAP_BUF2_OFFSET); - amvdec_write_dos(core, VP9_SCALELUT, wkaddr + SCALELUT_OFFSET); -+ -+ if (core->platform->revision == VDEC_REVISION_G12A) -+ amvdec_write_dos(core, HEVC_DBLK_CFGE, -+ wkaddr + DBLK_PARA_OFFSET); -+ - amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); - amvdec_write_dos(core, VP9_SEG_MAP_BUFFER, wkaddr + SEG_MAP_OFFSET); - amvdec_write_dos(core, VP9_PROB_SWAP_BUFFER, wkaddr + PROB_OFFSET); - amvdec_write_dos(core, VP9_COUNT_SWAP_BUFFER, wkaddr + COUNT_OFFSET); -+ amvdec_write_dos(core, LMEM_DUMP_ADR, wkaddr + LMEM_OFFSET); - - return 0; - } -@@ -487,6 +504,9 @@ static int codec_vp9_start(struct amvdec_session *sess) - goto free_vp9; - - amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); -+ // stream_fifo_hole -+ if (core->platform->revision == VDEC_REVISION_G12A) -+ amvdec_write_dos_bits(core, HEVC_STREAM_FIFO_CTL, BIT(29)); - - val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x7fffffff; - val |= (3 << 29) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | BIT(0); -@@ -597,14 +617,34 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb - amvdec_write_dos(core, HEVC_SAO_C_LENGTH, - (amvdec_get_output_size(sess) / 2)); - -+ if (core->platform->revision >= VDEC_REVISION_G12A) { -+ amvdec_clear_dos_bits(core, HEVC_DBLK_CFGB, BIT(4) | BIT(5) | BIT(8) | BIT(9)); -+ /* enable first, compressed write */ -+ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) -+ amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(8)); -+ -+ /* enable second, uncompressed write */ -+ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) -+ amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(9)); -+ -+ /* dblk pipeline mode=1 for performance */ -+ if (sess->width >= 1280) -+ amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(4)); -+ -+ printk("HEVC_DBLK_CFGB: %08X\n", amvdec_read_dos(core, HEVC_DBLK_CFGB)); -+ } -+ - val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff3; - val |= 0xff0; /* Set endianness for 2-bytes swaps (nv12) */ -- if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) -- val |= BIT(0); /* disable cm compression */ -- else if (sess->pixfmt_cap == V4L2_PIX_FMT_AM21C) -- val |= BIT(1); /* Disable double write */ -+ if (core->platform->revision < VDEC_REVISION_G12A) { -+ if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) -+ val |= BIT(0); /* disable cm compression */ -+ else if (sess->pixfmt_cap == V4L2_PIX_FMT_AM21C) -+ val |= BIT(1); /* Disable double write */ -+ } - - amvdec_write_dos(core, HEVC_SAO_CTRL1, val); -+ printk("HEVC_SAO_CTRL1: %08X\n", val); - - if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { - /* no downscale for NV12 */ -diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h -index c80479d7c9c3..dc2c2e085b05 100644 ---- a/drivers/staging/media/meson/vdec/hevc_regs.h -+++ b/drivers/staging/media/meson/vdec/hevc_regs.h -@@ -170,6 +170,7 @@ - #define HEVC_DBLK_STS0 0xd42c - #define HEVC_DBLK_CFGB 0xd42c - #define HEVC_DBLK_STS1 0xd430 -+#define HEVC_DBLK_CFGE 0xd438 - - #define HEVC_SAO_VERSION 0xd800 - #define HEVC_SAO_CTRL0 0xd804 -diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c -index c3415db2b15b..4b4c252a62e8 100644 ---- a/drivers/staging/media/meson/vdec/vdec.c -+++ b/drivers/staging/media/meson/vdec/vdec.c -@@ -968,6 +968,8 @@ static const struct of_device_id vdec_dt_match[] = { - .data = &vdec_platform_gxm }, - { .compatible = "amlogic,gxl-vdec", - .data = &vdec_platform_gxl }, -+ { .compatible = "amlogic,g12a-vdec", -+ .data = &vdec_platform_g12a }, - {} - }; - MODULE_DEVICE_TABLE(of, vdec_dt_match); -@@ -1015,6 +1017,15 @@ static int vdec_probe(struct platform_device *pdev) - if (IS_ERR(core->canvas)) - return PTR_ERR(core->canvas); - -+ of_id = of_match_node(vdec_dt_match, dev->of_node); -+ core->platform = of_id->data; -+ -+ if (core->platform->revision == VDEC_REVISION_G12A) { -+ core->vdec_hevcf_clk = devm_clk_get(dev, "vdec_hevcf"); -+ if (IS_ERR(core->vdec_hevcf_clk)) -+ return -EPROBE_DEFER; -+ } -+ - core->dos_parser_clk = devm_clk_get(dev, "dos_parser"); - if (IS_ERR(core->dos_parser_clk)) - return -EPROBE_DEFER; -@@ -1057,8 +1068,6 @@ static int vdec_probe(struct platform_device *pdev) - goto err_vdev_release; - } - -- of_id = of_match_node(vdec_dt_match, dev->of_node); -- core->platform = of_id->data; - core->vdev_dec = vdev; - core->dev_dec = dev; - mutex_init(&core->lock); -diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h -index 210ab4b755fe..95415212b282 100644 ---- a/drivers/staging/media/meson/vdec/vdec.h -+++ b/drivers/staging/media/meson/vdec/vdec.h -@@ -76,6 +76,7 @@ struct amvdec_core { - struct clk *dos_clk; - struct clk *vdec_1_clk; - struct clk *vdec_hevc_clk; -+ struct clk *vdec_hevcf_clk; - - struct reset_control *esparser_reset; - -diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c -index b1406a5638da..730ecd771643 100644 ---- a/drivers/staging/media/meson/vdec/vdec_hevc.c -+++ b/drivers/staging/media/meson/vdec/vdec_hevc.c -@@ -123,6 +123,8 @@ static int vdec_hevc_stop(struct amvdec_session *sess) - regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, - GEN_PWR_VDEC_HEVC, GEN_PWR_VDEC_HEVC); - -+ if (core->platform->revision == VDEC_REVISION_G12A) -+ clk_disable_unprepare(core->vdec_hevcf_clk); - clk_disable_unprepare(core->vdec_hevc_clk); - - return 0; -@@ -139,6 +141,13 @@ static int vdec_hevc_start(struct amvdec_session *sess) - if (ret) - return ret; - -+ if (core->platform->revision == VDEC_REVISION_G12A) { -+ clk_set_rate(core->vdec_hevcf_clk, 666666666); -+ ret = clk_prepare_enable(core->vdec_hevcf_clk); -+ if (ret) -+ return ret; -+ } -+ - regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, - GEN_PWR_VDEC_HEVC, 0); - udelay(10); -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -index 3c51bf991a3b..a1812520421b 100644 ---- a/drivers/staging/media/meson/vdec/vdec_platform.c -+++ b/drivers/staging/media/meson/vdec/vdec_platform.c -@@ -290,6 +290,101 @@ static const struct amvdec_format vdec_formats_gxm[] = { - }, - }; - -+static const struct amvdec_format vdec_formats_g12a[] = { -+ { -+ .pixfmt = V4L2_PIX_FMT_VP9, -+ .min_buffers = 4, -+ .max_buffers = 16, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_vp9_ops, -+ .firmware_path = "meson/vdec/g12a_vp9.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, -+ { -+ .pixfmt = V4L2_PIX_FMT_HEVC, -+ .min_buffers = 16, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_hevc_ops, -+ .codec_ops = &codec_hevc_ops, -+ .firmware_path = "meson/vdec/g12a_hevc.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_AM21C, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_MJPEG, -+ .min_buffers = 4, -+ .max_buffers = 4, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mjpeg_ops, -+ .firmware_path = "meson/vdec/gxl_mjpeg.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_MPEG4, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/vdec/gxl_mpeg4_5.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_H263, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/vdec/gxl_h263.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_XVID, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg4_ops, -+ .firmware_path = "meson/vdec/gxl_mpeg4_5.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_H264, -+ .min_buffers = 2, -+ .max_buffers = 24, -+ .max_width = 3840, -+ .max_height = 2160, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_h264_ops, -+ .firmware_path = "meson/vdec/g12a_h264.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_MPEG1, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg12_ops, -+ .firmware_path = "meson/vdec/gxl_mpeg12.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, { -+ .pixfmt = V4L2_PIX_FMT_MPEG2, -+ .min_buffers = 8, -+ .max_buffers = 8, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_mpeg12_ops, -+ .firmware_path = "meson/vdec/gxl_mpeg12.bin", -+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 }, -+ }, -+}; -+ - const struct vdec_platform vdec_platform_gxbb = { - .formats = vdec_formats_gxbb, - .num_formats = ARRAY_SIZE(vdec_formats_gxbb), -@@ -307,3 +402,9 @@ const struct vdec_platform vdec_platform_gxm = { - .num_formats = ARRAY_SIZE(vdec_formats_gxm), - .revision = VDEC_REVISION_GXM, - }; -+ -+const struct vdec_platform vdec_platform_g12a = { -+ .formats = vdec_formats_g12a, -+ .num_formats = ARRAY_SIZE(vdec_formats_g12a), -+ .revision = VDEC_REVISION_G12A, -+}; -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.h b/drivers/staging/media/meson/vdec/vdec_platform.h -index f6025326db1d..7c61b941b39f 100644 ---- a/drivers/staging/media/meson/vdec/vdec_platform.h -+++ b/drivers/staging/media/meson/vdec/vdec_platform.h -@@ -15,6 +15,7 @@ enum vdec_revision { - VDEC_REVISION_GXBB, - VDEC_REVISION_GXL, - VDEC_REVISION_GXM, -+ VDEC_REVISION_G12A, - }; - - struct vdec_platform { -@@ -26,5 +27,6 @@ struct vdec_platform { - extern const struct vdec_platform vdec_platform_gxbb; - extern const struct vdec_platform vdec_platform_gxm; - extern const struct vdec_platform vdec_platform_gxl; -+extern const struct vdec_platform vdec_platform_g12a; - - #endif --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0127-FROMLIST-arm64-dts-meson-add-support-for-the-Smartla.patch b/packages/linux/patches/amlogic/amlogic-0127-FROMLIST-arm64-dts-meson-add-support-for-the-Smartla.patch new file mode 100644 index 0000000000..56e633381c --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0127-FROMLIST-arm64-dts-meson-add-support-for-the-Smartla.patch @@ -0,0 +1,429 @@ +From 09229328d9a37131993ac278e674d6ac8cca0c17 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 28 Feb 2020 19:16:35 +0000 +Subject: [PATCH 127/146] FROMLIST: arm64: dts: meson: add support for the + Smartlabs SML-5442TW + +The Smartlabs SML-5442TW is broadly similar to the P231 reference design +but with the following differences: + +- The Yellow and Blue LEDs are available but disabled +- The Red and Green LEDs are used to signal off/on status +- uart_AO can be accessed after opening the case; soldered pins exist +- GPIOX_17 is forced high to enable the QCA9377 module (there are no + device-tree bindings to do this at this time). + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../dts/amlogic/meson-gxl-s905d-sml5442tw.dts | 386 ++++++++++++++++++ + 2 files changed, 387 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index eef0045320f2..6cf8c4ac0390 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -27,6 +27,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p230.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p231.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-phicomm-n1.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-sml5442tw.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s805x-p241.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-p281.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-tx3-mini.dtb +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts +new file mode 100644 +index 000000000000..3ad53f794320 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts +@@ -0,0 +1,386 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2016 Endless Computers, Inc. ++ * Author: Carlo Caione ++ * Copyright (c) 2018 BayLibre, SAS ++ * Author: Neil Armstrong ++ */ ++ ++/dts-v1/; ++ ++#include "meson-gxl-s905d.dtsi" ++#include ++ ++/ { ++ compatible = "smartlabs,sml5442tw", "amlogic,s905d", ++ "amlogic,meson-gxl"; ++ model = "SmartLabs SML-5442TW"; ++ ++ aliases { ++ serial0 = &uart_AO; ++ serial1 = &uart_A; ++ ethernet0 = ðmac; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x80000000>; ++ }; ++ ++ dio2133: analog-amplifier { ++ compatible = "simple-audio-amplifier"; ++ sound-name-prefix = "AU2"; ++ VCC-supply = <&hdmi_5v>; ++ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ yellow { ++ label = "sml5442tw:yellow"; ++ gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ ++ blue { ++ label = "sml5442tw:blue"; ++ gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ ++ green { ++ label = "sml5442tw:green"; ++ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ ++ red { ++ label = "sml5442tw:red"; ++ gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ }; ++ ++ hdmi_5v: regulator-hdmi-5v { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "HDMI_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ ++ gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-always-on; ++ }; ++ ++ vddio_ao18: regulator-vddio_ao18 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDIO_AO18"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ vddio_boot: regulator-vddio_boot { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDIO_BOOT"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ vddao_3v3: regulator-vddao_3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDAO_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc_3v3: regulator-vcc_3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wifi32k: wifi32k { ++ compatible = "pwm-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; ++ clocks = <&wifi32k>; ++ clock-names = "ext_clock"; ++ }; ++ ++ cvbs-connector { ++ compatible = "composite-video-connector"; ++ ++ port { ++ cvbs_connector_in: endpoint { ++ remote-endpoint = <&cvbs_vdac_out>; ++ }; ++ }; ++ }; ++ ++ hdmi-connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-S905D-SML5442TW"; ++ audio-aux-devs = <&dio2133>; ++ audio-widgets = "Line", "Lineout"; ++ audio-routing = "AU2 INL", "ACODEC LOLP", ++ "AU2 INR", "ACODEC LORP", ++ "AU2 INL", "ACODEC LOLN", ++ "AU2 INR", "ACODEC LORN", ++ "Lineout", "AU2 OUTL", ++ "Lineout", "AU2 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 = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-3 { ++ sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ ++ dai-link-4 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ ++ dai-link-5 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&acodec>; ++ }; ++ }; ++ }; ++}; ++ ++&acodec { ++ AVDD-supply = <&vddio_ao18>; ++ status = "okay"; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_h_pins>; ++ pinctrl-names = "default"; ++ ++}; ++ ++&cec_AO { ++ status = "okay"; ++ pinctrl-0 = <&ao_cec_pins>; ++ pinctrl-names = "default"; ++ hdmi-phandle = <&hdmi_tx>; ++}; ++ ++&cvbs_vdac_port { ++ cvbs_vdac_out: endpoint { ++ remote-endpoint = <&cvbs_connector_in>; ++ }; ++}; ++ ++ðmac { ++ status = "okay"; ++ phy-mode = "rmii"; ++ phy-handle = <&internal_phy>; ++}; ++ ++/* This will enable the bluetooth module */ ++&gpio { ++ bt-en { ++ gpio-hog; ++ gpios = ; ++ output-high; ++ line-name = "bt-en"; ++ }; ++}; ++ ++&hdmi_tx { ++ status = "okay"; ++ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; ++ pinctrl-names = "default"; ++ hdmi-supply = <&hdmi_5v>; ++}; ++ ++&hdmi_tx_tmds_port { ++ hdmi_tx_tmds_out: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&i2c_A { ++ status = "okay"; ++ pinctrl-0 = <&i2c_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&internal_phy { ++ pinctrl-0 = <ð_link_led_pins>, <ð_act_led_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&ir { ++ status = "okay"; ++ pinctrl-0 = <&remote_input_ao_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&pwm_ef { ++ status = "okay"; ++ pinctrl-0 = <&pwm_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&clkc CLKID_FCLK_DIV4>; ++ clock-names = "clkin0"; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vddio_ao18>; ++}; ++ ++/* Wireless SDIO Module */ ++&sd_emmc_a { ++ status = "okay"; ++ pinctrl-0 = <&sdio_pins>; ++ pinctrl-1 = <&sdio_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ bus-width = <4>; ++ cap-sd-highspeed; ++ max-frequency = <100000000>; ++ ++ non-removable; ++ disable-wp; ++ ++ mmc-pwrseq = <&sdio_pwrseq>; ++ ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddio_boot>; ++}; ++ ++/* SD card */ ++&sd_emmc_b { ++ status = "okay"; ++ pinctrl-0 = <&sdcard_pins>; ++ pinctrl-1 = <&sdcard_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <4>; ++ cap-sd-highspeed; ++ max-frequency = <100000000>; ++ disable-wp; ++ ++ cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; ++ cd-inverted; ++ ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddio_boot>; ++}; ++ ++/* eMMC */ ++&sd_emmc_c { ++ status = "okay"; ++ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; ++ pinctrl-1 = <&emmc_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ max-frequency = <100000000>; ++ non-removable; ++ disable-wp; ++ mmc-ddr-1_8v; ++ mmc-hs200-1_8v; ++ ++ mmc-pwrseq = <&emmc_pwrseq>; ++ vmmc-supply = <&vcc_3v3>; ++ vqmmc-supply = <&vddio_boot>; ++}; ++ ++/* This is connected to the Bluetooth module: */ ++&uart_A { ++ status = "okay"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++}; ++ ++/* This UART is brought out to the debug header */ ++&uart_AO { ++ status = "okay"; ++ pinctrl-0 = <&uart_ao_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&usb0 { ++ status = "okay"; ++}; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0127-TEMP-media-meson-vp9-add-IOMMU-support.patch b/packages/linux/patches/amlogic/amlogic-0127-TEMP-media-meson-vp9-add-IOMMU-support.patch deleted file mode 100644 index 95a888acc0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0127-TEMP-media-meson-vp9-add-IOMMU-support.patch +++ /dev/null @@ -1,773 +0,0 @@ -From f88d70f37500745b200c811867d4f11e2a3279dc Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Fri, 1 Mar 2019 12:41:03 +0100 -Subject: [PATCH 127/187] TEMP: media: meson: vp9: add IOMMU support - -Starting with GXL (S905X), the HEVC/VP9 decoder hardware supports an -IOMMU to access the decoded frames. This IOMMU is controlled by writing -the buffer's page IDs to the firmware, which then does the actual work. - -This commit adds support for using the IOMMU with VP9/HEVC on G12A, the -first SoC on which it becomes mandatory. - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/codec_hevc.c | 35 ++-- - .../media/meson/vdec/codec_hevc_common.c | 177 ++++++++++++++---- - .../media/meson/vdec/codec_hevc_common.h | 31 ++- - drivers/staging/media/meson/vdec/codec_vp9.c | 71 ++++--- - drivers/staging/media/meson/vdec/hevc_regs.h | 5 + - drivers/staging/media/meson/vdec/vdec.h | 5 - - drivers/staging/media/meson/vdec/vdec_hevc.c | 14 +- - 7 files changed, 255 insertions(+), 83 deletions(-) - -diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c -index e16e937d56e8..65d2ad4d8345 100644 ---- a/drivers/staging/media/meson/vdec/codec_hevc.c -+++ b/drivers/staging/media/meson/vdec/codec_hevc.c -@@ -75,6 +75,7 @@ - #define MPRED_MV_SIZE (MPRED_MV_BUF_SIZE * MAX_REF_PIC_NUM) - #define RPM_BUF_SIZE 0x100 - #define LMEM_SIZE 0xA00 -+#define MMU_MAP_SIZE 0x4800 - - #define IPP_OFFSET 0x00 - #define SAO_ABV_OFFSET (IPP_OFFSET + IPP_SIZE) -@@ -95,6 +96,7 @@ - #define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) - #define RPM_OFFSET (MPRED_MV_OFFSET + MPRED_MV_SIZE) - #define LMEM_OFFSET (RPM_OFFSET + RPM_BUF_SIZE) -+#define MMU_MAP_OFFSET (LMEM_OFFSET + LMEM_SIZE) - - /* ISR decode status */ - #define HEVC_DEC_IDLE 0x0 -@@ -236,6 +238,9 @@ struct hevc_frame { - struct codec_hevc { - struct mutex lock; - -+ /* Common part of the HEVC decoder */ -+ struct codec_hevc_common common; -+ - /* Buffer for the HEVC Workspace */ - void *workspace_vaddr; - dma_addr_t workspace_paddr; -@@ -517,15 +522,20 @@ codec_hevc_setup_workspace(struct amvdec_core *core, struct codec_hevc *hevc) - amvdec_write_dos(core, HEVC_PPS_BUFFER, wkaddr + PPS_OFFSET); - amvdec_write_dos(core, HEVC_SAO_UP, wkaddr + SAO_UP_OFFSET); - -+ if (core->platform->revision >= VDEC_REVISION_G12A) -+ amvdec_write_dos(core, HEVC_ASSIST_MMU_MAP_ADDR, -+ wkaddr + MMU_MAP_OFFSET); -+ - /* No MMU */ -- amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER, -+ /*amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER, - wkaddr + SWAP_BUF_OFFSET); - amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER2, -- wkaddr + SWAP_BUF2_OFFSET); -+ wkaddr + SWAP_BUF2_OFFSET);*/ - amvdec_write_dos(core, HEVC_SCALELUT, wkaddr + SCALELUT_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFGE, wkaddr + DBLK_DATA2_OFFSET); -+ amvdec_write_dos(core, LMEM_DUMP_ADR, wkaddr + LMEM_OFFSET); - - return 0; - } -@@ -549,9 +559,10 @@ static int codec_hevc_start(struct amvdec_session *sess) - if (ret) - goto free_hevc; - -- amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); -- if (core->platform->revision == VDEC_REVISION_G12A) -- amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, (0xf << 25)); -+ val = BIT(0); /* stream_fetch_enable */ -+ if (core->platform->revision >= VDEC_REVISION_G12A) -+ val |= (0xf << 25); /* arwlen_axi_max */ -+ amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, val); - - val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x03ffffff; - val |= (3 << 29) | BIT(27) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | -@@ -608,9 +619,9 @@ static int codec_hevc_start(struct amvdec_session *sess) - goto free_hevc; - } - -- amvdec_write_dos(core, HEVC_AUX_ADR, hevc->aux_paddr); -+ /*amvdec_write_dos(core, HEVC_AUX_ADR, hevc->aux_paddr); - amvdec_write_dos(core, HEVC_AUX_DATA_SIZE, -- (((SIZE_AUX) >> 4) << 16) | 0); -+ (((SIZE_AUX) >> 4) << 16) | 0);*/ - mutex_init(&hevc->lock); - sess->priv = hevc; - -@@ -652,7 +663,7 @@ static int codec_hevc_stop(struct amvdec_session *sess) - dma_free_coherent(core->dev, SIZE_AUX, - hevc->aux_vaddr, hevc->aux_paddr); - -- codec_hevc_free_fbc_buffers(sess); -+ codec_hevc_free_fbc_buffers(sess, &hevc->common); - mutex_unlock(&hevc->lock); - mutex_destroy(&hevc->lock); - -@@ -732,7 +743,7 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - - if (codec_hevc_use_downsample(sess->pixfmt_cap, hevc->is_10bit)) - buf_y_paddr = -- sess->fbc_buffer_paddr[frame->vbuf->vb2_buf.index]; -+ hevc->common.fbc_buffer_paddr[frame->vbuf->vb2_buf.index]; - else - buf_y_paddr = - vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 0); -@@ -776,7 +787,7 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - val |= BIT(4); - - amvdec_write_dos(core, HEVC_DBLK_CFGB, val); -- amvdec_write_dos(core, HEVC_DBLK_STS1 + 4, BIT(28)); -+ amvdec_write_dos(core, HEVC_DBLK_STS1 + 16, BIT(28)); - } - - amvdec_write_dos(core, HEVC_DBLK_CFG2, -@@ -1323,7 +1334,7 @@ static void codec_hevc_resume(struct amvdec_session *sess) - { - struct codec_hevc *hevc = sess->priv; - -- if (codec_hevc_setup_buffers(sess, hevc->is_10bit)) { -+ if (codec_hevc_setup_buffers(sess, &hevc->common, hevc->is_10bit)) { - amvdec_abort(sess); - return; - } -@@ -1340,6 +1351,8 @@ static irqreturn_t codec_hevc_threaded_isr(struct amvdec_session *sess) - struct codec_hevc *hevc = sess->priv; - u32 dec_status = amvdec_read_dos(core, HEVC_DEC_STATUS_REG); - -+ printk("ISR!\n"); -+ - if (!hevc) - return IRQ_HANDLED; - -diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c -index 5c372a9b0f03..de7eb6cfbe85 100644 ---- a/drivers/staging/media/meson/vdec/codec_hevc_common.c -+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c -@@ -10,6 +10,9 @@ - #include "vdec_helpers.h" - #include "hevc_regs.h" - -+#define MMU_COMPRESS_HEADER_SIZE 0x48000 -+#define MMU_MAP_SIZE 0x4800 -+ - /* Configure decode head read mode */ - void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) - { -@@ -23,7 +26,12 @@ void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) - return; - } - -- amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0); -+ if (codec_hevc_use_mmu(core->platform->revision, -+ sess->pixfmt_cap, is_10bit)) -+ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(4)); -+ else -+ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0); -+ - amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL2, body_size / 32); - amvdec_write_dos(core, HEVC_CM_BODY_LENGTH, body_size); - amvdec_write_dos(core, HEVC_CM_HEADER_OFFSET, body_size); -@@ -31,8 +39,9 @@ void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) - } - EXPORT_SYMBOL_GPL(codec_hevc_setup_decode_head); - --static void --codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, int is_10bit) -+static void codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, -+ struct codec_hevc_common *comm, -+ int is_10bit) - { - struct amvdec_core *core = sess->core; - struct v4l2_m2m_buffer *buf; -@@ -46,22 +55,26 @@ codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, int is_10bit) - amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, 0); - - v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { -- idx = buf->vb.vb2_buf.index; -+ struct vb2_buffer *vb = &buf->vb.vb2_buf; -+ idx = vb->index; - - if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) -- buf_y_paddr = sess->fbc_buffer_paddr[idx]; -+ buf_y_paddr = comm->fbc_buffer_paddr[idx]; - else -- buf_y_paddr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); -+ buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); - - if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { - val = buf_y_paddr | (idx << 8) | 1; -- amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, -+ val); - } else { -- buf_uv_paddr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 1); -+ buf_uv_paddr = vb2_dma_contig_plane_dma_addr(vb, 1); - val = buf_y_paddr | ((idx * 2) << 8) | 1; -- amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, -+ val); - val = buf_uv_paddr | ((idx * 2 + 1) << 8) | 1; -- amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, val); -+ amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CMD_ADDR, -+ val); - } - } - -@@ -80,32 +93,37 @@ codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, int is_10bit) - amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); - } - --static void --codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, int is_10bit) -+static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, -+ struct codec_hevc_common *comm, -+ int is_10bit) - { - struct amvdec_core *core = sess->core; - struct v4l2_m2m_buffer *buf; -- u32 buf_num = v4l2_m2m_num_dst_bufs_ready(sess->m2m_ctx); -- dma_addr_t buf_y_paddr = 0; -- dma_addr_t buf_uv_paddr = 0; -+ u32 revision = core->platform->revision; -+ u32 pixfmt_cap = sess->pixfmt_cap; - int i; - - amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, - BIT(2) | BIT(1)); - - v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { -- u32 idx = buf->vb.vb2_buf.index; -+ struct vb2_buffer *vb = &buf->vb.vb2_buf; -+ dma_addr_t buf_y_paddr = 0; -+ dma_addr_t buf_uv_paddr = 0; -+ u32 idx = vb->index; - -- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) -- buf_y_paddr = sess->fbc_buffer_paddr[idx]; -+ if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit)) -+ buf_y_paddr = comm->mmu_header_paddr[idx]; -+ else if (codec_hevc_use_downsample(pixfmt_cap, is_10bit)) -+ buf_y_paddr = comm->fbc_buffer_paddr[idx]; - else -- buf_y_paddr = -- vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); -+ buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); - - amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, - buf_y_paddr >> 5); -- if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { -- buf_uv_paddr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 1); -+ -+ if (!codec_hevc_use_fbc(pixfmt_cap, is_10bit)) { -+ buf_uv_paddr = vb2_dma_contig_plane_dma_addr(vb, 1); - amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, - buf_uv_paddr >> 5); - } -@@ -117,24 +135,26 @@ codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, int is_10bit) - amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); - } - --void codec_hevc_free_fbc_buffers(struct amvdec_session *sess) -+void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm) - { - struct device *dev = sess->core->dev; - u32 am21_size = amvdec_am21c_size(sess->width, sess->height); - int i; - - for (i = 0; i < MAX_REF_PIC_NUM; ++i) { -- if (sess->fbc_buffer_vaddr[i]) { -+ if (comm->fbc_buffer_vaddr[i]) { - dma_free_coherent(dev, am21_size, -- sess->fbc_buffer_vaddr[i], -- sess->fbc_buffer_paddr[i]); -- sess->fbc_buffer_vaddr[i] = NULL; -+ comm->fbc_buffer_vaddr[i], -+ comm->fbc_buffer_paddr[i]); -+ comm->fbc_buffer_vaddr[i] = NULL; - } - } - } - EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers); - --static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess) -+static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm) - { - struct device *dev = sess->core->dev; - struct v4l2_m2m_buffer *buf; -@@ -147,33 +167,118 @@ static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess) - GFP_KERNEL); - if (!vaddr) { - dev_err(dev, "Couldn't allocate FBC buffer %u\n", idx); -- codec_hevc_free_fbc_buffers(sess); -+ codec_hevc_free_fbc_buffers(sess, comm); -+ return -ENOMEM; -+ } -+ -+ comm->fbc_buffer_vaddr[idx] = vaddr; -+ comm->fbc_buffer_paddr[idx] = paddr; -+ } -+ -+ return 0; -+} -+ -+void codec_hevc_free_mmu_headers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm) -+{ -+ struct device *dev = sess->core->dev; -+ int i; -+ -+ for (i = 0; i < MAX_REF_PIC_NUM; ++i) { -+ if (comm->mmu_header_vaddr[i]) { -+ dma_free_coherent(dev, MMU_COMPRESS_HEADER_SIZE, -+ comm->mmu_header_vaddr[i], -+ comm->mmu_header_paddr[i]); -+ comm->mmu_header_vaddr[i] = NULL; -+ } -+ } -+ -+ if (comm->mmu_map_vaddr) { -+ dma_free_coherent(dev, MMU_MAP_SIZE, -+ comm->mmu_map_vaddr, -+ comm->mmu_map_paddr); -+ comm->mmu_map_vaddr = NULL; -+ } -+} -+EXPORT_SYMBOL_GPL(codec_hevc_free_mmu_headers); -+ -+static int codec_hevc_alloc_mmu_headers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm) -+{ -+ struct device *dev = sess->core->dev; -+ struct v4l2_m2m_buffer *buf; -+ -+ comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE, -+ &comm->mmu_map_paddr, -+ GFP_KERNEL); -+ if (!comm->mmu_map_vaddr) -+ return -ENOMEM; -+ -+ v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { -+ u32 idx = buf->vb.vb2_buf.index; -+ dma_addr_t paddr; -+ void *vaddr = dma_alloc_coherent(dev, MMU_COMPRESS_HEADER_SIZE, -+ &paddr, GFP_KERNEL); -+ if (!vaddr) { -+ dev_err(dev, "Couldn't allocate MMU header %u\n", idx); -+ codec_hevc_free_mmu_headers(sess, comm); - return -ENOMEM; - } - -- sess->fbc_buffer_vaddr[idx] = vaddr; -- sess->fbc_buffer_paddr[idx] = paddr; -+ comm->mmu_header_vaddr[idx] = vaddr; -+ comm->mmu_header_paddr[idx] = paddr; - } - - return 0; - } - --int codec_hevc_setup_buffers(struct amvdec_session *sess, int is_10bit) -+int codec_hevc_setup_buffers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm, -+ int is_10bit) - { - struct amvdec_core *core = sess->core; - int ret; - - if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { -- ret = codec_hevc_alloc_fbc_buffers(sess); -+ ret = codec_hevc_alloc_fbc_buffers(sess, comm); - if (ret) - return ret; - } - -+ if (codec_hevc_use_mmu(core->platform->revision, -+ sess->pixfmt_cap, is_10bit)) { -+ ret = codec_hevc_alloc_mmu_headers(sess, comm); -+ if (ret) { -+ codec_hevc_free_fbc_buffers(sess, comm); -+ return ret; -+ } -+ } -+ - if (core->platform->revision == VDEC_REVISION_GXBB) -- codec_hevc_setup_buffers_gxbb(sess, is_10bit); -+ codec_hevc_setup_buffers_gxbb(sess, comm, is_10bit); - else -- codec_hevc_setup_buffers_gxl(sess, is_10bit); -+ codec_hevc_setup_buffers_gxl(sess, comm, is_10bit); - - return 0; - } --EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers); -\ No newline at end of file -+EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers); -+ -+void codec_hevc_fill_mmu_map(struct amvdec_session *sess, -+ struct codec_hevc_common *comm, -+ struct vb2_buffer *vb) -+{ -+ u32 size = amvdec_am21c_size(sess->width, sess->height); -+ u32 nb_pages = size / PAGE_SIZE; -+ u32 *mmu_map = comm->mmu_map_vaddr; -+ u32 first_page; -+ u32 i; -+ -+ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) -+ first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT; -+ else -+ first_page = vb2_dma_contig_plane_dma_addr(vb, 0) >> PAGE_SHIFT; -+ -+ for (i = 0; i < nb_pages; ++i) -+ mmu_map[i] = first_page + i; -+} -+EXPORT_SYMBOL_GPL(codec_hevc_fill_mmu_map); -diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.h b/drivers/staging/media/meson/vdec/codec_hevc_common.h -index 7c8891529ac8..89c8b61f8a94 100644 ---- a/drivers/staging/media/meson/vdec/codec_hevc_common.h -+++ b/drivers/staging/media/meson/vdec/codec_hevc_common.h -@@ -25,6 +25,19 @@ static const u16 vdec_hevc_parser_cmd[] = { - 0x7C00 - }; - -+#define MAX_REF_PIC_NUM 24 -+ -+struct codec_hevc_common { -+ void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; -+ dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; -+ -+ void *mmu_header_vaddr[MAX_REF_PIC_NUM]; -+ dma_addr_t mmu_header_paddr[MAX_REF_PIC_NUM]; -+ -+ void *mmu_map_vaddr; -+ dma_addr_t mmu_map_paddr; -+}; -+ - /* Returns 1 if we must use framebuffer compression */ - static inline int codec_hevc_use_fbc(u32 pixfmt, int is_10bit) - { -@@ -37,13 +50,27 @@ static inline int codec_hevc_use_downsample(u32 pixfmt, int is_10bit) - return pixfmt == V4L2_PIX_FMT_NV12M && is_10bit; - } - -+/* Returns 1 if we are decoding using the IOMMU */ -+static inline int codec_hevc_use_mmu(u32 revision, u32 pixfmt, int is_10bit) -+{ -+ return revision >= VDEC_REVISION_G12A && -+ codec_hevc_use_fbc(pixfmt, is_10bit); -+} -+ - /** - * Configure decode head read mode - */ - void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit); - --void codec_hevc_free_fbc_buffers(struct amvdec_session *sess); -+void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm); -+ -+int codec_hevc_setup_buffers(struct amvdec_session *sess, -+ struct codec_hevc_common *comm, -+ int is_10bit); - --int codec_hevc_setup_buffers(struct amvdec_session *sess, int is_10bit); -+void codec_hevc_fill_mmu_map(struct amvdec_session *sess, -+ struct codec_hevc_common *comm, -+ struct vb2_buffer *vb); - - #endif -diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c -index 39e8eb5937bf..b1643cc01f68 100644 ---- a/drivers/staging/media/meson/vdec/codec_vp9.c -+++ b/drivers/staging/media/meson/vdec/codec_vp9.c -@@ -219,6 +219,9 @@ struct vp9_frame { - struct codec_vp9 { - struct mutex lock; - -+ /* Common part with the HEVC decoder */ -+ struct codec_hevc_common common; -+ - /* Buffer for the VP9 Workspace */ - void *workspace_vaddr; - dma_addr_t workspace_paddr; -@@ -438,27 +441,26 @@ static u32 codec_vp9_num_pending_bufs(struct amvdec_session *sess) - return vp9->frames_num; - } - --static int --codec_vp9_setup_workspace(struct amvdec_core *core, struct codec_vp9 *vp9) -+static int codec_vp9_alloc_workspace(struct amvdec_core *core, -+ struct codec_vp9 *vp9) - { -- dma_addr_t wkaddr; -- - /* Allocate some memory for the VP9 decoder's state */ - vp9->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, -- &wkaddr, GFP_KERNEL); -+ &vp9->workspace_paddr, GFP_KERNEL); - if (!vp9->workspace_vaddr) { - dev_err(core->dev, "Failed to allocate VP9 Workspace\n"); - return -ENOMEM; - } - -- memset(vp9->workspace_vaddr + DBLK_PARA_OFFSET, 0, DBLK_PARA_SIZE); -- memset(vp9->workspace_vaddr + COUNT_OFFSET, 0, COUNT_SIZE); -- memset(vp9->workspace_vaddr + PROB_OFFSET, 0, PROB_SIZE); -- -- printk("Workspace: %08X-%08X\n", wkaddr, wkaddr + SIZE_WORKSPACE); -- printk("DBLK_PARA: %08X\n", wkaddr + DBLK_PARA_OFFSET); -+ return 0; -+} - -- vp9->workspace_paddr = wkaddr; -+static void codec_vp9_setup_workspace(struct amvdec_session *sess, -+ struct codec_vp9 *vp9) -+{ -+ struct amvdec_core *core = sess->core; -+ u32 revision = core->platform->revision; -+ dma_addr_t wkaddr = vp9->workspace_paddr; - - amvdec_write_dos(core, HEVCD_IPP_LINEBUFF_BASE, wkaddr + IPP_OFFSET); - amvdec_write_dos(core, VP9_RPM_BUFFER, wkaddr + RPM_OFFSET); -@@ -466,7 +468,6 @@ codec_vp9_setup_workspace(struct amvdec_core *core, struct codec_vp9 *vp9) - amvdec_write_dos(core, VP9_PPS_BUFFER, wkaddr + PPS_OFFSET); - amvdec_write_dos(core, VP9_SAO_UP, wkaddr + SAO_UP_OFFSET); - -- /* No MMU */ - amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER, - wkaddr + SWAP_BUF_OFFSET); - amvdec_write_dos(core, VP9_STREAM_SWAP_BUFFER2, -@@ -484,7 +485,19 @@ codec_vp9_setup_workspace(struct amvdec_core *core, struct codec_vp9 *vp9) - amvdec_write_dos(core, VP9_COUNT_SWAP_BUFFER, wkaddr + COUNT_OFFSET); - amvdec_write_dos(core, LMEM_DUMP_ADR, wkaddr + LMEM_OFFSET); - -- return 0; -+ if (codec_hevc_use_mmu(revision, sess->pixfmt_cap, vp9->is_10bit)) { -+ amvdec_write_dos(core, HEVC_SAO_MMU_VH0_ADDR, -+ wkaddr + MMU_VBH_OFFSET); -+ amvdec_write_dos(core, HEVC_SAO_MMU_VH1_ADDR, -+ wkaddr + MMU_VBH_OFFSET + (MMU_VBH_SIZE / 2)); -+ -+ if (revision >= VDEC_REVISION_G12A) -+ amvdec_write_dos(core, HEVC_ASSIST_MMU_MAP_ADDR, -+ vp9->common.mmu_map_paddr); -+ else -+ amvdec_write_dos(core, VP9_MMU_MAP_BUFFER, -+ vp9->common.mmu_map_paddr); -+ } - } - - static int codec_vp9_start(struct amvdec_session *sess) -@@ -499,10 +512,11 @@ static int codec_vp9_start(struct amvdec_session *sess) - if (!vp9) - return -ENOMEM; - -- ret = codec_vp9_setup_workspace(core, vp9); -+ ret = codec_vp9_alloc_workspace(core, vp9); - if (ret) - goto free_vp9; - -+ codec_vp9_setup_workspace(sess, vp9); - amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, BIT(0)); - // stream_fifo_hole - if (core->platform->revision == VDEC_REVISION_G12A) -@@ -575,7 +589,7 @@ static int codec_vp9_stop(struct amvdec_session *sess) - vp9->workspace_vaddr, - vp9->workspace_paddr); - -- codec_hevc_free_fbc_buffers(sess); -+ codec_hevc_free_fbc_buffers(sess, &vp9->common); - return 0; - } - -@@ -590,7 +604,7 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb - - if (codec_hevc_use_downsample(sess->pixfmt_cap, vp9->is_10bit)) - buf_y_paddr = -- sess->fbc_buffer_paddr[vb->index]; -+ vp9->common.fbc_buffer_paddr[vb->index]; - else - buf_y_paddr = - vb2_dma_contig_plane_dma_addr(vb, 0); -@@ -601,6 +615,7 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb - amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); - } - -+ - if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { - buf_y_paddr = - vb2_dma_contig_plane_dma_addr(vb, 0); -@@ -612,13 +627,22 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb - amvdec_write_dos(core, HEVC_SAO_C_WPTR, buf_u_v_paddr); - } - -+ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, -+ vp9->is_10bit)) { -+ amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, -+ vp9->common.mmu_header_paddr[vb->index]); -+ /* use HEVC_CM_HEADER_START_ADDR */ -+ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10)); -+ } -+ - amvdec_write_dos(core, HEVC_SAO_Y_LENGTH, - amvdec_get_output_size(sess)); - amvdec_write_dos(core, HEVC_SAO_C_LENGTH, - (amvdec_get_output_size(sess) / 2)); - - if (core->platform->revision >= VDEC_REVISION_G12A) { -- amvdec_clear_dos_bits(core, HEVC_DBLK_CFGB, BIT(4) | BIT(5) | BIT(8) | BIT(9)); -+ amvdec_clear_dos_bits(core, HEVC_DBLK_CFGB, -+ BIT(4) | BIT(5) | BIT(8) | BIT(9)); - /* enable first, compressed write */ - if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) - amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(8)); -@@ -630,8 +654,6 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb - /* dblk pipeline mode=1 for performance */ - if (sess->width >= 1280) - amvdec_write_dos_bits(core, HEVC_DBLK_CFGB, BIT(4)); -- -- printk("HEVC_DBLK_CFGB: %08X\n", amvdec_read_dos(core, HEVC_DBLK_CFGB)); - } - - val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff3; -@@ -644,7 +666,6 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, struct vb2_buffer *vb - } - - amvdec_write_dos(core, HEVC_SAO_CTRL1, val); -- printk("HEVC_SAO_CTRL1: %08X\n", val); - - if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { - /* no downscale for NV12 */ -@@ -919,6 +940,11 @@ static void codec_vp9_process_frame(struct amvdec_session *sess) - codec_vp9_update_next_ref(vp9); - codec_vp9_show_existing_frame(vp9); - -+ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, -+ vp9->is_10bit)) -+ codec_hevc_fill_mmu_map(sess, &vp9->common, -+ &vp9->cur_frame->vbuf->vb2_buf); -+ - intra_only = param->p.show_frame ? 0 : param->p.intra_only; - /* clear mpred (for keyframe only) */ - if (param->p.frame_type != KEY_FRAME && !intra_only) { -@@ -971,11 +997,12 @@ static void codec_vp9_resume(struct amvdec_session *sess) - { - struct codec_vp9 *vp9 = sess->priv; - -- if (codec_hevc_setup_buffers(sess, vp9->is_10bit)) { -+ if (codec_hevc_setup_buffers(sess, &vp9->common, vp9->is_10bit)) { - amvdec_abort(sess); - return; - } - -+ codec_vp9_setup_workspace(sess, vp9); - codec_hevc_setup_decode_head(sess, vp9->is_10bit); - codec_vp9_process_lf(vp9); - codec_vp9_process_frame(sess); -diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h -index dc2c2e085b05..0392f41a1eed 100644 ---- a/drivers/staging/media/meson/vdec/hevc_regs.h -+++ b/drivers/staging/media/meson/vdec/hevc_regs.h -@@ -6,6 +6,8 @@ - #ifndef __MESON_VDEC_HEVC_REGS_H_ - #define __MESON_VDEC_HEVC_REGS_H_ - -+#define HEVC_ASSIST_MMU_MAP_ADDR 0xc024 -+ - #define HEVC_ASSIST_MBOX1_CLR_REG 0xc1d4 - #define HEVC_ASSIST_MBOX1_MASK 0xc1d8 - -@@ -200,8 +202,11 @@ - #define HEVC_SAO_CTRL7 0xd894 - #define HEVC_CM_BODY_START_ADDR 0xd898 - #define HEVC_CM_BODY_LENGTH 0xd89c -+#define HEVC_CM_HEADER_START_ADDR 0xd8a0 - #define HEVC_CM_HEADER_LENGTH 0xd8a4 - #define HEVC_CM_HEADER_OFFSET 0xd8ac -+#define HEVC_SAO_MMU_VH0_ADDR 0xd8e8 -+#define HEVC_SAO_MMU_VH1_ADDR 0xd8ec - - #define HEVC_IQIT_CLK_RST_CTRL 0xdc00 - #define HEVC_IQIT_SCALELUT_WR_ADDR 0xdc08 -diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h -index 95415212b282..95b4c5761a27 100644 ---- a/drivers/staging/media/meson/vdec/vdec.h -+++ b/drivers/staging/media/meson/vdec/vdec.h -@@ -20,8 +20,6 @@ - /* 32 buffers in 3-plane YUV420 */ - #define MAX_CANVAS (32 * 3) - --#define MAX_REF_PIC_NUM 24 -- - struct amvdec_buffer { - struct list_head list; - struct vb2_buffer *vb; -@@ -261,9 +259,6 @@ struct amvdec_session { - u32 wrap_count; - u32 fw_idx_to_vb2_idx[32]; - -- void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; -- dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; -- - enum amvdec_status status; - void *priv; - }; -diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c -index 730ecd771643..70db09c052c3 100644 ---- a/drivers/staging/media/meson/vdec/vdec_hevc.c -+++ b/drivers/staging/media/meson/vdec/vdec_hevc.c -@@ -123,9 +123,9 @@ static int vdec_hevc_stop(struct amvdec_session *sess) - regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, - GEN_PWR_VDEC_HEVC, GEN_PWR_VDEC_HEVC); - -+ clk_disable_unprepare(core->vdec_hevc_clk); - if (core->platform->revision == VDEC_REVISION_G12A) - clk_disable_unprepare(core->vdec_hevcf_clk); -- clk_disable_unprepare(core->vdec_hevc_clk); - - return 0; - } -@@ -136,11 +136,6 @@ static int vdec_hevc_start(struct amvdec_session *sess) - struct amvdec_core *core = sess->core; - struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; - -- clk_set_rate(core->vdec_hevc_clk, 666666666); -- ret = clk_prepare_enable(core->vdec_hevc_clk); -- if (ret) -- return ret; -- - if (core->platform->revision == VDEC_REVISION_G12A) { - clk_set_rate(core->vdec_hevcf_clk, 666666666); - ret = clk_prepare_enable(core->vdec_hevcf_clk); -@@ -148,6 +143,11 @@ static int vdec_hevc_start(struct amvdec_session *sess) - return ret; - } - -+ clk_set_rate(core->vdec_hevc_clk, 666666666); -+ ret = clk_prepare_enable(core->vdec_hevc_clk); -+ if (ret) -+ return ret; -+ - regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, - GEN_PWR_VDEC_HEVC, 0); - udelay(10); -@@ -177,7 +177,7 @@ static int vdec_hevc_start(struct amvdec_session *sess) - if (ret) - goto stop; - -- amvdec_write_dos(core, DOS_SW_RESET3, BIT(12)|BIT(11)); -+ amvdec_write_dos(core, DOS_SW_RESET3, BIT(12) | BIT(11)); - amvdec_write_dos(core, DOS_SW_RESET3, 0); - amvdec_read_dos(core, DOS_SW_RESET3); - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch b/packages/linux/patches/amlogic/amlogic-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch new file mode 100644 index 0000000000..b0a75b4f97 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch @@ -0,0 +1,29 @@ +From 12d275ed409e3225861d66ee89e415c304cff14e Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 11 Oct 2019 09:01:54 +0000 +Subject: [PATCH 128/146] FROMLIST: dt-bindings: arm: amlogic: add support for + the Beelink GT-King + +The Shenzen AZW (Beelink) GT-King is based on the Amlogic W400 reference +board with an S922X chip. + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml +index c0c0f6619fb3..a96974f81644 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -149,6 +149,7 @@ properties: + - description: Boards with the Amlogic Meson G12B S922X SoC + items: + - enum: ++ - azw,gtking + - hardkernel,odroid-n2 + - khadas,vim3 + - ugoos,am6 +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0128-TEMP-media-meson-vdec-WIP-HEVC-IOMMU-support.patch b/packages/linux/patches/amlogic/amlogic-0128-TEMP-media-meson-vdec-WIP-HEVC-IOMMU-support.patch deleted file mode 100644 index fa40f1d60b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0128-TEMP-media-meson-vdec-WIP-HEVC-IOMMU-support.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 2b38a3ee9b74a3730631c9fedf8971d89ea7068b Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -Date: Wed, 5 Jun 2019 16:14:36 +0200 -Subject: [PATCH 128/187] TEMP: media: meson: vdec: [WIP] HEVC IOMMU support - -Signed-off-by: Maxime Jourdan ---- - drivers/staging/media/meson/vdec/codec_hevc.c | 59 +++++++++++++------ - 1 file changed, 41 insertions(+), 18 deletions(-) - -diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c -index 65d2ad4d8345..20bee7689dbd 100644 ---- a/drivers/staging/media/meson/vdec/codec_hevc.c -+++ b/drivers/staging/media/meson/vdec/codec_hevc.c -@@ -500,8 +500,11 @@ static void codec_hevc_output_frames(struct amvdec_session *sess) - - - static int --codec_hevc_setup_workspace(struct amvdec_core *core, struct codec_hevc *hevc) -+codec_hevc_setup_workspace(struct amvdec_session *sess, -+ struct codec_hevc *hevc) - { -+ struct amvdec_core *core = sess->core; -+ u32 revision = core->platform->revision; - dma_addr_t wkaddr; - - /* Allocate some memory for the HEVC decoder's state */ -@@ -522,19 +525,32 @@ codec_hevc_setup_workspace(struct amvdec_core *core, struct codec_hevc *hevc) - amvdec_write_dos(core, HEVC_PPS_BUFFER, wkaddr + PPS_OFFSET); - amvdec_write_dos(core, HEVC_SAO_UP, wkaddr + SAO_UP_OFFSET); - -- if (core->platform->revision >= VDEC_REVISION_G12A) -- amvdec_write_dos(core, HEVC_ASSIST_MMU_MAP_ADDR, -- wkaddr + MMU_MAP_OFFSET); -- -- /* No MMU */ -- /*amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER, -- wkaddr + SWAP_BUF_OFFSET); -- amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER2, -- wkaddr + SWAP_BUF2_OFFSET);*/ -+ if (codec_hevc_use_mmu(revision, sess->pixfmt_cap, hevc->is_10bit)) { -+ amvdec_write_dos(core, HEVC_SAO_MMU_VH0_ADDR, -+ wkaddr + MMU_VBH_OFFSET); -+ amvdec_write_dos(core, HEVC_SAO_MMU_VH1_ADDR, -+ wkaddr + MMU_VBH_OFFSET + (MMU_VBH_SIZE / 2)); -+ -+ if (revision >= VDEC_REVISION_G12A) -+ amvdec_write_dos(core, HEVC_ASSIST_MMU_MAP_ADDR, -+ hevc->common.mmu_map_paddr); -+ else -+ amvdec_write_dos(core, H265_MMU_MAP_BUFFER, -+ hevc->common.mmu_map_paddr); -+ } else if (revision < VDEC_REVISION_G12A) { -+ amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER, -+ wkaddr + SWAP_BUF_OFFSET); -+ amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER2, -+ wkaddr + SWAP_BUF2_OFFSET); -+ } -+ - amvdec_write_dos(core, HEVC_SCALELUT, wkaddr + SCALELUT_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); - amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); -- amvdec_write_dos(core, HEVC_DBLK_CFGE, wkaddr + DBLK_DATA2_OFFSET); -+ if (revision >= VDEC_REVISION_G12A) -+ amvdec_write_dos(core, HEVC_DBLK_CFGE, -+ wkaddr + DBLK_DATA2_OFFSET); -+ - amvdec_write_dos(core, LMEM_DUMP_ADR, wkaddr + LMEM_OFFSET); - - return 0; -@@ -555,7 +571,7 @@ static int codec_hevc_start(struct amvdec_session *sess) - INIT_LIST_HEAD(&hevc->ref_frames_list); - hevc->curr_poc = INVALID_POC; - -- ret = codec_hevc_setup_workspace(core, hevc); -+ ret = codec_hevc_setup_workspace(sess, hevc); - if (ret) - goto free_hevc; - -@@ -720,6 +736,7 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - { - struct amvdec_core *core = sess->core; - struct codec_hevc *hevc = sess->priv; -+ struct vb2_buffer *vb = &frame->vbuf->vb2_buf; - union rpm_param *param = &hevc->rpm_param; - u32 pic_height_cu = - (hevc->height + hevc->lcu_size - 1) / hevc->lcu_size; -@@ -743,10 +760,10 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - - if (codec_hevc_use_downsample(sess->pixfmt_cap, hevc->is_10bit)) - buf_y_paddr = -- hevc->common.fbc_buffer_paddr[frame->vbuf->vb2_buf.index]; -+ hevc->common.fbc_buffer_paddr[vb->index]; - else - buf_y_paddr = -- vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 0); -+ vb2_dma_contig_plane_dma_addr(vb, 0); - - if (codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { - val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200; -@@ -756,15 +773,23 @@ codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) - - if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { - buf_y_paddr = -- vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 0); -+ vb2_dma_contig_plane_dma_addr(vb, 0); - buf_u_v_paddr = -- vb2_dma_contig_plane_dma_addr(&frame->vbuf->vb2_buf, 1); -+ vb2_dma_contig_plane_dma_addr(vb, 1); - amvdec_write_dos(core, HEVC_SAO_Y_START_ADDR, buf_y_paddr); - amvdec_write_dos(core, HEVC_SAO_C_START_ADDR, buf_u_v_paddr); - amvdec_write_dos(core, HEVC_SAO_Y_WPTR, buf_y_paddr); - amvdec_write_dos(core, HEVC_SAO_C_WPTR, buf_u_v_paddr); - } - -+ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, -+ hevc->is_10bit)) { -+ amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, -+ hevc->common.mmu_header_paddr[vb->index]); -+ /* use HEVC_CM_HEADER_START_ADDR */ -+ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10)); -+ } -+ - amvdec_write_dos(core, HEVC_SAO_Y_LENGTH, - amvdec_get_output_size(sess)); - amvdec_write_dos(core, HEVC_SAO_C_LENGTH, -@@ -1351,8 +1376,6 @@ static irqreturn_t codec_hevc_threaded_isr(struct amvdec_session *sess) - struct codec_hevc *hevc = sess->priv; - u32 dec_status = amvdec_read_dos(core, HEVC_DEC_STATUS_REG); - -- printk("ISR!\n"); -- - if (!hevc) - return IRQ_HANDLED; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0147-FROMLIST-arm64-dts-meson-g12b-ugoos-am6-add-initial-.patch b/packages/linux/patches/amlogic/amlogic-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch similarity index 85% rename from packages/linux/patches/amlogic/amlogic-0147-FROMLIST-arm64-dts-meson-g12b-ugoos-am6-add-initial-.patch rename to packages/linux/patches/amlogic/amlogic-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch index b4ff16fccc..a7e4935eda 100644 --- a/packages/linux/patches/amlogic/amlogic-0147-FROMLIST-arm64-dts-meson-g12b-ugoos-am6-add-initial-.patch +++ b/packages/linux/patches/amlogic/amlogic-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch @@ -1,34 +1,51 @@ -From 11beb2753f943418bee7a3b57f88da31bb0bb66c Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 9 Jun 2019 01:39:20 +0000 -Subject: [PATCH 147/187] FROMLIST: arm64: dts: meson-g12b-ugoos-am6: add - initial device-tree +From 4d1d97fac8759006dd59919d8557c102c2d8410b Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 11 Oct 2019 09:24:44 +0000 +Subject: [PATCH 129/146] FROMLIST: arm64: dts: meson-g12b-gtking: add initial + device-tree + +The Shenzen AZW (Beelink) GT-King is based on the Amlogic W400 reference +board with an S922X chip. + +- 4GB LPDDR4 RAM +- 64GB eMMC storage +- 10/100/1000 Base-T Ethernet +- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1) +- HDMI 2.1 video +- S/PDIF optical output +- Analogue audio output +- 1x USB 2.0 port +- 2x USB 3.0 ports +- IR receiver +- 1x micro SD card slot + +The device-tree is largely based on meson-g12b-ugoos-am6. Signed-off-by: Christian Hewitt --- arch/arm64/boot/dts/amlogic/Makefile | 1 + - .../boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 557 ++++++++++++++++++ - 2 files changed, 558 insertions(+) - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts + .../boot/dts/amlogic/meson-g12b-gtking.dts | 560 ++++++++++++++++++ + 2 files changed, 561 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile -index ae5e8d0c08da..cb4dafc137c4 100644 +index 6cf8c4ac0390..ce276044748b 100644 --- a/arch/arm64/boot/dts/amlogic/Makefile +++ b/arch/arm64/boot/dts/amlogic/Makefile -@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb +@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb -+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-odroidc2.dtb -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts new file mode 100644 -index 000000000000..585c42f949c1 +index 000000000000..cd2ba7ad8ba2 --- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -@@ -0,0 +1,557 @@ ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts +@@ -0,0 +1,560 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS @@ -45,21 +62,14 @@ index 000000000000..585c42f949c1 +#include + +/ { -+ compatible = "ugoos,am6", "amlogic,g12b"; -+ model = "Ugoos AM6"; ++ compatible = "azw,gtking", "amlogic,g12b"; ++ model = "Beelink GT-King"; + + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; + }; + -+ spdif_dit: audio-codec-1 { -+ #sound-dai-cells = <0>; -+ compatible = "linux,spdif-dit"; -+ status = "okay"; -+ sound-name-prefix = "DIT"; -+ }; -+ + chosen { + stdout-path = "serial0:115200n8"; + }; @@ -81,6 +91,13 @@ index 000000000000..585c42f949c1 + clock-names = "ext_clock"; + }; + ++ spdif_dit: audio-codec-1 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + flash_1v8: regulator-flash_1v8 { + compatible = "regulator-fixed"; + regulator-name = "FLASH_1V8"; @@ -130,7 +147,7 @@ index 000000000000..585c42f949c1 + + vddcpu_a: regulator-vddcpu-a { + /* -+ * MP8756GD Regulator. ++ * MP1653 Regulator. + */ + compatible = "pwm-regulator"; + @@ -149,7 +166,7 @@ index 000000000000..585c42f949c1 + + vddcpu_b: regulator-vddcpu-b { + /* -+ * Silergy SY8120B1ABC Regulator. ++ * MP1652 Regulator. + */ + compatible = "pwm-regulator"; + @@ -166,29 +183,31 @@ index 000000000000..585c42f949c1 + regulator-always-on; + }; + -+ usb1_pow: regulator-usb1_pow { ++ usb1_pow: regulator-usb1-pow { + compatible = "regulator-fixed"; + regulator-name = "USB1_POW"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v>; + -+ gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ++ /* connected to SY6280A Power Switch */ ++ gpio = <&gpio GPIOA_8 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + -+ usb_pwr_en: regulator-usb_pwr_en { ++ 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>; + -+ gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>; ++ /* Connected to USB3 Type-A Port power enable */ ++ gpio = <&gpio GPIOAO_7 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + -+ vddao_1v8: regulator-vddao_1v8 { ++ vddao_1v8: regulator-vddao-1v8 { + compatible = "regulator-fixed"; + regulator-name = "VDDAO_1V8"; + regulator-min-microvolt = <1800000>; @@ -197,7 +216,7 @@ index 000000000000..585c42f949c1 + regulator-always-on; + }; + -+ vddao_3v3: regulator-vddao_3v3 { ++ vddao_3v3: regulator-vddao-3v3 { + compatible = "regulator-fixed"; + regulator-name = "VDDAO_3V3"; + regulator-min-microvolt = <3300000>; @@ -229,7 +248,7 @@ index 000000000000..585c42f949c1 + + sound { + compatible = "amlogic,axg-sound-card"; -+ model = "G12B-UGOOS-AM6"; ++ model = "G12B-GTKING"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", @@ -312,7 +331,7 @@ index 000000000000..585c42f949c1 + #clock-cells = <0>; + clock-frequency = <32768>; + pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ -+ }; ++ }; +}; + +&arb { @@ -463,42 +482,7 @@ index 000000000000..585c42f949c1 + pinctrl-names = "default"; + clocks = <&xtal>; + clock-names = "clkin0"; -+ status = "okay"; -+}; -+ -+&uart_A { + status = "okay"; -+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; -+ pinctrl-names = "default"; -+ uart-has-rtscts; -+ -+ bluetooth { -+ compatible = "brcm,bcm43438-bt"; -+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; -+ max-speed = <2000000>; -+ clocks = <&wifi32k>; -+ clock-names = "lpo"; -+ }; -+}; -+ -+&uart_AO { -+ status = "okay"; -+ pinctrl-0 = <&uart_ao_a_pins>; -+ pinctrl-names = "default"; -+}; -+ -+&usb { -+ status = "okay"; -+ dr_mode = "host"; -+ vbus-regulator = <&usb_pwr_en>; -+}; -+ -+&usb2_phy0 { -+ phy-supply = <&usb1_pow>; -+}; -+ -+&usb2_phy1 { -+ phy-supply = <&usb1_pow>; +}; + +/* SDIO */ @@ -518,6 +502,9 @@ index 000000000000..585c42f949c1 + non-removable; + disable-wp; + ++ /* WiFi firmware requires power to be kept while in suspend */ ++ keep-power-in-suspend; ++ + mmc-pwrseq = <&sdio_pwrseq>; + + vmmc-supply = <&vddao_3v3>; @@ -555,9 +542,7 @@ index 000000000000..585c42f949c1 + + bus-width = <8>; + cap-mmc-highspeed; -+ mmc-ddr-1_8v; -+ mmc-hs200-1_8v; -+ max-frequency = <200000000>; ++ max-frequency = <100000000>; + disable-wp; + + mmc-pwrseq = <&emmc_pwrseq>; @@ -586,6 +571,41 @@ index 000000000000..585c42f949c1 +&tohdmitx { + status = "okay"; +}; ++ ++&uart_A { ++ status = "okay"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; ++ max-speed = <2000000>; ++ clocks = <&wifi32k>; ++ clock-names = "lpo"; ++ }; ++}; ++ ++&uart_AO { ++ status = "okay"; ++ pinctrl-0 = <&uart_ao_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&usb { ++ status = "okay"; ++ dr_mode = "host"; ++ vbus-regulator = <&usb_pwr_en>; ++}; ++ ++&usb2_phy0 { ++ phy-supply = <&usb1_pow>; ++}; ++ ++&usb2_phy1 { ++ phy-supply = <&usb1_pow>; ++}; -- 2.17.1 diff --git a/packages/linux/patches/amlogic/amlogic-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch b/packages/linux/patches/amlogic/amlogic-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch new file mode 100644 index 0000000000..3d2f59d386 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch @@ -0,0 +1,29 @@ +From 6b445aae3d6ec06df2adaecfbf33c2a02ddbe283 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 29 Feb 2020 15:13:02 +0000 +Subject: [PATCH 130/146] FROMLIST: dt-bindings: arm: amlogic: add support for + the Tanix TX5 Max + +The Oranth (Tanix) TX5 Max is based on the Amlogic U200 reference +board with an S905X2 chip. + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml +index a96974f81644..73f3f157406c 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -137,6 +137,7 @@ properties: + - amediatech,x96-max + - amlogic,u200 + - seirobotics,sei510 ++ - oranth,tx5-max + - const: amlogic,g12a + + - description: Boards with the Amlogic Meson G12B A311D SoC +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch b/packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch new file mode 100644 index 0000000000..f8e00c1862 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch @@ -0,0 +1,532 @@ +From 371d0120f2ea3ce669669680d1ca1e762843a895 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sun, 20 Oct 2019 04:06:59 +0000 +Subject: [PATCH 131/146] FROMLIST: arm64: dts: meson-g12a-tanix-tx5max: add + initial device tree + +The Oranth Tanix TX5 Max is based on the Amlogic U200 reference design +using the S905X2 chipset. Hardware specification: + +- 4GB LPDDR4 RAM +- 32GB eMMC storage +- 10/100/1000 Base-T Ethernet using External RGMII PHY +- 802.11 a/b/g/b/ac + BT 4.1 sdio wireless +- HDMI 2.0 (4k@60p) video +- Composite video + 2-channel audio output on 3.5mm jack +- S/PDIF audio output +- 1x USB 3.0 +- 1x USB 2.0 +- 1x micro SD card slot + +The device tree is a duplicate of the higher-spec X96 Max box with +changes to compatible/model only. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../dts/amlogic/meson-g12a-tanix-tx5max.dts | 481 ++++++++++++++++++ + 2 files changed, 482 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12a-tanix-tx5max.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index ce276044748b..c1185c932b33 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-g12a-tanix-tx5max.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-tanix-tx5max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-tanix-tx5max.dts +new file mode 100644 +index 000000000000..c3ef0ee37d6f +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-tanix-tx5max.dts +@@ -0,0 +1,481 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2018 BayLibre SAS. All rights reserved. ++ */ ++ ++/dts-v1/; ++ ++#include "meson-g12a.dtsi" ++#include ++#include ++#include ++ ++/ { ++ compatible = "oranth,tx5-max", "amlogic,g12a"; ++ model = "Tanix TX5 Max"; ++ ++ aliases { ++ serial0 = &uart_AO; ++ ethernet0 = ðmac; ++ }; ++ ++ spdif_dit: audio-codec-1 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++ ++ cvbs-connector { ++ compatible = "composite-video-connector"; ++ ++ port { ++ cvbs_connector_in: endpoint { ++ remote-endpoint = <&cvbs_vdac_out>; ++ }; ++ }; ++ }; ++ ++ hdmi-connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++ ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; ++ clocks = <&wifi32k>; ++ clock-names = "ext_clock"; ++ }; ++ ++ 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; ++ }; ++ ++ dc_in: regulator-dc_in { ++ compatible = "regulator-fixed"; ++ regulator-name = "DC_IN"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; ++ ++ vcc_1v8: regulator-vcc_1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_3v3>; ++ regulator-always-on; ++ }; ++ ++ vcc_3v3: regulator-vcc_3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vddao_3v3>; ++ regulator-always-on; ++ /* FIXME: actually controlled by VDDCPU_B_EN */ ++ }; ++ ++ vcc_5v: regulator-vcc_5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&dc_in>; ++ ++ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; ++ enable-active-low; ++ }; ++ ++ 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 = <&dc_in>; ++ regulator-always-on; ++ }; ++ ++ vddcpu: regulator-vddcpu { ++ compatible = "pwm-regulator"; ++ ++ regulator-name = "VDDCPU"; ++ regulator-min-microvolt = <721000>; ++ regulator-max-microvolt = <1022000>; ++ ++ vin-supply = <&dc_in>; ++ ++ pwms = <&pwm_AO_cd 1 1250 0>; ++ pwm-dutycycle-range = <100 0>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "G12A-TANIX-TX5MAX"; ++ audio-aux-devs = <&tdmout_b>; ++ audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", ++ "TDMOUT_B IN 1", "FRDDR_B OUT 1", ++ "TDMOUT_B IN 2", "FRDDR_C OUT 1", ++ "TDM_B Playback", "TDMOUT_B OUT", ++ "SPDIFOUT IN 0", "FRDDR_A OUT 3", ++ "SPDIFOUT IN 1", "FRDDR_B OUT 3", ++ "SPDIFOUT IN 2", "FRDDR_C OUT 3"; ++ ++ assigned-clocks = <&clkc CLKID_MPLL2>, ++ <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>; ++ assigned-clock-parents = <0>, <0>, <0>; ++ assigned-clock-rates = <294912000>, ++ <270950400>, ++ <393216000>; ++ status = "okay"; ++ ++ dai-link-0 { ++ sound-dai = <&frddr_a>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&frddr_b>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&frddr_c>; ++ }; ++ ++ /* 8ch hdmi interface */ ++ dai-link-3 { ++ sound-dai = <&tdmif_b>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ dai-tdm-slot-tx-mask-1 = <1 1>; ++ dai-tdm-slot-tx-mask-2 = <1 1>; ++ dai-tdm-slot-tx-mask-3 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; ++ }; ++ }; ++ ++ /* spdif hdmi or toslink interface */ ++ dai-link-4 { ++ sound-dai = <&spdifout>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>; ++ }; ++ }; ++ ++ /* spdif hdmi interface */ ++ dai-link-5 { ++ sound-dai = <&spdifout_b>; ++ ++ codec { ++ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>; ++ }; ++ }; ++ ++ /* hdmi glue */ ++ dai-link-6 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; ++ ++ codec { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++ ++ wifi32k: wifi32k { ++ compatible = "pwm-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ ++ }; ++}; ++ ++&arb { ++ status = "okay"; ++}; ++ ++&cec_AO { ++ pinctrl-0 = <&cec_ao_a_h_pins>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ hdmi-phandle = <&hdmi_tx>; ++}; ++ ++&cecb_AO { ++ pinctrl-0 = <&cec_ao_b_h_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ hdmi-phandle = <&hdmi_tx>; ++}; ++ ++&clkc_audio { ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cvbs_vdac_port { ++ cvbs_vdac_out: endpoint { ++ remote-endpoint = <&cvbs_connector_in>; ++ }; ++}; ++ ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ ++&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-tx5max"; ++}; ++ ++&pwm_AO_cd { ++ pinctrl-0 = <&pwm_ao_d_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin1"; ++ status = "okay"; ++}; ++ ++&ext_mdio { ++ external_phy: ethernet-phy@0 { ++ /* Realtek RTL8211F (0x001cc916) */ ++ reg = <0>; ++ max-speed = <1000>; ++ eee-broken-1000t; ++ ++ 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>; ++ }; ++}; ++ ++ðmac { ++ pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ phy-mode = "rgmii"; ++ phy-handle = <&external_phy>; ++ amlogic,tx-delay-ns = <2>; ++}; ++ ++&pwm_ef { ++ status = "okay"; ++ pinctrl-0 = <&pwm_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin0"; ++}; ++ ++&uart_A { ++ status = "okay"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; ++ max-speed = <2000000>; ++ clocks = <&wifi32k>; ++ clock-names = "lpo"; ++ }; ++}; ++ ++&uart_AO { ++ status = "okay"; ++ pinctrl-0 = <&uart_ao_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&usb { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++/* SDIO */ ++&sd_emmc_a { ++ status = "okay"; ++ pinctrl-0 = <&sdio_pins>; ++ pinctrl-1 = <&sdio_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ bus-width = <4>; ++ cap-sd-highspeed; ++ sd-uhs-sdr50; ++ max-frequency = <100000000>; ++ ++ non-removable; ++ disable-wp; ++ ++ /* WiFi firmware requires power to be kept while in suspend */ ++ keep-power-in-suspend; ++ ++ mmc-pwrseq = <&sdio_pwrseq>; ++ ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_1v8>; ++ ++ brcmf: wifi@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ }; ++}; ++ ++/* SD card */ ++&sd_emmc_b { ++ status = "okay"; ++ pinctrl-0 = <&sdcard_c_pins>; ++ pinctrl-1 = <&sdcard_clk_gate_c_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <4>; ++ cap-sd-highspeed; ++ max-frequency = <100000000>; ++ disable-wp; ++ ++ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_3v3>; ++}; ++ ++/* eMMC */ ++&sd_emmc_c { ++ status = "okay"; ++ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; ++ pinctrl-1 = <&emmc_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ max-frequency = <100000000>; ++ non-removable; ++ disable-wp; ++ ++ mmc-pwrseq = <&emmc_pwrseq>; ++ vmmc-supply = <&vcc_3v3>; ++ vqmmc-supply = <&flash_1v8>; ++}; ++ ++&spdifout { ++ pinctrl-0 = <&spdif_out_h_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&spdifout_b { ++ status = "okay"; ++}; ++ ++&tdmif_b { ++ status = "okay"; ++}; ++ ++&tdmout_b { ++ status = "okay"; ++}; ++ ++&tohdmitx { ++ status = "okay"; ++}; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0132-FROMLIST-arm64-dts-meson-g12b-fix-N2-VIM3-audio-card.patch b/packages/linux/patches/amlogic/amlogic-0132-FROMLIST-arm64-dts-meson-g12b-fix-N2-VIM3-audio-card.patch new file mode 100644 index 0000000000..72dd3b1791 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0132-FROMLIST-arm64-dts-meson-g12b-fix-N2-VIM3-audio-card.patch @@ -0,0 +1,43 @@ +From ff56cf9e659e16cfabeb3a678aded0753c6c5807 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Mon, 2 Mar 2020 03:10:38 +0000 +Subject: [PATCH 132/146] FROMLIST: arm64: dts: meson-g12b: fix N2/VIM3 audio + card model names + +Odroid N2 and Khadas VIM3 are G12B devices, so correct the card model. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 2 +- + arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +index 2b2d72c7746b..c33e85fbdaba 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +@@ -50,7 +50,7 @@ + + sound { + compatible = "amlogic,axg-sound-card"; +- model = "G12A-KHADAS-VIM3"; ++ model = "G12B-KHADAS-VIM3"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", +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 0e54c1dc2842..8830d3844885 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +@@ -208,7 +208,7 @@ + + sound { + compatible = "amlogic,axg-sound-card"; +- model = "G12A-ODROIDN2"; ++ model = "G12B-ODROID-N2"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0132-HACK-silence-PFNs-busy-log-spam.patch b/packages/linux/patches/amlogic/amlogic-0132-HACK-silence-PFNs-busy-log-spam.patch deleted file mode 100644 index cd255e6893..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0132-HACK-silence-PFNs-busy-log-spam.patch +++ /dev/null @@ -1,29 +0,0 @@ -From f165e0c7fb1d5e6a1a61ad7dcd066d90a6603c98 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 13 Apr 2019 06:23:01 +0000 -Subject: [PATCH 132/187] HACK: silence "PFNs busy" log spam - -Even with ratelimiting in https://lore.kernel.org/patchwork/patch/816616/ lots -of "PFNs busy" messages spam the system log, so silence the message. - -Signed-off-by: Christian Hewitt ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 9c9194959271..8a16fde7d939 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -8434,8 +8434,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0133-HACK-silence-meson-ir-warn-once-log-spam.patch b/packages/linux/patches/amlogic/amlogic-0133-HACK-silence-meson-ir-warn-once-log-spam.patch deleted file mode 100644 index 2c14c5cd02..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0133-HACK-silence-meson-ir-warn-once-log-spam.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d9a489fe794af2fa4fc68ee53e26de9a7f89cd87 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 13 Apr 2019 06:27:33 +0000 -Subject: [PATCH 133/187] HACK: silence meson-ir warn once log spam - -This silences another warning message that spams the system log. - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/meson-ir.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c -index 72a7bbbf6b1f..a65853a929dc 100644 ---- a/drivers/media/rc/meson-ir.c -+++ b/drivers/media/rc/meson-ir.c -@@ -91,7 +91,8 @@ static irqreturn_t meson_ir_irq(int irqno, void *dev_id) - status = readl_relaxed(ir->reg + IR_DEC_STATUS); - rawir.pulse = !!(status & STATUS_IR_DEC_IN); - -- ir_raw_event_store_with_timeout(ir->rc, &rawir); -+ if (ir_raw_event_store_with_filter(ir->rc, &rawir)) -+ ir_raw_event_handle(ir->rc); - - spin_unlock(&ir->lock); - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0133-WIP-ath10k-add-QCA9377-sdio-hw_param-item.patch b/packages/linux/patches/amlogic/amlogic-0133-WIP-ath10k-add-QCA9377-sdio-hw_param-item.patch new file mode 100644 index 0000000000..9ed615ca51 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0133-WIP-ath10k-add-QCA9377-sdio-hw_param-item.patch @@ -0,0 +1,69 @@ +From 3aec95ec42de1fca2de84c8ae09ff19e54eb24d7 Mon Sep 17 00:00:00 2001 +From: Erik Stromdahl +Date: Thu, 26 Sep 2019 17:06:51 +0300 +Subject: [PATCH 133/146] WIP: ath10k: add QCA9377 sdio hw_param item + +Add hardware parameters for QCA9377 sdio devices, it's now properly supported. + +Signed-off-by: Erik Stromdahl +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ath/ath10k/core.c | 27 ++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath10k/hw.h | 3 +++ + 2 files changed, 30 insertions(+) + +diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c +index 5ec16ce19b69..aa4e4703ccac 100644 +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -540,6 +540,33 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { + .fw_diag_ce_download = true, + .tx_stats_over_pktlog = false, + }, ++ { ++ .id = QCA9377_HW_1_1_DEV_VERSION, ++ .dev_id = QCA9377_1_0_DEVICE_ID, ++ .bus = ATH10K_BUS_SDIO, ++ .name = "qca9377 hw1.1 sdio", ++ .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, ++ .uart_pin = 19, ++ .otp_exe_param = 0, ++ .channel_counters_freq_hz = 88000, ++ .max_probe_resp_desc_thres = 0, ++ .cal_data_len = 8124, ++ .fw = { ++ .dir = QCA9377_HW_1_0_FW_DIR, ++ .board = QCA9377_HW_1_0_BOARD_DATA_FILE, ++ .board_size = QCA9377_BOARD_DATA_SZ, ++ .board_ext_size = QCA9377_BOARD_EXT_DATA_SZ, ++ }, ++ .hw_ops = &qca6174_ops, ++ .hw_clk = qca6174_clk, ++ .target_cpu_freq = 176000000, ++ .decap_align_bytes = 4, ++ .n_cipher_suites = 8, ++ .num_peers = TARGET_QCA9377_HL_NUM_PEERS, ++ .ast_skid_limit = 0x10, ++ .num_wds_entries = 0x20, ++ .uart_pin_workaround = true, ++ }, + { + .id = QCA4019_HW_1_0_DEV_VERSION, + .dev_id = 0, +diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h +index 775fd62fb92d..970c736ac6bb 100644 +--- a/drivers/net/wireless/ath/ath10k/hw.h ++++ b/drivers/net/wireless/ath/ath10k/hw.h +@@ -774,6 +774,9 @@ ath10k_is_rssi_enable(struct ath10k_hw_params *hw, + #define TARGET_HL_TLV_AST_SKID_LIMIT 16 + #define TARGET_HL_TLV_NUM_WDS_ENTRIES 2 + ++/* Target specific defines for QCA9377 high latency firmware */ ++#define TARGET_QCA9377_HL_NUM_PEERS 15 ++ + /* Diagnostic Window */ + #define CE_DIAG_PIPE 7 + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0134-HACK-silence-hrtimer-log-spam.patch b/packages/linux/patches/amlogic/amlogic-0134-HACK-silence-hrtimer-log-spam.patch deleted file mode 100644 index a59f1576e7..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0134-HACK-silence-hrtimer-log-spam.patch +++ /dev/null @@ -1,28 +0,0 @@ -From ef07e33bbba39ac1173afda848ff3427f77f697d Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 13 Apr 2019 06:35:17 +0000 -Subject: [PATCH 134/187] HACK: silence hrtimer log spam - -This silences another annoying system log message - -Signed-off-by: Christian Hewitt ---- - kernel/time/hrtimer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index 5ee77f1a8a92..1ea645a874a5 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -904,7 +904,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) - if (delta < 0) - return 0; - -- if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED)) -+ if (timer->state & HRTIMER_STATE_ENQUEUED) - return 0; - - if (interval < hrtimer_resolution) --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0134-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch b/packages/linux/patches/amlogic/amlogic-0134-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch new file mode 100644 index 0000000000..340d7ecac2 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0134-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch @@ -0,0 +1,54 @@ +From 5ecf7dd693dff8c8d05b449313c71529f9690a15 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Sun, 11 Aug 2019 10:01:25 +0000 +Subject: [PATCH 134/146] WIP: arm64: dts: meson-g12b-khadas-vim3: add the + Ethernet PHY interrupt line + +apply the same change as [0] to VIM3. + +[0] https://github.com/torvalds/linux/commit/98ba71c94eaff1c3af6170bce9fe63c93dd32f2f + +Signed-off-by: Christian Hewitt +--- + .../dts/amlogic/meson-g12b-khadas-vim3.dtsi | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +index c33e85fbdaba..8158a97a92cb 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +@@ -154,6 +154,31 @@ + clock-latency = <50000>; + }; + ++&ext_mdio { ++ external_phy: ethernet-phy@0 { ++ /* Realtek RTL8211F (0x001cc916) */ ++ reg = <0>; ++ max-speed = <1000>; ++ ++ interrupt-parent = <&gpio_intc>; ++ /* MAC_INTR on GPIOZ_14 */ ++ interrupts = <26 IRQ_TYPE_LEVEL_LOW>; ++ }; ++}; ++ ++ðmac { ++ pinctrl-0 = <ð_pins>, <ð_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"; + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0135-HACK-Bluetooth-Fix-spurious-error-message.patch b/packages/linux/patches/amlogic/amlogic-0135-HACK-Bluetooth-Fix-spurious-error-message.patch deleted file mode 100644 index 2a2821a7a8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0135-HACK-Bluetooth-Fix-spurious-error-message.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 1cfa6f21cff2447c93567c15f68d5af20c9c15b7 Mon Sep 17 00:00:00 2001 -From: Szymon Janc -Date: Thu, 29 Mar 2018 11:41:17 +0200 -Subject: [PATCH 135/187] HACK: Bluetooth: Fix spurious error message - -This message was debug message before 2064ee332e4c1b7495cf68b. Looks -like it was changed by accident in that patch. This is causing some -error messages when doing BR/EDR discovery since Inquiry Command -generates Command Status event, not Command Complete. - -I'm sending this as RFC for now since while things seem to work fine -despite this condition (and it was like that for quite some time) it -feels like this is indeed case that should be handled by HCI request -code. - -Signed-off-by: Szymon Janc ---- - net/bluetooth/hci_event.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c -index c1d3a303d97f..ffcb5a778d78 100644 ---- a/net/bluetooth/hci_event.c -+++ b/net/bluetooth/hci_event.c -@@ -5802,8 +5802,7 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode, - return false; - - if (hdr->evt != HCI_EV_CMD_COMPLETE) { -- bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)", -- hdr->evt); -+ BT_DBG("last event is not cmd complete (0x%2.2x)", hdr->evt); - return false; - } - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0166-WIP-arm64-dts-meson-gxbb-odroid-disable-LED-heartbea.patch b/packages/linux/patches/amlogic/amlogic-0135-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch similarity index 80% rename from packages/linux/patches/amlogic/amlogic-0166-WIP-arm64-dts-meson-gxbb-odroid-disable-LED-heartbea.patch rename to packages/linux/patches/amlogic/amlogic-0135-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch index f4fbc5b9ca..25b4b6d3db 100644 --- a/packages/linux/patches/amlogic/amlogic-0166-WIP-arm64-dts-meson-gxbb-odroid-disable-LED-heartbea.patch +++ b/packages/linux/patches/amlogic/amlogic-0135-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch @@ -1,7 +1,7 @@ -From fe62572331a3d62ed1edb4160d79448361653ad7 Mon Sep 17 00:00:00 2001 +From ccfbfc5b5294e7cc23f49e78097c7433c630119e Mon Sep 17 00:00:00 2001 From: chewitt Date: Wed, 24 Apr 2019 03:40:16 +0000 -Subject: [PATCH 166/187] WIP: arm64: dts: meson-gxbb-odroid: disable LED +Subject: [PATCH 135/146] WIP: arm64: dts: meson-gxbb-odroid-c2: disable LED heartbeat The constantly flashing blue LED heartbeat is annoying for an HTPC device @@ -13,10 +13,10 @@ Signed-off-by: Christian Hewitt 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -index fbfd2da305b1..7431da27e475 100644 +index b1107d7ff32b..7d18b8814189 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -@@ -45,8 +45,7 @@ +@@ -53,8 +53,7 @@ blue { label = "c2:blue:alive"; gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; diff --git a/packages/linux/patches/amlogic/amlogic-0157-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch b/packages/linux/patches/amlogic/amlogic-0136-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch similarity index 80% rename from packages/linux/patches/amlogic/amlogic-0157-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch rename to packages/linux/patches/amlogic/amlogic-0136-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch index 3bf6a56905..d1b2f93d8a 100644 --- a/packages/linux/patches/amlogic/amlogic-0157-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch +++ b/packages/linux/patches/amlogic/amlogic-0136-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch @@ -1,7 +1,7 @@ -From e3ef38f280136b7aad8cca71352ab909dfc6a55e Mon Sep 17 00:00:00 2001 +From 6873f13e5afcc27ba3642227eacf90ea19d68ed4 Mon Sep 17 00:00:00 2001 From: chewitt Date: Sun, 11 Aug 2019 09:45:04 +0000 -Subject: [PATCH 157/187] WIP: arm64: dts: meson-g12b-odroid-n2: disable LED +Subject: [PATCH 136/146] WIP: arm64: dts: meson-g12b-odroid-n2: disable LED heartbeat The constantly flashing blue LED heartbeat is annoying for an HTPC device @@ -13,10 +13,10 @@ Signed-off-by: Christian Hewitt 1 file changed, 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 2f9247b5ac17..a8f47fd1cf69 100644 +index 8830d3844885..72d4ef775ac4 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -90,7 +90,6 @@ +@@ -40,7 +40,6 @@ blue { label = "n2:blue"; gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; diff --git a/packages/linux/patches/amlogic/amlogic-0137-FROMGIT-media-rc-add-keymap-for-Amediatech-X96-MAX-r.patch b/packages/linux/patches/amlogic/amlogic-0137-FROMGIT-media-rc-add-keymap-for-Amediatech-X96-MAX-r.patch deleted file mode 100644 index 16b3f20435..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0137-FROMGIT-media-rc-add-keymap-for-Amediatech-X96-MAX-r.patch +++ /dev/null @@ -1,135 +0,0 @@ -From bf7e1ffa7fa5eb361b38518ac67c9efb27ce20c2 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 7 Apr 2019 04:20:56 +0000 -Subject: [PATCH 137/187] FROMGIT: media: rc: add keymap for Amediatech X96-MAX - remote - -This is a simple NEC remote control device shipped with the Amediatech -X96 MAX Android 'TV Box' device. The remote contains a programmable TV -controls section with buttons that are not mappable, but are indicated -in the keymap for reference. - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-x96max.c | 85 ++++++++++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 87 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-x96max.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index 5b1399af6b3a..b88c4e76cdc6 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -117,4 +117,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-winfast-usbii-deluxe.o \ - rc-su3000.o \ - rc-xbox-dvd.o \ -+ rc-x96max.o \ - rc-zx-irdec.o -diff --git a/drivers/media/rc/keymaps/rc-x96max.c b/drivers/media/rc/keymaps/rc-x96max.c -new file mode 100644 -index 000000000000..d947e4652c92 ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-x96max.c -@@ -0,0 +1,85 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// -+// Copyright (C) 2019 Christian Hewitt -+ -+#include -+#include -+ -+// -+// Keytable for the Amediatecch X96-max remote control -+// -+ -+static struct rc_map_table x96max[] = { -+ -+ { 0x140, KEY_POWER }, -+ -+ // ** TV CONTROL ** -+ // SET -+ // AV/TV -+ // POWER -+ // VOLUME UP -+ // VOLUME DOWN -+ -+ { 0x118, KEY_VOLUMEUP }, -+ { 0x110, KEY_VOLUMEDOWN }, -+ -+ { 0x143, KEY_MUTE }, // CONFIG -+ -+ { 0x100, KEY_EPG }, // MOUSE -+ { 0x119, KEY_BACK }, -+ -+ { 0x116, KEY_UP }, -+ { 0x151, KEY_LEFT }, -+ { 0x150, KEY_RIGHT }, -+ { 0x11a, KEY_DOWN }, -+ { 0x113, KEY_OK }, -+ -+ { 0x111, KEY_HOME }, -+ { 0x14c, KEY_CONTEXT_MENU }, -+ -+ { 0x159, KEY_PREVIOUS }, -+ { 0x15a, KEY_PLAYPAUSE }, -+ { 0x158, KEY_NEXT }, -+ -+ { 0x147, KEY_MENU }, // @ KEY -+ { 0x101, KEY_NUMERIC_0 }, -+ { 0x142, KEY_BACKSPACE }, -+ -+ { 0x14e, KEY_NUMERIC_1 }, -+ { 0x10d, KEY_NUMERIC_2 }, -+ { 0x10c, KEY_NUMERIC_3 }, -+ -+ { 0x14a, KEY_NUMERIC_4 }, -+ { 0x109, KEY_NUMERIC_5 }, -+ { 0x108, KEY_NUMERIC_6 }, -+ -+ { 0x146, KEY_NUMERIC_7 }, -+ { 0x105, KEY_NUMERIC_8 }, -+ { 0x104, KEY_NUMERIC_9 }, -+ -+}; -+ -+static struct rc_map_list x96max_map = { -+ .map = { -+ .scan = x96max, -+ .size = ARRAY_SIZE(x96max), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_X96MAX, -+ } -+}; -+ -+static int __init init_rc_map_x96max(void) -+{ -+ return rc_map_register(&x96max_map); -+} -+ -+static void __exit exit_rc_map_x96max(void) -+{ -+ rc_map_unregister(&x96max_map); -+} -+ -+module_init(init_rc_map_x96max) -+module_exit(exit_rc_map_x96max) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt +Date: Fri, 18 Oct 2019 17:50:42 +0200 +Subject: [PATCH 137/146] WIP: arm64: dts: meson-g12b-odroid-n2: Add cvbs + output to Odroid N2 + +--- + .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 16 ++++++++++++++++ + 1 file changed, 16 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 72d4ef775ac4..f1f1e45dde9c 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +@@ -193,6 +193,16 @@ + vin-supply = <&main_12v>; + regulator-always-on; + }; ++ ++ cvbs-connector { ++ compatible = "composite-video-connector"; ++ ++ port { ++ cvbs_connector_in: endpoint { ++ remote-endpoint = <&cvbs_vdac_out>; ++ }; ++ }; ++ }; + + hdmi-connector { + compatible = "hdmi-connector"; +@@ -325,6 +335,12 @@ + clock-latency = <50000>; + }; + ++&cvbs_vdac_port { ++ cvbs_vdac_out: endpoint { ++ remote-endpoint = <&cvbs_connector_in>; ++ }; ++}; ++ + &ext_mdio { + external_phy: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0138-FROMGIT-media-rc-add-keymap-for-HardKernel-ODROID-re.patch b/packages/linux/patches/amlogic/amlogic-0138-FROMGIT-media-rc-add-keymap-for-HardKernel-ODROID-re.patch deleted file mode 100644 index a6ca109439..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0138-FROMGIT-media-rc-add-keymap-for-HardKernel-ODROID-re.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 5ea9cf0d563788fce8663e3f974a8058eac3a231 Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Mon, 1 Apr 2019 04:22:30 +0400 -Subject: [PATCH 138/187] FROMGIT: media: rc: add keymap for HardKernel ODROID - remote - -This is a simple NEC remote controll device shipped with the HardKernel -ODROID range of ARM Single Board Computer (SBC) devices. - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-odroid.c | 51 ++++++++++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 53 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-odroid.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index b88c4e76cdc6..f757305eacb2 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-nec-terratec-cinergy-xs.o \ - rc-norwood.o \ - rc-npgtech.o \ -+ rc-odroid.o \ - rc-pctv-sedna.o \ - rc-pinnacle-color.o \ - rc-pinnacle-grey.o \ -diff --git a/drivers/media/rc/keymaps/rc-odroid.c b/drivers/media/rc/keymaps/rc-odroid.c -new file mode 100644 -index 000000000000..e95aab608c5a ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-odroid.c -@@ -0,0 +1,51 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// -+// Copyright (C) 2019 Christian Hewitt -+ -+#include -+#include -+ -+// -+// Keytable for the HardKernel ODROID remote controller -+// -+ -+static struct rc_map_table odroid[] = { -+ -+ { 0xb2dc, KEY_POWER }, -+ { 0xb288, KEY_MUTE }, -+ { 0xb282, KEY_HOME }, -+ { 0xb2ca, KEY_UP }, -+ { 0xb299, KEY_LEFT }, -+ { 0xb2ce, KEY_OK }, -+ { 0xb2c1, KEY_RIGHT }, -+ { 0xb2d2, KEY_DOWN }, -+ { 0xb2c5, KEY_MENU }, -+ { 0xb29a, KEY_BACK }, -+ { 0xb281, KEY_VOLUMEDOWN }, -+ { 0xb280, KEY_VOLUMEUP }, -+}; -+ -+static struct rc_map_list odroid_map = { -+ .map = { -+ .scan = odroid, -+ .size = ARRAY_SIZE(odroid), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_ODROID, -+ } -+}; -+ -+static int __init init_rc_map_odroid(void) -+{ -+ return rc_map_register(&odroid_map); -+} -+ -+static void __exit exit_rc_map_odroid(void) -+{ -+ rc_map_unregister(&odroid_map); -+} -+ -+module_init(init_rc_map_odroid) -+module_exit(exit_rc_map_odroid) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt +Date: Tue, 7 Jan 2020 04:37:57 +0000 +Subject: [PATCH 138/146] WIP: arm64: dts: meson: wetek: fix ethmac node + probing + +Mainline u-boot fails to probe Ethernet on WeTek Play2 so add interrupt +details to correct this (cribed from NanoPi K2). + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +index dee51cf95223..7106aebb3351 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +@@ -149,6 +149,10 @@ + reset-assert-us = <10000>; + reset-deassert-us = <30000>; + reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; ++ ++ interrupt-parent = <&gpio_intc>; ++ /* MAC_INTR on GPIOZ_15 */ ++ interrupts = <29 IRQ_TYPE_LEVEL_LOW>; + }; + }; + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0139-FROMGIT-media-rc-add-keymap-for-Khadas-VIM-EDGE-remo.patch b/packages/linux/patches/amlogic/amlogic-0139-FROMGIT-media-rc-add-keymap-for-Khadas-VIM-EDGE-remo.patch deleted file mode 100644 index 0759d1038b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0139-FROMGIT-media-rc-add-keymap-for-Khadas-VIM-EDGE-remo.patch +++ /dev/null @@ -1,110 +0,0 @@ -From ed3faaf74711c2dd56f0a69683f1322e24667a24 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 29 Apr 2019 03:23:38 +0000 -Subject: [PATCH 139/187] FROMGIT: media: rc: add keymap for Khadas VIM/EDGE - remote - -This is a simple NEC remote control device shipped with the Khadas VIM -and EDGE range of ARM Single Board Computer (SBC) devices. It includes -a mouse button for Android use which is mapped to KEY_MUTE. This is the -sole difference from the Khadas 'geekbox' remote which shipped with an -earlier generation of Shenzen Wesion (Khadas) devices under the GeekBox -brand. - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-khadas.c | 56 ++++++++++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 58 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-khadas.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index f757305eacb2..e539d1e48e8a 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -58,6 +58,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-it913x-v1.o \ - rc-it913x-v2.o \ - rc-kaiomy.o \ -+ rc-khadas.o \ - rc-kworld-315u.o \ - rc-kworld-pc150u.o \ - rc-kworld-plus-tv-analog.o \ -diff --git a/drivers/media/rc/keymaps/rc-khadas.c b/drivers/media/rc/keymaps/rc-khadas.c -new file mode 100644 -index 000000000000..bb183ed90d69 ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-khadas.c -@@ -0,0 +1,56 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// -+// Copyright (C) 2019 Christian Hewitt -+ -+/* -+ * Keytable for the Khadas (VIM/EDGE) remote controller -+ */ -+ -+#include -+#include -+ -+static struct rc_map_table khadas[] = { -+ -+ { 0x14, KEY_POWER }, -+ -+ { 0x03, KEY_UP }, -+ { 0x02, KEY_DOWN }, -+ { 0x0e, KEY_LEFT }, -+ { 0x1a, KEY_RIGHT }, -+ { 0x07, KEY_OK }, -+ -+ { 0x01, KEY_BACK }, -+ { 0x5b, KEY_MUTE }, // mouse -+ { 0x13, KEY_MENU }, -+ -+ { 0x58, KEY_VOLUMEDOWN }, -+ { 0x0b, KEY_VOLUMEUP }, -+ -+ { 0x48, KEY_HOME }, -+ -+}; -+ -+static struct rc_map_list khadas_map = { -+ .map = { -+ .scan = khadas, -+ .size = ARRAY_SIZE(khadas), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_KHADAS, -+ } -+}; -+ -+static int __init init_rc_map_khadas(void) -+{ -+ return rc_map_register(&khadas_map); -+} -+ -+static void __exit exit_rc_map_khadas(void) -+{ -+ rc_map_unregister(&khadas_map); -+} -+ -+module_init(init_rc_map_khadas) -+module_exit(exit_rc_map_khadas) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt "); -diff --git a/include/media/rc-map.h b/include/media/rc-map.h -index c66ab0249a96..3c58ae3b6625 100644 ---- a/include/media/rc-map.h -+++ b/include/media/rc-map.h -@@ -224,6 +224,7 @@ struct rc_map *rc_map_get(const char *name); - #define RC_MAP_IT913X_V1 "rc-it913x-v1" - #define RC_MAP_IT913X_V2 "rc-it913x-v2" - #define RC_MAP_KAIOMY "rc-kaiomy" -+#define RC_MAP_KHADAS "rc-khadas" - #define RC_MAP_KWORLD_315U "rc-kworld-315u" - #define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u" - #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0139-WIP-ASoC-meson-add-2-8-channel-constraints.patch b/packages/linux/patches/amlogic/amlogic-0139-WIP-ASoC-meson-add-2-8-channel-constraints.patch new file mode 100644 index 0000000000..de06dd5126 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0139-WIP-ASoC-meson-add-2-8-channel-constraints.patch @@ -0,0 +1,62 @@ +From 2d001fe069c5b9955e91c385f86649e4457007f7 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 20 Feb 2020 15:58:14 +0000 +Subject: [PATCH 139/146] WIP: ASoC: meson: add 2/8 channel constraints + +The audio hardware can output in 2 or 8 channels only, so we need must +ensure we start in only these two configurations. + +Signed-off-by: Neil Armstrong +--- + sound/soc/meson/aiu-fifo-i2s.c | 27 ++++++++++++++++++++++++++- + 1 file changed, 26 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/meson/aiu-fifo-i2s.c b/sound/soc/meson/aiu-fifo-i2s.c +index 9a5271ce80fe..87e0c85eacc8 100644 +--- a/sound/soc/meson/aiu-fifo-i2s.c ++++ b/sound/soc/meson/aiu-fifo-i2s.c +@@ -118,15 +118,40 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream, + snd_soc_component_update_bits(component, AIU_MEM_I2S_MASKS, + AIU_MEM_I2S_MASKS_IRQ_BLOCK, val); + ++ snd_soc_component_write(component, AIU_RST_SOFT, ++ AIU_RST_SOFT_I2S_FAST); ++ snd_soc_component_read(component, AIU_I2S_SYNC, &val); ++ + return 0; + } + ++static const unsigned int channels_2_8[] = { ++ 2, 8 ++}; ++ ++static const struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = { ++ .count = ARRAY_SIZE(channels_2_8), ++ .list = channels_2_8, ++ .mask = 0, ++}; ++ ++static int aiu_fifo_i2s_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ /* Make sure either 2ch or 8ch is selected */ ++ snd_pcm_hw_constraint_list(substream->runtime, 0, ++ SNDRV_PCM_HW_PARAM_CHANNELS, ++ &hw_constraints_2_8_channels); ++ ++ return aiu_fifo_startup(substream, dai); ++} ++ + const struct snd_soc_dai_ops aiu_fifo_i2s_dai_ops = { + .trigger = aiu_fifo_i2s_trigger, + .prepare = aiu_fifo_i2s_prepare, + .hw_params = aiu_fifo_i2s_hw_params, + .hw_free = aiu_fifo_hw_free, +- .startup = aiu_fifo_startup, ++ .startup = aiu_fifo_i2s_startup, + .shutdown = aiu_fifo_shutdown, + }; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0140-FROMGIT-media-rc-add-keymap-for-Tanix-TX3-mini-remot.patch b/packages/linux/patches/amlogic/amlogic-0140-FROMGIT-media-rc-add-keymap-for-Tanix-TX3-mini-remot.patch deleted file mode 100644 index 777e6b10ef..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0140-FROMGIT-media-rc-add-keymap-for-Tanix-TX3-mini-remot.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 45aa27cfa1113dc1492ebeebebbb284f4a798626 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Apr 2019 02:44:48 +0000 -Subject: [PATCH 140/187] FROMGIT: media: rc: add keymap for Tanix TX3 mini - remote - -This is a simple NEC remote control device shipped with the Tanix TX3 -Android STB device. - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-tanix-tx3mini.c | 79 +++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 81 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-tanix-tx3mini.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index e539d1e48e8a..0d4a211a62ea 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -96,6 +96,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-snapstream-firefly.o \ - rc-streamzap.o \ - rc-tango.o \ -+ rc-tanix-tx3mini.o \ - rc-tbs-nec.o \ - rc-technisat-ts35.o \ - rc-technisat-usb2.o \ -diff --git a/drivers/media/rc/keymaps/rc-tanix-tx3mini.c b/drivers/media/rc/keymaps/rc-tanix-tx3mini.c -new file mode 100644 -index 000000000000..e5013981fdc4 ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-tanix-tx3mini.c -@@ -0,0 +1,79 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// Copyright (c) 2018 Christian Hewitt -+ -+#include -+#include -+ -+/* -+ * This keymap is used with the Oranth Tanix TX3 mini -+ * and other Android STB devices. -+ */ -+ -+static struct rc_map_table tanix_tx3mini[] = { -+ -+ { 0x8051, KEY_POWER }, -+ { 0x804d, KEY_MUTE }, -+ -+ { 0x8009, KEY_RED }, -+ { 0x8011, KEY_GREEN }, -+ { 0x8054, KEY_YELLOW }, -+ { 0x804f, KEY_BLUE }, -+ -+ { 0x8056, KEY_VOLUMEDOWN }, -+ { 0x80bd, KEY_PREVIOUS }, -+ { 0x80bb, KEY_NEXT }, -+ { 0x804e, KEY_VOLUMEUP }, -+ -+ { 0x8053, KEY_HOME }, -+ { 0x801b, KEY_BACK }, -+ -+ { 0x8026, KEY_UP }, -+ { 0x8028, KEY_DOWN }, -+ { 0x8025, KEY_LEFT }, -+ { 0x8027, KEY_RIGHT }, -+ { 0x800d, KEY_OK }, -+ -+ { 0x8049, KEY_MENU }, -+ { 0x8052, KEY_EPG }, // mouse -+ -+ { 0x8031, KEY_1 }, -+ { 0x8032, KEY_2 }, -+ { 0x8033, KEY_3 }, -+ -+ { 0x8034, KEY_4 }, -+ { 0x8035, KEY_5 }, -+ { 0x8036, KEY_6 }, -+ -+ { 0x8037, KEY_7 }, -+ { 0x8038, KEY_8 }, -+ { 0x8039, KEY_9 }, -+ -+ { 0x8058, KEY_SUBTITLE }, // 1/a -+ { 0x8030, KEY_0 }, -+ { 0x8044, KEY_DELETE }, -+}; -+ -+static struct rc_map_list tanix_tx3mini_map = { -+ .map = { -+ .scan = tanix_tx3mini, -+ .size = ARRAY_SIZE(tanix_tx3mini), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_TANIX_TX3MINI, -+ } -+}; -+ -+static int __init init_rc_map_tanix_tx3mini(void) -+{ -+ return rc_map_register(&tanix_tx3mini_map); -+} -+ -+static void __exit exit_rc_map_tanix_tx3mini(void) -+{ -+ rc_map_unregister(&tanix_tx3mini_map); -+} -+ -+module_init(init_rc_map_tanix_tx3mini) -+module_exit(exit_rc_map_tanix_tx3mini) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt "); -diff --git a/include/media/rc-map.h b/include/media/rc-map.h -index 3c58ae3b6625..ccedb96b9525 100644 ---- a/include/media/rc-map.h -+++ b/include/media/rc-map.h -@@ -263,6 +263,7 @@ struct rc_map *rc_map_get(const char *name); - #define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly" - #define RC_MAP_STREAMZAP "rc-streamzap" - #define RC_MAP_TANGO "rc-tango" -+#define RC_MAP_TANIX_TX3MINI "rc-tanix-tx3mini" - #define RC_MAP_TBS_NEC "rc-tbs-nec" - #define RC_MAP_TECHNISAT_TS35 "rc-technisat-ts35" - #define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2" --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0112-TEMP-ASoC-hdmi-codec-reorder-channel-allocation-list.patch b/packages/linux/patches/amlogic/amlogic-0140-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch similarity index 75% rename from packages/linux/patches/amlogic/amlogic-0112-TEMP-ASoC-hdmi-codec-reorder-channel-allocation-list.patch rename to packages/linux/patches/amlogic/amlogic-0140-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch index e55058c006..6f4379407e 100644 --- a/packages/linux/patches/amlogic/amlogic-0112-TEMP-ASoC-hdmi-codec-reorder-channel-allocation-list.patch +++ b/packages/linux/patches/amlogic/amlogic-0140-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch @@ -1,12 +1,12 @@ -From 913167dce53dd55f471d4501127d3c5f2f16d79e Mon Sep 17 00:00:00 2001 +From b41df604b4c14a9e46b8660af6551a034014e4b1 Mon Sep 17 00:00:00 2001 From: Jonas Karlman -Date: Sun, 25 Mar 2018 22:17:06 +0200 -Subject: [PATCH 112/187] TEMP: ASoC: hdmi-codec: reorder channel allocation - list +Date: Sun, 23 Dec 2018 02:24:38 +0100 +Subject: [PATCH 140/146] WIP: ASoC: hdmi-codec: fix chmap_idx and reorder + channel allocation list Wrong channel allocation is selected by hdmi_codec_get_ch_alloc_table_idx(). -E.g when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC +e.g when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC ca_id 0x01 with speaker mask FL|FR|LFE gets selected instead of ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels @@ -16,19 +16,19 @@ and ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels -Fix this by reorder the channel allocation list with -most specific speaker mask at the top. +Fix this by reorder the channel allocation list with most specific speaker +mask at the top. Signed-off-by: Jonas Karlman --- - sound/soc/codecs/hdmi-codec.c | 115 ++++++++++++++++------------------ - 1 file changed, 53 insertions(+), 62 deletions(-) + sound/soc/codecs/hdmi-codec.c | 140 +++++++++++++++++++--------------- + 1 file changed, 77 insertions(+), 63 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c -index bc300bb123e0..3b253589a012 100644 +index f005751da2cc..66fa9cc3c553 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c -@@ -188,84 +188,75 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { +@@ -189,84 +189,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { /* * hdmi_codec_channel_alloc: speaker configuration available for CEA * @@ -163,9 +163,41 @@ index bc300bb123e0..3b253589a012 100644 + .mask = FL | FR | LFE | FLC | FRC }, + { .ca_id = 0x14, .n_ch = 8, + .mask = FL | FR | FLC | FRC }, ++ { .ca_id = 0x0b, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR }, ++ { .ca_id = 0x0a, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR }, ++ { .ca_id = 0x09, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR }, ++ { .ca_id = 0x08, .n_ch = 8, ++ .mask = FL | FR | RL | RR }, ++ { .ca_id = 0x07, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RC }, ++ { .ca_id = 0x06, .n_ch = 8, ++ .mask = FL | FR | FC | RC }, ++ { .ca_id = 0x05, .n_ch = 8, ++ .mask = FL | FR | LFE | RC }, ++ { .ca_id = 0x04, .n_ch = 8, ++ .mask = FL | FR | RC }, ++ { .ca_id = 0x03, .n_ch = 8, ++ .mask = FL | FR | LFE | FC }, ++ { .ca_id = 0x02, .n_ch = 8, ++ .mask = FL | FR | FC }, ++ { .ca_id = 0x01, .n_ch = 8, ++ .mask = FL | FR | LFE }, }; struct hdmi_codec_priv { +@@ -373,7 +386,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); + struct hdmi_codec_priv *hcp = info->private_data; + +- map = info->chmap[hcp->chmap_idx].map; ++ if (hcp->chmap_idx != HDMI_CODEC_CHMAP_IDX_UNKNOWN) ++ map = info->chmap[hcp->chmap_idx].map; + + for (i = 0; i < info->max_channels; i++) { + if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN) -- 2.17.1 diff --git a/packages/linux/patches/amlogic/amlogic-0141-FROMGIT-media-rc-add-keymap-for-Tanix-TX5-max-remote.patch b/packages/linux/patches/amlogic/amlogic-0141-FROMGIT-media-rc-add-keymap-for-Tanix-TX5-max-remote.patch deleted file mode 100644 index c18ff42366..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0141-FROMGIT-media-rc-add-keymap-for-Tanix-TX5-max-remote.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 6ad593dc7c19db941e36cd4f4a9321dc030a1322 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Fri, 12 Jul 2019 23:20:23 +0000 -Subject: [PATCH 141/187] FROMGIT: media: rc: add keymap for Tanix TX5 max - remote - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-tanix-tx5max.c | 71 ++++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 73 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-tanix-tx5max.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index 0d4a211a62ea..d675dcbaea8e 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -97,6 +97,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-streamzap.o \ - rc-tango.o \ - rc-tanix-tx3mini.o \ -+ rc-tanix-tx5max.o \ - rc-tbs-nec.o \ - rc-technisat-ts35.o \ - rc-technisat-usb2.o \ -diff --git a/drivers/media/rc/keymaps/rc-tanix-tx5max.c b/drivers/media/rc/keymaps/rc-tanix-tx5max.c -new file mode 100644 -index 000000000000..43f467f66171 ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-tanix-tx5max.c -@@ -0,0 +1,71 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// Copyright (c) 2018 Christian Hewitt -+ -+#include -+#include -+ -+/* -+ * This keymap is used with the Oranth Tanix TX5 max -+ * and other Android STB devices. -+ */ -+ -+static struct rc_map_table tanix_tx5max[] = { -+ -+ { 0x40404d, KEY_POWER }, -+ { 0x404043, KEY_MUTE }, -+ -+ { 0x404017, KEY_VOLUMEDOWN }, -+ { 0x404018, KEY_VOLUMEUP }, -+ -+ { 0x40400b, KEY_UP }, -+ { 0x404010, KEY_LEFT }, -+ { 0x404011, KEY_RIGHT }, -+ { 0x40400e, KEY_DOWN }, -+ { 0x40400d, KEY_OK }, -+ -+ { 0x40401a, KEY_HOME }, -+ { 0x404045, KEY_MENU }, -+ { 0x404042, KEY_BACK }, -+ -+ { 0x404001, KEY_1 }, -+ { 0x404002, KEY_2 }, -+ { 0x404003, KEY_3 }, -+ -+ { 0x404004, KEY_4 }, -+ { 0x404005, KEY_5 }, -+ { 0x404006, KEY_6 }, -+ -+ { 0x404007, KEY_7 }, -+ { 0x404008, KEY_8 }, -+ { 0x404009, KEY_9 }, -+ -+ { 0x404047, KEY_MUTE }, // mouse -+ { 0x404000, KEY_0 }, -+ { 0x40400c, KEY_DELETE }, -+ -+}; -+ -+static struct rc_map_list tanix_tx5max_map = { -+ .map = { -+ .scan = tanix_tx5max, -+ .size = ARRAY_SIZE(tanix_tx5max), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_TANIX_TX5MAX, -+ } -+}; -+ -+static int __init init_rc_map_tanix_tx5max(void) -+{ -+ return rc_map_register(&tanix_tx5max_map); -+} -+ -+static void __exit exit_rc_map_tanix_tx5max(void) -+{ -+ rc_map_unregister(&tanix_tx5max_map); -+} -+ -+module_init(init_rc_map_tanix_tx5max) -+module_exit(exit_rc_map_tanix_tx5max) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt "); -diff --git a/include/media/rc-map.h b/include/media/rc-map.h -index ccedb96b9525..0c505edf74d1 100644 ---- a/include/media/rc-map.h -+++ b/include/media/rc-map.h -@@ -264,6 +264,7 @@ struct rc_map *rc_map_get(const char *name); - #define RC_MAP_STREAMZAP "rc-streamzap" - #define RC_MAP_TANGO "rc-tango" - #define RC_MAP_TANIX_TX3MINI "rc-tanix-tx3mini" -+#define RC_MAP_TANIX_TX5MAX "rc-tanix-tx5max" - #define RC_MAP_TBS_NEC "rc-tbs-nec" - #define RC_MAP_TECHNISAT_TS35 "rc-technisat-ts35" - #define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2" --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0110-TEMP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-.patch b/packages/linux/patches/amlogic/amlogic-0141-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch similarity index 73% rename from packages/linux/patches/amlogic/amlogic-0110-TEMP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-.patch rename to packages/linux/patches/amlogic/amlogic-0141-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch index 0d34dd3c15..378a30afb3 100644 --- a/packages/linux/patches/amlogic/amlogic-0110-TEMP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-.patch +++ b/packages/linux/patches/amlogic/amlogic-0141-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch @@ -1,18 +1,18 @@ -From 952b186e9753038b495fb62fcaab7a0db89eabaa Mon Sep 17 00:00:00 2001 +From 138e1a2d8e529c71950e362dad0850b04f83e552 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 9 Jul 2018 21:25:15 +0200 -Subject: [PATCH 110/187] TEMP: drm: dw-hdmi: call hdmi_set_cts_n after clock - is enabled +Subject: [PATCH 141/146] WIP: drm: dw-hdmi: call hdmi_set_cts_n after clock is + enabled --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 8df69c9dbfad..d9297b20771d 100644 +index 1103be760fd5..0b46407b2b1e 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -688,6 +688,11 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) +@@ -753,6 +753,11 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) else hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE; hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); diff --git a/packages/linux/patches/amlogic/amlogic-0142-FROMGIT-media-rc-add-keymap-for-WeTek-Hub-remote.patch b/packages/linux/patches/amlogic/amlogic-0142-FROMGIT-media-rc-add-keymap-for-WeTek-Hub-remote.patch deleted file mode 100644 index a039f8231b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0142-FROMGIT-media-rc-add-keymap-for-WeTek-Hub-remote.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 720ae55186a67a49a266c4edb4a3e74e8a17b461 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Apr 2019 04:37:44 +0000 -Subject: [PATCH 142/187] FROMGIT: media: rc: add keymap for WeTek Hub remote - -This is a simple RC5 remote control device shipped with the WeTek Hub -Android STB device. - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-wetek-hub.c | 55 +++++++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 57 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-wetek-hub.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index d675dcbaea8e..670a9e2f702a 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -117,6 +117,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-videomate-m1f.o \ - rc-videomate-s350.o \ - rc-videomate-tv-pvr.o \ -+ rc-wetek-hub.o \ - rc-winfast.o \ - rc-winfast-usbii-deluxe.o \ - rc-su3000.o \ -diff --git a/drivers/media/rc/keymaps/rc-wetek-hub.c b/drivers/media/rc/keymaps/rc-wetek-hub.c -new file mode 100644 -index 000000000000..8d114ae59669 ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-wetek-hub.c -@@ -0,0 +1,55 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// Copyright (c) 2018 Christian Hewitt -+ -+#include -+#include -+ -+/* -+ * This keymap is used with the WeTek Hub STB. -+ */ -+ -+static struct rc_map_table wetek_hub[] = { -+ -+ { 0x77f1, KEY_POWER }, -+ -+ { 0x77f2, KEY_HOME }, -+ { 0x77f3, KEY_MUTE }, // mouse -+ -+ { 0x77f4, KEY_UP }, -+ { 0x77f5, KEY_DOWN }, -+ { 0x77f6, KEY_LEFT }, -+ { 0x77f7, KEY_RIGHT }, -+ { 0x77f8, KEY_OK }, -+ -+ { 0x77f9, KEY_BACK }, -+ { 0x77fa, KEY_MENU }, -+ -+ { 0x77fb, KEY_VOLUMEUP }, -+ { 0x77fc, KEY_VOLUMEDOWN }, -+ -+}; -+ -+static struct rc_map_list wetek_hub_map = { -+ .map = { -+ .scan = wetek_hub, -+ .size = ARRAY_SIZE(wetek_hub), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_WETEK_HUB, -+ } -+}; -+ -+static int __init init_rc_map_wetek_hub(void) -+{ -+ return rc_map_register(&wetek_hub_map); -+} -+ -+static void __exit exit_rc_map_wetek_hub(void) -+{ -+ rc_map_unregister(&wetek_hub_map); -+} -+ -+module_init(init_rc_map_wetek_hub) -+module_exit(exit_rc_map_wetek_hub) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt "); -diff --git a/include/media/rc-map.h b/include/media/rc-map.h -index 0c505edf74d1..a21a59a6f1fd 100644 ---- a/include/media/rc-map.h -+++ b/include/media/rc-map.h -@@ -284,6 +284,7 @@ struct rc_map *rc_map_get(const char *name); - #define RC_MAP_VIDEOMATE_K100 "rc-videomate-k100" - #define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" - #define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" -+#define RC_MAP_WETEK_HUB "rc-wetek-hub" - #define RC_MAP_WINFAST "rc-winfast" - #define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" - #define RC_MAP_SU3000 "rc-su3000" --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0142-WIP-arm64-dts-meson-khadas-vim3-fix-missing-i2c3-nod.patch b/packages/linux/patches/amlogic/amlogic-0142-WIP-arm64-dts-meson-khadas-vim3-fix-missing-i2c3-nod.patch new file mode 100644 index 0000000000..0ce2078f45 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0142-WIP-arm64-dts-meson-khadas-vim3-fix-missing-i2c3-nod.patch @@ -0,0 +1,38 @@ +From 7234ef8e259eeeaffcdc3e3ec5aad4286ce0e4e4 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 21 Feb 2020 04:43:22 +0000 +Subject: [PATCH 142/146] WIP: arm64: dts: meson: khadas-vim3: fix missing i2c3 + node + +Fixes: c6d29c66e582 ("arm64: dts: meson-g12b-khadas-vim3: add initial device-tree") + +The i2c3 node was missed in the original device-tree and is required for the +optional Khadas 3705 fan to work. + +Suggested-by: Art Nikpal +Signed-off-by: Christian Hewittt +--- + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 0ef60c7151cb..6022805d2032 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -217,6 +217,13 @@ + }; + }; + ++&i2c3 { ++ clock-frequency = <100000>; ++ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &i2c_AO { + status = "okay"; + pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0143-FROMGIT-media-rc-add-keymap-for-WeTeK-Play-2-remote.patch b/packages/linux/patches/amlogic/amlogic-0143-FROMGIT-media-rc-add-keymap-for-WeTeK-Play-2-remote.patch deleted file mode 100644 index 8cb0716f9a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0143-FROMGIT-media-rc-add-keymap-for-WeTeK-Play-2-remote.patch +++ /dev/null @@ -1,142 +0,0 @@ -From f33f4080b9ddf68e903b2e259d330fb1326a1fe7 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 21 Apr 2019 02:24:07 +0000 -Subject: [PATCH 143/187] FROMGIT: media: rc: add keymap for WeTeK Play 2 - remote - -Signed-off-by: Christian Hewitt ---- - drivers/media/rc/keymaps/Makefile | 1 + - drivers/media/rc/keymaps/rc-wetek-play2.c | 95 +++++++++++++++++++++++ - include/media/rc-map.h | 1 + - 3 files changed, 97 insertions(+) - create mode 100644 drivers/media/rc/keymaps/rc-wetek-play2.c - -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index 670a9e2f702a..a56fc634d2d6 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -118,6 +118,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-videomate-s350.o \ - rc-videomate-tv-pvr.o \ - rc-wetek-hub.o \ -+ rc-wetek-play2.o \ - rc-winfast.o \ - rc-winfast-usbii-deluxe.o \ - rc-su3000.o \ -diff --git a/drivers/media/rc/keymaps/rc-wetek-play2.c b/drivers/media/rc/keymaps/rc-wetek-play2.c -new file mode 100644 -index 000000000000..77504f207578 ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-wetek-play2.c -@@ -0,0 +1,95 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+// -+// Copyright (C) 2019 Christian Hewitt -+ -+#include -+#include -+ -+// -+// Keytable for the WeTek Play 2 remote controller -+// -+ -+static struct rc_map_table wetek_play2[] = { -+ -+ { 0x5e5f02, KEY_POWER }, -+ { 0x5e5f46, KEY_SLEEP }, // tv -+ { 0x5e5f10, KEY_MUTE }, -+ -+ { 0x5e5f22, KEY_1 }, -+ { 0x5e5f23, KEY_2 }, -+ { 0x5e5f24, KEY_3 }, -+ -+ { 0x5e5f25, KEY_4 }, -+ { 0x5e5f26, KEY_5 }, -+ { 0x5e5f27, KEY_6 }, -+ -+ { 0x5e5f28, KEY_7 }, -+ { 0x5e5f29, KEY_8 }, -+ { 0x5e5f30, KEY_9 }, -+ -+ { 0x5e5f71, KEY_BACK }, -+ { 0x5e5f21, KEY_0 }, -+ { 0x5e5f72, KEY_CAPSLOCK }, -+ -+ // outer ring clockwide from top -+ { 0x5e5f03, KEY_HOME }, -+ { 0x5e5f61, KEY_BACK }, -+ { 0x5e5f77, KEY_CONFIG }, // mouse -+ { 0x5e5f83, KEY_EPG }, -+ { 0x5e5f84, KEY_SCREEN }, // square -+ { 0x5e5f48, KEY_MENU }, -+ -+ // inner ring -+ { 0x5e5f50, KEY_UP }, -+ { 0x5e5f4b, KEY_DOWN }, -+ { 0x5e5f4c, KEY_LEFT }, -+ { 0x5e5f4d, KEY_RIGHT }, -+ { 0x5e5f47, KEY_OK }, -+ -+ { 0x5e5f44, KEY_VOLUMEUP }, -+ { 0x5e5f43, KEY_VOLUMEDOWN }, -+ { 0x5e5f4f, KEY_FAVORITES }, -+ { 0x5e5f82, KEY_SUBTITLE }, // txt -+ { 0x5e5f41, KEY_PAGEUP }, -+ { 0x5e5f42, KEY_PAGEDOWN }, -+ -+ { 0x5e5f73, KEY_RED }, -+ { 0x5e5f74, KEY_GREEN }, -+ { 0x5e5f75, KEY_YELLOW }, -+ { 0x5e5f76, KEY_BLUE }, -+ -+ { 0x5e5f67, KEY_PREVIOUSSONG }, -+ { 0x5e5f79, KEY_REWIND }, -+ { 0x5e5f80, KEY_FASTFORWARD }, -+ { 0x5e5f81, KEY_NEXTSONG }, -+ -+ { 0x5e5f04, KEY_RECORD }, -+ { 0x5e5f2c, KEY_PLAYPAUSE }, -+ { 0x5e5f2b, KEY_STOP }, -+ -+}; -+ -+static struct rc_map_list wetek_play2_map = { -+ .map = { -+ .scan = wetek_play2, -+ .size = ARRAY_SIZE(wetek_play2), -+ .rc_proto = RC_PROTO_NEC, -+ .name = RC_MAP_WETEK_PLAY2, -+ } -+}; -+ -+static int __init init_rc_map_wetek_play2(void) -+{ -+ return rc_map_register(&wetek_play2_map); -+} -+ -+static void __exit exit_rc_map_wetek_play2(void) -+{ -+ rc_map_unregister(&wetek_play2_map); -+} -+ -+module_init(init_rc_map_wetek_play2) -+module_exit(exit_rc_map_wetek_play2) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hewitt +Date: Fri, 21 Feb 2020 03:40:31 +0000 +Subject: [PATCH 143/146] WIP: arm64: dts: meson: khadas-vim3: change LED + behaviours on VIM3/3L + +VIM3/3L have two LEDs (red/white) located 1mm apart on the board. In the +current configuration both are powered on creating a pink visual status +indication. The boards are also marketed as HTPC devices where heartbeat +pulses are distracting and undesirable. + +This change removes the heartbeat and sets the default state so that only +the white LED is on while the board is powered. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 6022805d2032..6d0163f56b0d 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -40,14 +40,14 @@ + compatible = "gpio-leds"; + + white { +- label = "vim3:white:sys"; +- gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; +- linux,default-trigger = "heartbeat"; ++ label = "vim3:white:power"; ++ gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; + }; + + red { + label = "vim3:red"; +- gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; ++ gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>; + }; + }; + +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0144-FROMLIST-arm64-dts-meson-Add-capacity-dmips-mhz-attr.patch b/packages/linux/patches/amlogic/amlogic-0144-FROMLIST-arm64-dts-meson-Add-capacity-dmips-mhz-attr.patch deleted file mode 100644 index 66f756df13..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0144-FROMLIST-arm64-dts-meson-Add-capacity-dmips-mhz-attr.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 60ed2aef7afb8eddf7ad354b48e32cee73290411 Mon Sep 17 00:00:00 2001 -From: Frank Hartung -Date: Sat, 14 Sep 2019 02:04:18 +0000 -Subject: [PATCH 144/187] FROMLIST: arm64: dts: meson: Add capacity-dmips-mhz - attributes to G12B - -Meson G12B SoCs (S922X and A311D) are a big-little design where not all CPUs -are equal; the A53s cores are weaker than the A72s. - -Include capacity-dmips-mhz properties to tell the OS there is a difference -in processing capacity. The dmips values are based on similar submissions for -other A53/A72 SoCs: HiSilicon 3660 [1] and Rockchip RK3399 [2]. - -This change is particularly beneficial for use-cases like retro gaming where -emulators often run on a single core. The OS now chooses an A72 core instead -of an A53 core. - -[1] https://lore.kernel.org/patchwork/patch/862742/ -[2] https://patchwork.kernel.org/patch/10836577/ - -Signed-off-by: Frank Hartung -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -index 98ae8a7c8b41..5f3401ae7d67 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi -@@ -48,6 +48,7 @@ - compatible = "arm,cortex-a53"; - reg = <0x0 0x0>; - enable-method = "psci"; -+ capacity-dmips-mhz = <592>; - next-level-cache = <&l2>; - }; - -@@ -56,6 +57,7 @@ - compatible = "arm,cortex-a53"; - reg = <0x0 0x1>; - enable-method = "psci"; -+ capacity-dmips-mhz = <592>; - next-level-cache = <&l2>; - }; - -@@ -64,6 +66,7 @@ - compatible = "arm,cortex-a73"; - reg = <0x0 0x100>; - enable-method = "psci"; -+ capacity-dmips-mhz = <1024>; - next-level-cache = <&l2>; - }; - -@@ -72,6 +75,7 @@ - compatible = "arm,cortex-a73"; - reg = <0x0 0x101>; - enable-method = "psci"; -+ capacity-dmips-mhz = <1024>; - next-level-cache = <&l2>; - }; - -@@ -80,6 +84,7 @@ - compatible = "arm,cortex-a73"; - reg = <0x0 0x102>; - enable-method = "psci"; -+ capacity-dmips-mhz = <1024>; - next-level-cache = <&l2>; - }; - -@@ -88,6 +93,7 @@ - compatible = "arm,cortex-a73"; - reg = <0x0 0x103>; - enable-method = "psci"; -+ capacity-dmips-mhz = <1024>; - next-level-cache = <&l2>; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch b/packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch new file mode 100644 index 0000000000..008af21a79 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch @@ -0,0 +1,133 @@ +From b8e34deeeadc2792e6fcddc26d01d392bed75a2b Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 20 Feb 2020 16:59:34 +0000 +Subject: [PATCH 144/146] WIP: arm64: dts: meson: khadas-vim3l: add audio + playback to vim3l + +Add the sound and related audio nodes to the VIM3L device-tree. + +Signed-off-by: Christian Hewitt +--- + .../dts/amlogic/meson-sm1-khadas-vim3l.dts | 88 +++++++++++++++++++ + 1 file changed, 88 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts +index dbbf29a0dbf6..0ccb268589df 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts +@@ -8,6 +8,7 @@ + + #include "meson-sm1.dtsi" + #include "meson-khadas-vim3.dtsi" ++#include + + / { + compatible = "khadas,vim3l", "amlogic,sm1"; +@@ -31,6 +32,69 @@ + regulator-boot-on; + regulator-always-on; + }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "SM1-KHADAS-VIM3L"; ++ audio-aux-devs = <&tdmout_b>; ++ audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", ++ "TDMOUT_B IN 1", "FRDDR_B OUT 1", ++ "TDMOUT_B IN 2", "FRDDR_C OUT 1", ++ "TDM_B Playback", "TDMOUT_B OUT"; ++ ++ assigned-clocks = <&clkc CLKID_MPLL2>, ++ <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>; ++ assigned-clock-parents = <0>, <0>, <0>; ++ assigned-clock-rates = <294912000>, ++ <270950400>, ++ <393216000>; ++ status = "okay"; ++ ++ dai-link-0 { ++ sound-dai = <&frddr_a>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&frddr_b>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&frddr_c>; ++ }; ++ ++ /* 8ch hdmi interface */ ++ dai-link-3 { ++ sound-dai = <&tdmif_b>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ dai-tdm-slot-tx-mask-1 = <1 1>; ++ dai-tdm-slot-tx-mask-2 = <1 1>; ++ dai-tdm-slot-tx-mask-3 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; ++ }; ++ }; ++ ++ /* hdmi glue */ ++ dai-link-4 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; ++ ++ codec { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&arb { ++ status = "okay"; ++}; ++ ++&clkc_audio { ++ status = "okay"; + }; + + &cpu0 { +@@ -61,6 +125,18 @@ + clock-latency = <50000>; + }; + ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ + &pwm_AO_cd { + pinctrl-0 = <&pwm_ao_d_e_pins>; + pinctrl-names = "default"; +@@ -93,3 +169,15 @@ + phy-names = "usb2-phy0", "usb2-phy1"; + }; + */ ++ ++&tdmif_b { ++ status = "okay"; ++}; ++ ++&tdmout_b { ++ status = "okay"; ++}; ++ ++&tohdmitx { ++ status = "okay"; ++}; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0145-FROMLIST-dt-bindings-Add-vendor-prefix-for-Ugoos.patch b/packages/linux/patches/amlogic/amlogic-0145-FROMLIST-dt-bindings-Add-vendor-prefix-for-Ugoos.patch deleted file mode 100644 index 1c664eb24a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0145-FROMLIST-dt-bindings-Add-vendor-prefix-for-Ugoos.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 67db4e845ce6bce181136a11da723ad70c19afc6 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 9 Jun 2019 01:18:39 +0000 -Subject: [PATCH 145/187] FROMLIST: dt-bindings: Add vendor prefix for Ugoos - -Ugoos Industrial Co., Ltd. are a manufacturer of ARM based TV Boxes/Dongles, -Digital Signage and Advertisement Solutions [0]. - -[0] (https://ugoos.com) - -Signed-off-by: Christian Hewitt ---- - Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml -index 6992bbbbffab..d962be989b5d 100644 ---- a/Documentation/devicetree/bindings/vendor-prefixes.yaml -+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml -@@ -965,6 +965,8 @@ patternProperties: - description: Ubiquiti Networks - "^udoo,.*": - description: Udoo -+ "^ugoos,.*": -+ description: Ugoos Industrial Co., Ltd. - "^uniwest,.*": - description: United Western Technologies Corp (UniWest) - "^upisemi,.*": --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch b/packages/linux/patches/amlogic/amlogic-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch new file mode 100644 index 0000000000..5fdf283874 --- /dev/null +++ b/packages/linux/patches/amlogic/amlogic-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch @@ -0,0 +1,29 @@ +From b743a40e6716d1fbfd2112711450fa80d14ad916 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Sun, 1 Mar 2020 05:33:19 +0000 +Subject: [PATCH 145/146] WIP: dt-bindings: arm: amlogic: add support for the + Beelink GT-King Pro + +The Shenzen AZW (Beelink) GT-King Pro is based on the Amlogic W400 reference +board with an S922X chip. + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml +index 73f3f157406c..f2ccec653db2 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -151,6 +151,7 @@ properties: + items: + - enum: + - azw,gtking ++ - azw,gtking-pro + - hardkernel,odroid-n2 + - khadas,vim3 + - ugoos,am6 +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0146-FROMLIST-dt-bindings-arm-amlogic-Add-support-for-the.patch b/packages/linux/patches/amlogic/amlogic-0146-FROMLIST-dt-bindings-arm-amlogic-Add-support-for-the.patch deleted file mode 100644 index 9993f50f1c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0146-FROMLIST-dt-bindings-arm-amlogic-Add-support-for-the.patch +++ /dev/null @@ -1,41 +0,0 @@ -From f2cd526be87403afc8f8142e8de50e28d5a65175 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 9 Jun 2019 01:24:14 +0000 -Subject: [PATCH 146/187] FROMLIST: dt-bindings: arm: amlogic: Add support for - the Ugoos AM6 - -The Ugoos AM6 is based on the Amlogic W400 reference design using the S922X -chipset. Hardware specifications: - -- 2GB LPDDR4 RAM -- 16GB eMMC storage -- 10/100/1000 Base-T Ethernet using External RGMII PHY -- 802.11 a/b/g/b/ac + BT 5.0 sdio wireless (Ampak 6398S) -- HDMI 2.0 (4k@60p) video -- Composite video + 2-channel audio output on 3.5mm jack -- S/PDIF audio output -- Aux input -- 1x USB 3.0 -- 3x USB 2.0 -- 1x micro SD card slot - -Signed-off-by: Christian Hewitt ---- - Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml -index 04a2b0ef34c6..c1658ec57482 100644 ---- a/Documentation/devicetree/bindings/arm/amlogic.yaml -+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -147,6 +147,7 @@ properties: - - enum: - - hardkernel,odroid-n2 - - khadas,vim3 -+ - ugoos,am6 - - const: amlogic,s922x - - const: amlogic,g12b - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0087-FROMLIST-arm64-dts-meson-g12b-khadas-vim3-add-initia.patch b/packages/linux/patches/amlogic/amlogic-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch similarity index 61% rename from packages/linux/patches/amlogic/amlogic-0087-FROMLIST-arm64-dts-meson-g12b-khadas-vim3-add-initia.patch rename to packages/linux/patches/amlogic/amlogic-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch index 1c3808914b..b8a4026bec 100644 --- a/packages/linux/patches/amlogic/amlogic-0087-FROMLIST-arm64-dts-meson-g12b-khadas-vim3-add-initia.patch +++ b/packages/linux/patches/amlogic/amlogic-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch @@ -1,63 +1,52 @@ -From 9c32a511ef9720c168bf479d8387817023753953 Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Sun, 19 May 2019 14:27:24 +0000 -Subject: [PATCH 087/187] FROMLIST: arm64: dts: meson-g12b-khadas-vim3: add - initial device-tree +From e6124ed3eece36fad5100331e93c9772f8c237d0 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Sun, 1 Mar 2020 05:43:00 +0000 +Subject: [PATCH 146/146] WIP: arm64: dts: meson-g12b-gtking-pro: add initial + device-tree -The Khadas VIM3 uses the Amlogic S922X or A311S SoC, both based on the -Amlogic G12B SoC family, on a board with the same form factor as the -VIM/VIM2 models. It ships in two variants; basic and -pro which differ in RAM and eMMC size: +The Shenzen AZW (Beelink) GT-King Pro is based on the Amlogic W400 reference +board with an S922X chip. -- 2GB (basic) or 4GB (pro) LPDDR4 RAM -- 16GB (basic) or 32GB (pro) eMMC 5.1 storage -- 16MB SPI flash +- 4GB LPDDR4 RAM +- 64GB eMMC storage - 10/100/1000 Base-T Ethernet -- AP6398S Wireless (802.11 a/b/g/n/ac, BT5.0) +- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1) - HDMI 2.1 video -- 1x USB 2.0 + 1x USB 3.0 ports -- 1x USB-C (power) with USB 2.0 OTG -- 3x LED's (1x red, 1x blue, 1x white) -- 3x buttons (power, function, reset) +- Analogue audio output +- 1x RS232 port +- 2x USB 2.0 port +- 2x USB 3.0 ports - IR receiver -- M2 socket with PCIe, USB, ADC & I2C -- 40pin GPIO Header - 1x micro SD card slot +- 1x Power on/off button -A common meson-g12b-khadas-vim3.dtsi is added to support both S922X and -A311D SoCs supported by two variants of the board. +The device-tree is largely based on the GT-King and Ugoos AM6 devices. Signed-off-by: Christian Hewitt -Signed-off-by: Neil Armstrong --- - arch/arm64/boot/dts/amlogic/Makefile | 2 + - .../amlogic/meson-g12b-a311d-khadas-vim3.dts | 15 + - .../dts/amlogic/meson-g12b-khadas-vim3.dtsi | 542 ++++++++++++++++++ - .../amlogic/meson-g12b-s922x-khadas-vim3.dts | 15 + - 4 files changed, 574 insertions(+) - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi - create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-s922x-khadas-vim3.dts + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../dts/amlogic/meson-g12b-gtking-pro.dts | 540 ++++++++++++++++++ + 2 files changed, 541 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile -index 07b861fe5fa5..ae5e8d0c08da 100644 +index c1185c932b33..730316c4d36a 100644 --- a/arch/arm64/boot/dts/amlogic/Makefile +++ b/arch/arm64/boot/dts/amlogic/Makefile -@@ -3,6 +3,8 @@ dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb +@@ -5,6 +5,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-tanix-tx5max.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb -+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb -+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb - dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts new file mode 100644 -index 000000000000..73128ed24361 +index 000000000000..9ce3d693319f --- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dts -@@ -0,0 +1,15 @@ ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts +@@ -0,0 +1,540 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS @@ -67,32 +56,15 @@ index 000000000000..73128ed24361 + +/dts-v1/; + -+#include "meson-g12b-a311d.dtsi" -+#include "meson-g12b-khadas-vim3.dtsi" -+ -+/ { -+ compatible = "khadas,vim3", "amlogic,a311d", "amlogic,g12b"; -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -new file mode 100644 -index 000000000000..382148ef882a ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -@@ -0,0 +1,542 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 BayLibre, SAS -+ * Author: Neil Armstrong -+ * Copyright (c) 2019 Christian Hewitt -+ */ -+ ++#include "meson-g12b.dtsi" ++#include "meson-g12b-s922x.dtsi" +#include +#include +#include -+#include + +/ { -+ model = "Khadas VIM3"; ++ compatible = "azw,gtking", "amlogic,g12b"; ++ model = "Beelink GT-King Pro"; + + aliases { + serial0 = &uart_AO; @@ -108,16 +80,21 @@ index 000000000000..382148ef882a + reg = <0x0 0x0 0x0 0x40000000>; + }; + -+ adc-keys { -+ compatible = "adc-keys"; -+ io-channels = <&saradc 2>; -+ io-channel-names = "buttons"; -+ keyup-threshold-microvolt = <1710000>; ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; ++ }; + -+ button-function { -+ label = "Function"; -+ linux,code = ; -+ press-threshold-microvolt = <10000>; ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ poll-interval = <100>; ++ ++ power-button { ++ label = "suspend"; ++ linux,code = ; ++ gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>; + }; + }; + @@ -125,31 +102,9 @@ index 000000000000..382148ef882a + compatible = "gpio-leds"; + + white { -+ label = "vim3:white"; -+ gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; -+ linux,default-trigger = "heartbeat"; -+ }; -+ -+ red { -+ label = "vim3:red"; -+ gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ emmc_pwrseq: emmc-pwrseq { -+ compatible = "mmc-pwrseq-emmc"; -+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; -+ }; -+ -+ -+ gpio-keys-polled { -+ compatible = "gpio-keys-polled"; -+ poll-interval = <100>; -+ -+ power-button { -+ label = "power"; -+ linux,code = ; -+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>; ++ label = "power:white"; ++ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; + }; + }; + @@ -160,11 +115,20 @@ index 000000000000..382148ef882a + clock-names = "ext_clock"; + }; + -+ dc_in: regulator-dc_in { ++ flash_1v8: regulator-flash_1v8 { + compatible = "regulator-fixed"; -+ regulator-name = "DC_IN"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; ++ 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; + }; + @@ -173,7 +137,7 @@ index 000000000000..382148ef882a + regulator-name = "VCC_5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; -+ vin-supply = <&dc_in>; ++ vin-supply = <&main_12v>; + + gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; + enable-active-high; @@ -193,22 +157,22 @@ index 000000000000..382148ef882a + regulator-name = "VCC_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; -+ vin-supply = <&vsys_3v3>; ++ vin-supply = <&vddao_3v3>; + regulator-always-on; + /* FIXME: actually controlled by VDDCPU_B_EN */ + }; + + vddcpu_a: regulator-vddcpu-a { + /* -+ * MP8756GD Regulator. ++ * MP1653 Regulator. + */ + compatible = "pwm-regulator"; + + regulator-name = "VDDCPU_A"; -+ regulator-min-microvolt = <690000>; -+ regulator-max-microvolt = <1050000>; ++ regulator-min-microvolt = <721000>; ++ regulator-max-microvolt = <1022000>; + -+ vin-supply = <&dc_in>; ++ vin-supply = <&main_12v>; + + pwms = <&pwm_ab 0 1250 0>; + pwm-dutycycle-range = <100 0>; @@ -219,15 +183,15 @@ index 000000000000..382148ef882a + + vddcpu_b: regulator-vddcpu-b { + /* -+ * Silergy SY8030DEC Regulator. ++ * MP1652 Regulator. + */ + compatible = "pwm-regulator"; + + regulator-name = "VDDCPU_B"; -+ regulator-min-microvolt = <690000>; -+ regulator-max-microvolt = <1050000>; ++ regulator-min-microvolt = <721000>; ++ regulator-max-microvolt = <1022000>; + -+ vin-supply = <&vsys_3v3>; ++ vin-supply = <&main_12v>; + + pwms = <&pwm_AO_cd 1 1250 0>; + pwm-dutycycle-range = <100 0>; @@ -236,44 +200,58 @@ index 000000000000..382148ef882a + regulator-always-on; + }; + -+ vddao_1v8: regulator-vddao_1v8 { ++ usb1_pow: regulator-usb1-pow { + compatible = "regulator-fixed"; -+ regulator-name = "VDDIO_AO1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vsys_3v3>; -+ regulator-always-on; -+ }; -+ -+ emmc_1v8: regulator-emmc_1v8 { -+ compatible = "regulator-fixed"; -+ regulator-name = "EMMC_AO1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_3v3>; -+ regulator-always-on; -+ }; -+ -+ vsys_3v3: regulator-vsys_3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VSYS_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&dc_in>; -+ regulator-always-on; -+ }; -+ -+ usb_pwr: regulator-usb_pwr { -+ compatible = "regulator-fixed"; -+ regulator-name = "USB_PWR"; ++ regulator-name = "USB1_POW"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v>; + -+ gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>; ++ /* connected to SY6280A Power Switch */ ++ gpio = <&gpio GPIOA_8 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 USB3 Type-A Port power enable */ ++ gpio = <&gpio GPIOAO_7 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; ++ }; ++ ++ cvbs-connector { ++ compatible = "composite-video-connector"; ++ ++ port { ++ cvbs_connector_in: endpoint { ++ remote-endpoint = <&cvbs_vdac_out>; ++ }; ++ }; ++ }; ++ + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; @@ -285,16 +263,9 @@ index 000000000000..382148ef882a + }; + }; + -+ wifi32k: wifi32k { -+ compatible = "pwm-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <32768>; -+ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ -+ }; -+ + sound { + compatible = "amlogic,axg-sound-card"; -+ model = "G12A-KHADAS-VIM3"; ++ model = "G12B-GTKING-PRO"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", @@ -337,7 +308,6 @@ index 000000000000..382148ef882a + }; + }; + -+ /* hdmi glue */ + dai-link-4 { + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; + @@ -346,6 +316,13 @@ index 000000000000..382148ef882a + }; + }; + }; ++ ++ wifi32k: wifi32k { ++ compatible = "pwm-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ ++ }; +}; + +&arb { @@ -412,21 +389,35 @@ index 000000000000..382148ef882a + clock-latency = <50000>; +}; + ++&cvbs_vdac_port { ++ cvbs_vdac_out: endpoint { ++ remote-endpoint = <&cvbs_connector_in>; ++ }; ++}; ++ +&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>; + }; +}; + +ðmac { -+ pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; -+ pinctrl-names = "default"; -+ status = "okay"; -+ phy-mode = "rgmii"; -+ phy-handle = <&external_phy>; -+ amlogic,tx-delay-ns = <2>; ++ pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ phy-mode = "rgmii"; ++ phy-handle = <&external_phy>; ++ amlogic,tx-delay-ns = <2>; +}; + +&frddr_a { @@ -454,26 +445,6 @@ index 000000000000..382148ef882a + }; +}; + -+&i2c_AO { -+ status = "okay"; -+ pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; -+ pinctrl-names = "default"; -+ -+ gpio_expander: gpio-controller@20 { -+ compatible = "ti,tca6408"; -+ reg = <0x20>; -+ vcc-supply = <&vcc_3v3>; -+ gpio-controller; -+ #gpio-cells = <2>; -+ }; -+ -+ rtc@51 { -+ compatible = "haoyu,hym8563"; -+ reg = <0x51>; -+ #clock-cells = <0>; -+ }; -+}; -+ +&ir { + status = "okay"; + pinctrl-0 = <&remote_input_ao_pins>; @@ -498,14 +469,11 @@ index 000000000000..382148ef882a +}; + +&pwm_ef { -+ status = "okay"; -+ pinctrl-0 = <&pwm_e_pins>; -+ pinctrl-names = "default"; -+}; -+ -+&saradc { ++ pinctrl-0 = <&pwm_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin0"; + status = "okay"; -+ vref-supply = <&vddao_1v8>; +}; + +/* SDIO */ @@ -525,9 +493,12 @@ index 000000000000..382148ef882a + non-removable; + disable-wp; + ++ /* WiFi firmware requires power to be kept while in suspend */ ++ keep-power-in-suspend; ++ + mmc-pwrseq = <&sdio_pwrseq>; + -+ vmmc-supply = <&vsys_3v3>; ++ vmmc-supply = <&vddao_3v3>; + vqmmc-supply = <&vddao_1v8>; + + brcmf: wifi@1 { @@ -549,8 +520,8 @@ index 000000000000..382148ef882a + disable-wp; + + cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; -+ vmmc-supply = <&vsys_3v3>; -+ vqmmc-supply = <&vsys_3v3>; ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_3v3>; +}; + +/* eMMC */ @@ -562,14 +533,12 @@ index 000000000000..382148ef882a + + bus-width = <8>; + cap-mmc-highspeed; -+ mmc-ddr-1_8v; -+ mmc-hs200-1_8v; -+ max-frequency = <200000000>; ++ max-frequency = <100000000>; + disable-wp; + + mmc-pwrseq = <&emmc_pwrseq>; + vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&emmc_1v8>; ++ vqmmc-supply = <&flash_1v8>; +}; + +&tdmif_b { @@ -605,42 +574,18 @@ index 000000000000..382148ef882a + pinctrl-names = "default"; +}; + ++&usb { ++ status = "okay"; ++ dr_mode = "host"; ++ vbus-regulator = <&usb_pwr_en>; ++}; ++ +&usb2_phy0 { -+ phy-supply = <&dc_in>; ++ phy-supply = <&usb1_pow>; +}; + +&usb2_phy1 { -+ phy-supply = <&usb_pwr>; -+}; -+ -+&usb3_pcie_phy { -+ phy-supply = <&usb_pwr>; -+}; -+ -+&usb { -+ status = "okay"; -+ dr_mode = "peripheral"; -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-khadas-vim3.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-khadas-vim3.dts -new file mode 100644 -index 000000000000..6bcf972b8bfa ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-khadas-vim3.dts -@@ -0,0 +1,15 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 BayLibre, SAS -+ * Author: Neil Armstrong -+ * Copyright (c) 2019 Christian Hewitt -+ */ -+ -+/dts-v1/; -+ -+#include "meson-g12b-s922x.dtsi" -+#include "meson-g12b-khadas-vim3.dtsi" -+ -+/ { -+ compatible = "khadas,vim3", "amlogic,s922x", "amlogic,g12b"; ++ phy-supply = <&usb1_pow>; +}; -- 2.17.1 diff --git a/packages/linux/patches/amlogic/amlogic-0148-WIP-arm64-dts-meson-g12b-ugoos-am6-use-common-audio-.patch b/packages/linux/patches/amlogic/amlogic-0148-WIP-arm64-dts-meson-g12b-ugoos-am6-use-common-audio-.patch deleted file mode 100644 index 3a1761b78d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0148-WIP-arm64-dts-meson-g12b-ugoos-am6-use-common-audio-.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 1cd7c82645eec7bd5bf2346216c239f2d0df5f6d Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Tue, 2 Jul 2019 06:17:51 +0000 -Subject: [PATCH 148/187] WIP: arm64: dts: meson-g12b-ugoos-am6: use common - audio-card-name - -Change to AMLG12 to use the common AMLG12 alsa configuration. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -index 585c42f949c1..e42c22804da2 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -@@ -198,7 +198,7 @@ - - sound { - compatible = "amlogic,axg-sound-card"; -- model = "G12B-UGOOS-AM6"; -+ model = "AMLG12"; - audio-aux-devs = <&tdmout_b>; - audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", - "TDMOUT_B IN 1", "FRDDR_B OUT 1", --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0149-WIP-arm64-dts-meson-g12b-ugoos-am6-add-minimal-therm.patch b/packages/linux/patches/amlogic/amlogic-0149-WIP-arm64-dts-meson-g12b-ugoos-am6-add-minimal-therm.patch deleted file mode 100644 index b0b1536375..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0149-WIP-arm64-dts-meson-g12b-ugoos-am6-add-minimal-therm.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 656d63cd91f306a1fcd51d8f1efe756d0c9c0062 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Thu, 22 Aug 2019 14:17:29 +0000 -Subject: [PATCH 149/187] WIP: arm64: dts: meson-g12b-ugoos-am6: add minimal - thermal zone - -Signed-off-by: Christian Hewitt ---- - .../boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 60 +++++++++++++++++++ - 1 file changed, 60 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -index e42c22804da2..267e13fac579 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - - / { - compatible = "ugoos,am6", "amlogic,g12b"; -@@ -29,6 +30,55 @@ - sound-name-prefix = "DIT"; - }; - -+ thermal-zones { -+ cpu-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&cpu_temp>; -+ -+ trips { -+ cpu_critical: cpu-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&cpu_critical>; -+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ -+ ddr-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&ddr_temp>; -+ -+ trips { -+ ddr_critical: ddr-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&ddr_critical>; -+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -311,6 +361,7 @@ - operating-points-v2 = <&cpu_opp_table_0>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu1 { -@@ -318,6 +369,7 @@ - operating-points-v2 = <&cpu_opp_table_0>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu100 { -@@ -325,6 +377,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu101 { -@@ -332,6 +385,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu102 { -@@ -339,6 +393,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu103 { -@@ -346,6 +401,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cvbs_vdac_port { -@@ -411,6 +467,10 @@ - linux,rc-map-name = "rc-khadas"; - }; - -+&mali { -+ #cooling-cells = <2>; -+}; -+ - &pwm_ab { - pinctrl-0 = <&pwm_a_e_pins>; - pinctrl-names = "default"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0150-WIP-arm64-dts-meson-g12b-khadas-vim3-add-minimal-the.patch b/packages/linux/patches/amlogic/amlogic-0150-WIP-arm64-dts-meson-g12b-khadas-vim3-add-minimal-the.patch deleted file mode 100644 index a4e932f9d3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0150-WIP-arm64-dts-meson-g12b-khadas-vim3-add-minimal-the.patch +++ /dev/null @@ -1,143 +0,0 @@ -From bdd737daf56cfea75e2b68d6f791a2d04fc7461c Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 11 Aug 2019 03:08:17 +0000 -Subject: [PATCH 150/187] WIP: arm64: dts: meson-g12b-khadas-vim3: add minimal - thermal zone - -Add minimal thermal zone for DDR and CPU sensor - -Signed-off-by: Christian Hewitt ---- - .../dts/amlogic/meson-g12b-khadas-vim3.dtsi | 60 +++++++++++++++++++ - 1 file changed, 60 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -index 382148ef882a..3e86356834ed 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - / { - model = "Khadas VIM3"; -@@ -18,6 +19,55 @@ - ethernet0 = ðmac; - }; - -+ thermal-zones { -+ cpu-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&cpu_temp>; -+ -+ trips { -+ cpu_critical: cpu-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&cpu_critical>; -+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ -+ ddr-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&ddr_temp>; -+ -+ trips { -+ ddr_critical: ddr-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&ddr_critical>; -+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -294,6 +344,7 @@ - operating-points-v2 = <&cpu_opp_table_0>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu1 { -@@ -301,6 +352,7 @@ - operating-points-v2 = <&cpu_opp_table_0>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu100 { -@@ -308,6 +360,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu101 { -@@ -315,6 +368,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu102 { -@@ -322,6 +376,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu103 { -@@ -329,6 +384,7 @@ - operating-points-v2 = <&cpub_opp_table_1>; - clocks = <&clkc CLKID_CPUB_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &ext_mdio { -@@ -400,6 +456,10 @@ - linux,rc-map-name = "rc-khadas"; - }; - -+&mali { -+ #cooling-cells = <2>; -+}; -+ - &pwm_ab { - pinctrl-0 = <&pwm_a_e_pins>; - pinctrl-names = "default"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0151-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch b/packages/linux/patches/amlogic/amlogic-0151-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch deleted file mode 100644 index 276329db14..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0151-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch +++ /dev/null @@ -1,33 +0,0 @@ -From bca7eb4cd812c5407f6cd22419f0a4deb3ee099b Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 11 Aug 2019 10:01:25 +0000 -Subject: [PATCH 151/187] WIP: arm64: dts: meson-g12b-khadas-vim3: add the - Ethernet PHY interrupt line - -apply the same change as [0] to VIM3. - -[0] https://github.com/torvalds/linux/commit/98ba71c94eaff1c3af6170bce9fe63c93dd32f2f - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -index 3e86356834ed..6d49550dca34 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -@@ -392,6 +392,10 @@ - /* Realtek RTL8211F (0x001cc916) */ - reg = <0>; - max-speed = <1000>; -+ -+ interrupt-parent = <&gpio_intc>; -+ /* MAC_INTR on GPIOZ_14 */ -+ interrupts = <26 IRQ_TYPE_LEVEL_LOW>; - }; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0152-WIP-arm64-dts-meson-g12b-khadas-vim3-add-acceleromet.patch b/packages/linux/patches/amlogic/amlogic-0152-WIP-arm64-dts-meson-g12b-khadas-vim3-add-acceleromet.patch deleted file mode 100644 index a3e8c57c9b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0152-WIP-arm64-dts-meson-g12b-khadas-vim3-add-acceleromet.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 37775ae51d9ab271912b34cea2d440971cf6522f Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 12 Aug 2019 03:14:54 +0000 -Subject: [PATCH 152/187] WIP: arm64: dts: meson-g12b-khadas-vim3: add - accelerometer and usb-c port - -Signed-off-by: Christian Hewitt ---- - .../dts/amlogic/meson-g12b-khadas-vim3.dtsi | 24 ++++++++++++++++++- - 1 file changed, 23 insertions(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -index 6d49550dca34..5a84185c4e9a 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -@@ -110,7 +110,6 @@ - reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; - }; - -- - gpio-keys-polled { - compatible = "gpio-keys-polled"; - poll-interval = <100>; -@@ -438,6 +437,13 @@ - pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; - pinctrl-names = "default"; - -+ sensor@e { -+ compatible = "kionix,kxtj21009"; -+ reg = <0xe>; -+ interrupt-parent = <&gpio_intc>; -+ interrupts = <9 IRQ_TYPE_LEVEL_LOW>; -+ }; -+ - gpio_expander: gpio-controller@20 { - compatible = "ti,tca6408"; - reg = <0x20>; -@@ -446,6 +452,22 @@ - #gpio-cells = <2>; - }; - -+ fusb302: typec-portc@22 { -+ compatible = "fcs,fusb302"; -+ reg = <0x22>; -+ interrupt-parent = <&gpio_intc>; -+ interrupts = <8 IRQ_TYPE_LEVEL_LOW>; -+ -+ usb_con: connector { -+ compatible = "usb-c-connector"; -+ label = "USB-C"; -+ power-role = "sink"; -+ data-role = "dual"; -+ sink-pdos = ; -+ op-sink-microwatt = <10000000>; -+ }; -+ }; -+ - rtc@51 { - compatible = "haoyu,hym8563"; - reg = <0x51>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0153-WIP-arm64-dts-meson-g12b-khadas-vim3-disable-LED-hea.patch b/packages/linux/patches/amlogic/amlogic-0153-WIP-arm64-dts-meson-g12b-khadas-vim3-disable-LED-hea.patch deleted file mode 100644 index 634b76d9d0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0153-WIP-arm64-dts-meson-g12b-khadas-vim3-disable-LED-hea.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 403da6e3501fe1a873cdd815b6644f745ea5e11a Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 10 Aug 2019 19:19:00 +0000 -Subject: [PATCH 153/187] WIP: arm64: dts: meson-g12b-khadas-vim3: disable LED - heartbeat - -The constantly flashing white LED heartbeat is annoying for an HTPC device -so remove the heartbeat line. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -index 5a84185c4e9a..0cac7bb18678 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -@@ -96,7 +96,6 @@ - white { - label = "vim3:white"; - gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; -- linux,default-trigger = "heartbeat"; - }; - - red { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0154-WIP-arm64-dts-meson-g12b-khadas-vim3-set-AMLG12-audi.patch b/packages/linux/patches/amlogic/amlogic-0154-WIP-arm64-dts-meson-g12b-khadas-vim3-set-AMLG12-audi.patch deleted file mode 100644 index 0e5139ec97..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0154-WIP-arm64-dts-meson-g12b-khadas-vim3-set-AMLG12-audi.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 3057028a54d24e2642e4a2032ea0af74008d8b65 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 10 Aug 2019 18:47:19 +0000 -Subject: [PATCH 154/187] WIP: arm64: dts: meson-g12b-khadas-vim3: set AMLG12 - audio card name - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -index 0cac7bb18678..b63de6571551 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi -@@ -261,7 +261,7 @@ - - sound { - compatible = "amlogic,axg-sound-card"; -- model = "G12A-KHADAS-VIM3"; -+ model = "AMLG12"; - audio-aux-devs = <&tdmout_b>; - audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", - "TDMOUT_B IN 1", "FRDDR_B OUT 1", --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0155-FROMGIT-arm64-dts-meson-g12b-odroid-n2-add-rc-odroid.patch b/packages/linux/patches/amlogic/amlogic-0155-FROMGIT-arm64-dts-meson-g12b-odroid-n2-add-rc-odroid.patch deleted file mode 100644 index 6d58d26f67..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0155-FROMGIT-arm64-dts-meson-g12b-odroid-n2-add-rc-odroid.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 6c258d3fdb9ce7c8fc3ae82e5059de92bec4839d Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 10 Aug 2019 14:28:14 +0000 -Subject: [PATCH 155/187] FROMGIT: arm64: dts: meson-g12b-odroid-n2: add - rc-odroid ir keymap - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 1 + - 1 file changed, 1 insertion(+) - -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 57c84aa9890c..9d9850235f21 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -455,6 +455,7 @@ - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -+ linux,rc-map-name = "rc-odroid"; - }; - - &pwm_ab { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0156-WIP-arm64-dts-meson-g12b-odroid-n2-add-battery-rtc-s.patch b/packages/linux/patches/amlogic/amlogic-0156-WIP-arm64-dts-meson-g12b-odroid-n2-add-battery-rtc-s.patch deleted file mode 100644 index 9a7d9bf108..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0156-WIP-arm64-dts-meson-g12b-odroid-n2-add-battery-rtc-s.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 1611de6c33f0be7836a8e9f964122b6269516b18 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 12 Aug 2019 02:55:09 +0000 -Subject: [PATCH 156/187] WIP: arm64: dts: meson-g12b-odroid-n2: add battery - rtc support - -Changes suggested in Odroid forum [0] to enable battery RTC support - -[0] https://forum.odroid.com/viewtopic.php?f=176&t=33993&start=300#p262877 - -Signed-off-by: Christian Hewitt ---- - .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 41 +++++++++++++++++++ - 1 file changed, 41 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 9d9850235f21..2f9247b5ac17 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -458,6 +458,47 @@ - linux,rc-map-name = "rc-odroid"; - }; - -+&i2c3_sda_a_pins { -+ mux { -+ groups = "i2c3_sda_a"; -+ function = "i2c3"; -+ bias-pull-up; -+ drive-strength-microamp = <3000>; -+ }; -+}; -+ -+&i2c3_sck_a_pins { -+ mux { -+ groups = "i2c3_sck_a"; -+ function = "i2c3"; -+ bias-pull-up; -+ drive-strength-microamp = <3000>; -+ }; -+}; -+ -+&i2c3 { -+ status = "okay"; -+ pinctrl-names = "default","gpio_periphs"; -+ pinctrl-0 = <&i2c3_sck_a_pins &i2c3_sda_a_pins>; -+ pinctrl-1 = <&i2c3_to_gpioa>; -+ clock-frequency = <100000>; /* default 100k */ -+ -+ pcf8563: rtc@51 { /*I2C-bus slave address: read A3h and write A2h*/ -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ }; -+}; -+ -+&periphs_pinctrl { -+ i2c3_to_gpioa:i2c3_gpioa { -+ mux { -+ groups = "GPIOA_14", "GPIOA_15"; -+ function = "gpio_periphs"; -+ drive-strength-microamp = <3000>; -+ }; -+ }; -+}; -+ - &pwm_ab { - pinctrl-0 = <&pwm_a_e_pins>; - pinctrl-names = "default"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0158-WIP-arm64-dts-meson-g12b-odroid-n2-set-AMLG12-audio-.patch b/packages/linux/patches/amlogic/amlogic-0158-WIP-arm64-dts-meson-g12b-odroid-n2-set-AMLG12-audio-.patch deleted file mode 100644 index 3dc658c904..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0158-WIP-arm64-dts-meson-g12b-odroid-n2-set-AMLG12-audio-.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 45896ceaceb9389b33a929af79b597fd28967ee1 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 10 Aug 2019 18:48:54 +0000 -Subject: [PATCH 158/187] WIP: arm64: dts: meson-g12b-odroid-n2: set AMLG12 - audio card name - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 2 +- - 1 file changed, 1 insertion(+), 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 a8f47fd1cf69..e45d964e6d84 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts -@@ -257,7 +257,7 @@ - - sound { - compatible = "amlogic,axg-sound-card"; -- model = "G12A-ODROIDN2"; -+ model = "AMLG12"; - audio-aux-devs = <&tdmout_b>; - audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", - "TDMOUT_B IN 1", "FRDDR_B OUT 1", --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0159-WIP-arm64-dts-meson-g12a-sei510-set-AMLG12-audio-car.patch b/packages/linux/patches/amlogic/amlogic-0159-WIP-arm64-dts-meson-g12a-sei510-set-AMLG12-audio-car.patch deleted file mode 100644 index 241a8a3d3e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0159-WIP-arm64-dts-meson-g12a-sei510-set-AMLG12-audio-car.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b4355a36a27747d5666019b8a6465deddcc5b8a2 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 10 Aug 2019 18:42:54 +0000 -Subject: [PATCH 159/187] WIP: arm64: dts: meson-g12a-sei510: set AMLG12 audio - card name - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -index 3e8621d7e6a5..967699bf0ec1 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts -@@ -229,7 +229,7 @@ - - sound { - compatible = "amlogic,axg-sound-card"; -- model = "G12A-SEI510"; -+ model = "AMLG12"; - audio-aux-devs = <&tdmout_a>, <&tdmout_b>, - <&tdmin_a>, <&tdmin_b>; - audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0", --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0160-WIP-arm64-dts-meson-g12a-u200-add-minimal-thermal-zo.patch b/packages/linux/patches/amlogic/amlogic-0160-WIP-arm64-dts-meson-g12a-u200-add-minimal-thermal-zo.patch deleted file mode 100644 index 6f3386e8d8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0160-WIP-arm64-dts-meson-g12a-u200-add-minimal-thermal-zo.patch +++ /dev/null @@ -1,125 +0,0 @@ -From ceaad385214219608c1700f0b63b9a9456a409b1 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 11 Aug 2019 03:09:33 +0000 -Subject: [PATCH 160/187] WIP: arm64: dts: meson-g12a-u200: add minimal thermal - zone - -Add minimal thermal zone for DDR and CPU sensor - -Signed-off-by: Christian Hewitt ---- - .../boot/dts/amlogic/meson-g12a-u200.dts | 56 +++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -index 2a324f0136e3..96dc6da95e22 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -@@ -8,6 +8,7 @@ - #include "meson-g12a.dtsi" - #include - #include -+#include - - / { - compatible = "amlogic,u200", "amlogic,g12a"; -@@ -18,6 +19,53 @@ - ethernet0 = ðmac; - }; - -+ thermal-zones { -+ cpu-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&cpu_temp>; -+ -+ trips { -+ cpu_critical: cpu-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&cpu_critical>; -+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ -+ ddr-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&ddr_temp>; -+ -+ trips { -+ ddr_critical: ddr-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&ddr_critical>; -+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -168,6 +216,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu1 { -@@ -175,6 +224,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu2 { -@@ -182,6 +232,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu3 { -@@ -189,6 +240,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cvbs_vdac_port { -@@ -243,6 +295,10 @@ - pinctrl-names = "default"; - }; - -+&mali { -+ #cooling-cells = <2>; -+}; -+ - &pwm_AO_cd { - pinctrl-0 = <&pwm_ao_d_e_pins>; - pinctrl-names = "default"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0161-WIP-arm64-dts-meson-g12a-u200-add-sound-card.patch b/packages/linux/patches/amlogic/amlogic-0161-WIP-arm64-dts-meson-g12a-u200-add-sound-card.patch deleted file mode 100644 index 7185ec0c21..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0161-WIP-arm64-dts-meson-g12a-u200-add-sound-card.patch +++ /dev/null @@ -1,189 +0,0 @@ -From b74ff58a2921af06d9180d37ad5609f293ec2c59 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Thu, 15 Aug 2019 08:26:34 +0000 -Subject: [PATCH 161/187] WIP: arm64: dts: meson-g12a-u200: add sound card - -Signed-off-by: chewitt ---- - .../boot/dts/amlogic/meson-g12a-u200.dts | 130 ++++++++++++++++++ - 1 file changed, 130 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -index 96dc6da95e22..70a6161d2f41 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts -@@ -8,6 +8,7 @@ - #include "meson-g12a.dtsi" - #include - #include -+#include - #include - - / { -@@ -66,6 +67,13 @@ - }; - }; - -+ spdif_dit: audio-codec-1 { -+ #sound-dai-cells = <0>; -+ compatible = "linux,spdif-dit"; -+ status = "okay"; -+ sound-name-prefix = "DIT"; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -195,6 +203,90 @@ - regulator-boot-on; - regulator-always-on; - }; -+ -+ sound { -+ compatible = "amlogic,axg-sound-card"; -+ model = "G12A-U200"; -+ audio-aux-devs = <&tdmout_b>; -+ audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", -+ "TDMOUT_B IN 1", "FRDDR_B OUT 1", -+ "TDMOUT_B IN 2", "FRDDR_C OUT 1", -+ "TDM_B Playback", "TDMOUT_B OUT", -+ "SPDIFOUT IN 0", "FRDDR_A OUT 3", -+ "SPDIFOUT IN 1", "FRDDR_B OUT 3", -+ "SPDIFOUT IN 2", "FRDDR_C OUT 3"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ status = "okay"; -+ -+ dai-link-0 { -+ sound-dai = <&frddr_a>; -+ }; -+ -+ dai-link-1 { -+ sound-dai = <&frddr_b>; -+ }; -+ -+ dai-link-2 { -+ sound-dai = <&frddr_c>; -+ }; -+ -+ /* 8ch hdmi interface */ -+ dai-link-3 { -+ sound-dai = <&tdmif_b>; -+ dai-format = "i2s"; -+ dai-tdm-slot-tx-mask-0 = <1 1>; -+ dai-tdm-slot-tx-mask-1 = <1 1>; -+ dai-tdm-slot-tx-mask-2 = <1 1>; -+ dai-tdm-slot-tx-mask-3 = <1 1>; -+ mclk-fs = <256>; -+ -+ codec { -+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; -+ }; -+ }; -+ -+ /* spdif hdmi or toslink interface */ -+ dai-link-4 { -+ sound-dai = <&spdifout>; -+ -+ codec-0 { -+ sound-dai = <&spdif_dit>; -+ }; -+ -+ codec-1 { -+ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>; -+ }; -+ }; -+ -+ /* spdif hdmi interface */ -+ dai-link-5 { -+ sound-dai = <&spdifout_b>; -+ -+ codec { -+ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>; -+ }; -+ }; -+ -+ /* hdmi glue */ -+ dai-link-6 { -+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+}; -+ -+&arb { -+ status = "okay"; - }; - - &cec_AO { -@@ -243,6 +335,10 @@ - #cooling-cells = <2>; - }; - -+&clkc_audio { -+ status = "okay"; -+}; -+ - &cvbs_vdac_port { - cvbs_vdac_out: endpoint { - remote-endpoint = <&cvbs_connector_in>; -@@ -255,6 +351,18 @@ - phy-mode = "rmii"; - }; - -+&frddr_a { -+ status = "okay"; -+}; -+ -+&frddr_b { -+ status = "okay"; -+}; -+ -+&frddr_c { -+ status = "okay"; -+}; -+ - &hdmi_tx { - status = "okay"; - pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; -@@ -344,6 +452,28 @@ - vqmmc-supply = <&flash_1v8>; - }; - -+&spdifout { -+ pinctrl-0 = <&spdif_out_h_pins>; -+ pinctrl-names = "default"; -+ status = "okay"; -+}; -+ -+&spdifout_b { -+ status = "okay"; -+}; -+ -+&tdmif_b { -+ status = "okay"; -+}; -+ -+&tdmout_b { -+ status = "okay"; -+}; -+ -+&tohdmitx { -+ status = "okay"; -+}; -+ - &uart_AO { - status = "okay"; - pinctrl-0 = <&uart_ao_a_pins>; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0162-WIP-arm64-dts-meson-g12a-x96-max-add-minimal-thermal.patch b/packages/linux/patches/amlogic/amlogic-0162-WIP-arm64-dts-meson-g12a-x96-max-add-minimal-thermal.patch deleted file mode 100644 index 7ce672097a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0162-WIP-arm64-dts-meson-g12a-x96-max-add-minimal-thermal.patch +++ /dev/null @@ -1,125 +0,0 @@ -From af151a797f68ebfad6690b707c2bd0a8942511c8 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 11 Aug 2019 03:10:13 +0000 -Subject: [PATCH 162/187] WIP: arm64: dts: meson-g12a-x96-max: add minimal - thermal zone - -Add minimal thermal zone for DDR and CPU sensor - -Signed-off-by: Christian Hewitt ---- - .../boot/dts/amlogic/meson-g12a-x96-max.dts | 56 +++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -index c1e58a69d434..e1e9195e14d6 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - / { - compatible = "amediatech,x96-max", "amlogic,u200", "amlogic,g12a"; -@@ -26,6 +27,53 @@ - sound-name-prefix = "DIT"; - }; - -+ thermal-zones { -+ cpu-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&cpu_temp>; -+ -+ trips { -+ cpu_critical: cpu-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&cpu_critical>; -+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, -+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ -+ ddr-thermal { -+ polling-delay = <1000>; -+ polling-delay-passive = <100>; -+ thermal-sensors = <&ddr_temp>; -+ -+ trips { -+ ddr_critical: ddr-critical { -+ temperature = <110000>; /* millicelsius */ -+ hysteresis = <2000>; /* millicelsius */ -+ type = "critical"; -+ }; -+ }; -+ -+ cooling-maps { -+ map { -+ trip = <&ddr_critical>; -+ cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; -+ }; -+ }; -+ }; -+ }; -+ - chosen { - stdout-path = "serial0:115200n8"; - }; -@@ -263,6 +311,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu1 { -@@ -270,6 +319,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu2 { -@@ -277,6 +327,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cpu3 { -@@ -284,6 +335,7 @@ - operating-points-v2 = <&cpu_opp_table>; - clocks = <&clkc CLKID_CPU_CLK>; - clock-latency = <50000>; -+ #cooling-cells = <2>; - }; - - &cvbs_vdac_port { -@@ -323,6 +375,10 @@ - pinctrl-names = "default"; - }; - -+&mali { -+ #cooling-cells = <2>; -+}; -+ - &pwm_AO_cd { - pinctrl-0 = <&pwm_ao_d_e_pins>; - pinctrl-names = "default"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0163-FROMGIT-arm64-dts-meson-g12a-x96-max-add-rc-x96max-i.patch b/packages/linux/patches/amlogic/amlogic-0163-FROMGIT-arm64-dts-meson-g12a-x96-max-add-rc-x96max-i.patch deleted file mode 100644 index 2c94ff1409..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0163-FROMGIT-arm64-dts-meson-g12a-x96-max-add-rc-x96max-i.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 378e6075347e8715b7e2b303fd0daeb425d75fe3 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 20 Apr 2019 23:52:15 +0000 -Subject: [PATCH 163/187] FROMGIT: arm64: dts: meson-g12a-x96-max: add - rc-x96max ir keymap - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -index e1e9195e14d6..8078a7f3c80a 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -@@ -373,6 +373,7 @@ - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -+ linux,rc-map-name = "rc-x96max"; - }; - - &mali { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0164-WIP-arm64-dts-meson-g12a-x96-max-set-AMLG12-audio-ca.patch b/packages/linux/patches/amlogic/amlogic-0164-WIP-arm64-dts-meson-g12a-x96-max-set-AMLG12-audio-ca.patch deleted file mode 100644 index 334c78ac88..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0164-WIP-arm64-dts-meson-g12a-x96-max-set-AMLG12-audio-ca.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 88ecdadd9074cbaae41687db2dea06f3593dddb9 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 18 May 2019 08:11:40 +0000 -Subject: [PATCH 164/187] WIP: arm64: dts: meson-g12a-x96-max: set AMLG12 audio - card name - -The audio card name needs to match a generic alsa .conf shared by all -G12A/B devices so change the name to AMLG12. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -index 8078a7f3c80a..ec63fdd3823e 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts -@@ -198,7 +198,7 @@ - - sound { - compatible = "amlogic,axg-sound-card"; -- model = "G12A-X96-MAX"; -+ model = "AMLG12"; - audio-aux-devs = <&tdmout_b>; - audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", - "TDMOUT_B IN 1", "FRDDR_B OUT 1", --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0165-WIP-arm64-dts-meson-gxbb-gxl-gxm-set-audio-card-name.patch b/packages/linux/patches/amlogic/amlogic-0165-WIP-arm64-dts-meson-gxbb-gxl-gxm-set-audio-card-name.patch deleted file mode 100644 index 2991c89336..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0165-WIP-arm64-dts-meson-gxbb-gxl-gxm-set-audio-card-name.patch +++ /dev/null @@ -1,181 +0,0 @@ -From a08ddc1d914f33d9de60582d39ee23124c19c33a Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 13 Apr 2019 08:00:18 +0000 -Subject: [PATCH 165/187] WIP: arm64: dts: meson gxbb/gxl/gxm: set audio card - name to AMLGX - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 +- - arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 2 +- - 12 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -index 05673221dcc3..ad5456a87183 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -@@ -105,7 +105,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts -index e555612a6612..58ce0ef3a680 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts -@@ -90,7 +90,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts -index 905e4bb70df9..5a708cf1a2a1 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts -@@ -121,7 +121,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -index 2facdf49f8ff..fbfd2da305b1 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -@@ -113,7 +113,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi -index 3245859f7d2a..c2faf342a04a 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi -@@ -116,7 +116,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi -index 6b7ac033ce22..53e950f0b8cf 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi -@@ -115,7 +115,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -index bf3453f549dc..dc514031ff87 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -@@ -68,7 +68,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -index 969ee02e7429..82a8620040dc 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -@@ -86,7 +86,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts -index 93e1fbbe9438..7b861b25bf7c 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts -@@ -105,7 +105,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts -index 78c3060c5d56..952352891250 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts -@@ -35,7 +35,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -index f560eca12067..150a6cee8fdd 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -@@ -84,7 +84,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts -index b6519bbdaadb..81ce29ec39db 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts -@@ -78,7 +78,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0167-WIP-arm64-dts-meson-gxbb-vega-s95-set-rc-vega-s95-ir.patch b/packages/linux/patches/amlogic/amlogic-0167-WIP-arm64-dts-meson-gxbb-vega-s95-set-rc-vega-s95-ir.patch deleted file mode 100644 index bb442aca5d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0167-WIP-arm64-dts-meson-gxbb-vega-s95-set-rc-vega-s95-ir.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d1e2107d3a529694fe20602c3485ea5f133d0042 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Fri, 26 Apr 2019 08:43:58 +0000 -Subject: [PATCH 167/187] WIP: arm64: dts: meson-gxbb-vega-s95: set rc-vega-s95 - ir keymap - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi -index 43b11e3dfe11..1d38a3ecb654 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi -@@ -152,6 +152,7 @@ - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -+ linux,rc-map-name = "rc-vega-s95"; - }; - - &pwm_ef { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0168-WIP-arm64-dts-meson-gxbb-vega-s95-update-dtsi-with-m.patch b/packages/linux/patches/amlogic/amlogic-0168-WIP-arm64-dts-meson-gxbb-vega-s95-update-dtsi-with-m.patch deleted file mode 100644 index af84f84df8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0168-WIP-arm64-dts-meson-gxbb-vega-s95-update-dtsi-with-m.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 0f6ecb794e1186dca234268d3b1ff3d9011c6c36 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 13 Apr 2019 06:18:39 +0000 -Subject: [PATCH 168/187] WIP: arm64: dts: meson-gxbb-vega-s95: update dtsi - with many changes - -Signed-off-by: Christian Hewitt ---- - .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 43 ++++++++++++++++++- - 1 file changed, 41 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi -index 1d38a3ecb654..5b55ce8b6e94 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi -@@ -4,12 +4,15 @@ - */ - - #include "meson-gxbb.dtsi" -+#include -+#include - - / { - compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb"; - - aliases { - serial0 = &uart_AO; -+ serial1 = &uart_A; - ethernet0 = ðmac; - }; - -@@ -91,6 +94,35 @@ - }; - }; - -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "AMLGX"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <128>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ - sdio_pwrseq: sdio-pwrseq { - compatible = "mmc-pwrseq-simple"; - reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; -@@ -99,6 +131,14 @@ - }; - }; - -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; -+}; -+ - &cec_AO { - status = "okay"; - pinctrl-0 = <&ao_cec_pins>; -@@ -124,7 +164,6 @@ - eth_phy0: ethernet-phy@0 { - /* Realtek RTL8211F (0x001cc916) */ - reg = <0>; -- - reset-assert-us = <10000>; - reset-deassert-us = <30000>; - reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; -@@ -144,7 +183,7 @@ - - &hdmi_tx_tmds_port { - hdmi_tx_tmds_out: endpoint { -- remote-endpoint = <&hdmi_connector_in>; -+ remote-endpoint = <&hdmi_connector_in>; - }; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0169-FROMGIT-arm64-dts-meson-gxbb-wetek-hub-set-rc-wetek-.patch b/packages/linux/patches/amlogic/amlogic-0169-FROMGIT-arm64-dts-meson-gxbb-wetek-hub-set-rc-wetek-.patch deleted file mode 100644 index 798c9ae4ad..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0169-FROMGIT-arm64-dts-meson-gxbb-wetek-hub-set-rc-wetek-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 4be11b0c54c5dc19b767920d30148c94b521d59b Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Apr 2019 04:40:25 +0000 -Subject: [PATCH 169/187] FROMGIT: arm64: dts: meson-gxbb-wetek-hub: set - rc-wetek-hub ir keymap - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts -index 2bfe69902552..83b985bb015e 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts -@@ -12,3 +12,7 @@ - compatible = "wetek,hub", "amlogic,meson-gxbb"; - model = "WeTek Hub"; - }; -+ -+&ir { -+ linux,rc-map-name = "rc-wetek-hub"; -+}; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0170-FROMGIT-arm64-dts-meson-gxbb-wetek-play2-set-rc-wete.patch b/packages/linux/patches/amlogic/amlogic-0170-FROMGIT-arm64-dts-meson-gxbb-wetek-play2-set-rc-wete.patch deleted file mode 100644 index 811365b50f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0170-FROMGIT-arm64-dts-meson-gxbb-wetek-play2-set-rc-wete.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0fd56821b2aeab2afbae88a46bf98faa6bf52209 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 21 Apr 2019 02:27:40 +0000 -Subject: [PATCH 170/187] FROMGIT: arm64: dts: meson-gxbb-wetek-play2: set - rc-wetek-play2 ir keymap - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts -index 0038522315de..1d32d1f6d032 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts -@@ -54,3 +54,7 @@ - &usb1 { - status = "okay"; - }; -+ -+&ir { -+ linux,rc-map-name = "rc-wetek-play2"; -+}; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0171-FROMGIT-arm64-dts-meson-gxl-s905x-khadas-vim-use-rc-.patch b/packages/linux/patches/amlogic/amlogic-0171-FROMGIT-arm64-dts-meson-gxl-s905x-khadas-vim-use-rc-.patch deleted file mode 100644 index 180f574ca3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0171-FROMGIT-arm64-dts-meson-gxl-s905x-khadas-vim-use-rc-.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6a1879d68dad6801806d3fcde4a9c8dbd89a5fe0 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 29 Apr 2019 03:37:28 +0000 -Subject: [PATCH 171/187] FROMGIT: arm64: dts: meson-gxl-s905x-khadas-vim: use - rc-khadas remote - -Khadas shipped the first batch of VIM devices with the 'geekbox' remote from -another of their brands. All further shipments have used a 'khadas' branded -remote that provides an Android mouse function instead of KEY_SCREEN. As the -IR keycode for the geekbox screen button is different to the khadas mouse -button KEY_SCREEN doesn't work on the Khadas remote, so swap to the rc-khadas -keymap to gain an extra button mapped to KEY_MUTE. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -index dc514031ff87..2cb377e756ea 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -@@ -147,7 +147,7 @@ - }; - - &ir { -- linux,rc-map-name = "rc-geekbox"; -+ linux,rc-map-name = "rc-khadas"; - }; - - &gpio_ao { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0172-WIP-arm64-dts-meson-gxl-s905x-khadas-vim-fix-address.patch b/packages/linux/patches/amlogic/amlogic-0172-WIP-arm64-dts-meson-gxl-s905x-khadas-vim-fix-address.patch deleted file mode 100644 index 7f63ab1b21..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0172-WIP-arm64-dts-meson-gxl-s905x-khadas-vim-fix-address.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f2310f8a861ebde6bea085f65845f8c20b160184 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Tue, 16 Apr 2019 13:06:08 +0000 -Subject: [PATCH 172/187] WIP: arm64: dts: meson-gxl-s905x-khadas-vim: fix - address/size cells dtc warnings - -Fix DTC warnings: - -arch/arm/dts/meson-gxl-s905x-khadas-vim.dtb: Warning (avoid_unnecessary_addr_size): - /gpio-keys-polled: unnecessary #address-cells/#size-cells - without "ranges" or child "reg" property - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -index 2cb377e756ea..36aea60be6b9 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -@@ -33,8 +33,6 @@ - - gpio-keys-polled { - compatible = "gpio-keys-polled"; -- #address-cells = <1>; -- #size-cells = <0>; - poll-interval = <100>; - - button@0 { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0173-WIP-arm64-dts-meson-gxl-s905x-khadas-vim-add-bluetoo.patch b/packages/linux/patches/amlogic/amlogic-0173-WIP-arm64-dts-meson-gxl-s905x-khadas-vim-add-bluetoo.patch deleted file mode 100644 index 7f7ee255b9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0173-WIP-arm64-dts-meson-gxl-s905x-khadas-vim-add-bluetoo.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7fa624633dd6debd25c3e0d7f596fb9aa78148be Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Jul 2019 09:20:51 +0000 -Subject: [PATCH 173/187] WIP: arm64: dts: meson-gxl-s905x-khadas-vim: add - bluetooth nodes - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -index 36aea60be6b9..374c49bb0672 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts -@@ -227,6 +227,9 @@ - bluetooth { - compatible = "brcm,bcm43438-bt"; - shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; -+ max-speed = <2000000>; -+ clocks = <&wifi32k>; -+ clock-names = "lpo"; - }; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0175-FROMGIT-arm64-dts-meson-gxl-s905w-tx3-mini-set-rc-tx.patch b/packages/linux/patches/amlogic/amlogic-0175-FROMGIT-arm64-dts-meson-gxl-s905w-tx3-mini-set-rc-tx.patch deleted file mode 100644 index 05130e8cd9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0175-FROMGIT-arm64-dts-meson-gxl-s905w-tx3-mini-set-rc-tx.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 8192c86cad992144c87aa2b985ed7752b3d3f99f Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Apr 2019 02:58:24 +0000 -Subject: [PATCH 175/187] FROMGIT: arm64: dts: meson-gxl-s905w-tx3-mini: set - rc-tx3mini ir keymap - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts -index 789c819c99c4..dd729ac2300d 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts -@@ -20,3 +20,7 @@ - reg = <0x0 0x0 0x0 0x40000000>; /* 1 GiB or 2 GiB */ - }; - }; -+ -+&ir { -+ linux,rc-map-name = "rc-tanix-tx3mini"; -+}; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0176-WIP-arm64-dts-meson-gx-p23x-q20x-add-bluetooth-nodes.patch b/packages/linux/patches/amlogic/amlogic-0176-WIP-arm64-dts-meson-gx-p23x-q20x-add-bluetooth-nodes.patch deleted file mode 100644 index 3076244434..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0176-WIP-arm64-dts-meson-gx-p23x-q20x-add-bluetooth-nodes.patch +++ /dev/null @@ -1,53 +0,0 @@ -From ad4dc31265d2a68a15c61139a3f12d831ffa085e Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Jul 2019 09:50:08 +0000 -Subject: [PATCH 176/187] WIP: arm64: dts: meson-gx-p23x-q20x: add bluetooth - nodes - -Signed-off-by: Christian Hewitt ---- - .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 21 +++++++++++++++++++ - 1 file changed, 21 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -index ad5456a87183..b1e9257e4d22 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi -@@ -210,6 +210,11 @@ - - vmmc-supply = <&vddao_3v3>; - vqmmc-supply = <&vddio_boot>; -+ -+ brcmf: wifi@1 { -+ reg = <1>; -+ compatible = "brcm,bcm4329-fmac"; -+ }; - }; - - /* SD card */ -@@ -250,6 +255,22 @@ - vqmmc-supply = <&vddio_boot>; - }; - -+/* This UART is connected to the Bluetooth module */ -+&uart_A { -+ status = "okay"; -+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; -+ pinctrl-names = "default"; -+ uart-has-rtscts; -+ -+ bluetooth { -+ compatible = "brcm,bcm43438-bt"; -+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; -+ max-speed = <2000000>; -+ clocks = <&wifi32k>; -+ clock-names = "lpo"; -+ }; -+}; -+ - /* This UART is brought out to the DB9 connector */ - &uart_AO { - status = "okay"; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0177-FROMGIT-arm64-dts-meson-gxm-khadas-vim2-use-rc-khada.patch b/packages/linux/patches/amlogic/amlogic-0177-FROMGIT-arm64-dts-meson-gxm-khadas-vim2-use-rc-khada.patch deleted file mode 100644 index 320d0569dd..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0177-FROMGIT-arm64-dts-meson-gxm-khadas-vim2-use-rc-khada.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c246b69f2acf4955aca5948f04fbe868e7782790 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Fri, 12 Jul 2019 20:37:37 +0000 -Subject: [PATCH 177/187] FROMGIT: arm64: dts: meson-gxm-khadas-vim2: use - rc-khadas remote - -Khadas shipped the first batch of VIM devices with the 'geekbox' remote from -another of their brands. All further shipments have used a 'khadas' branded -remote that provides an Android mouse function instead of KEY_SCREEN. As the -IR keycode for the geekbox screen button is different to the khadas mouse -button KEY_SCREEN doesn't work on the Khadas remote, so swap to the rc-khadas -keymap to gain an extra button mapped to KEY_MUTE. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -index 150a6cee8fdd..08727564643d 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -@@ -336,7 +336,7 @@ - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -- linux,rc-map-name = "rc-geekbox"; -+ linux,rc-map-name = "rc-khadas"; - }; - - &pwm_AO_ab { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0178-WIP-arm64-dts-meson-gxm-khadas-vim2-fix-uart_A-bluet.patch b/packages/linux/patches/amlogic/amlogic-0178-WIP-arm64-dts-meson-gxm-khadas-vim2-fix-uart_A-bluet.patch deleted file mode 100644 index 8dd9504cd2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0178-WIP-arm64-dts-meson-gxm-khadas-vim2-fix-uart_A-bluet.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 209a0be3ee0c2900af90d86770a50d7d73c5244f Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Jul 2019 08:31:42 +0000 -Subject: [PATCH 178/187] WIP: arm64: dts: meson-gxm-khadas-vim2: fix uart_A - bluetooth node - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -index 08727564643d..dc211d19c7ea 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts -@@ -446,6 +446,9 @@ - bluetooth { - compatible = "brcm,bcm43438-bt"; - shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; -+ max-speed = <2000000>; -+ clocks = <&wifi32k>; -+ clock-names = "lpo"; - }; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0179-WIP-arm64-dts-meson-gxm-vega-s96-set-rc-vega-s95-ir-.patch b/packages/linux/patches/amlogic/amlogic-0179-WIP-arm64-dts-meson-gxm-vega-s96-set-rc-vega-s95-ir-.patch deleted file mode 100644 index 9398cd2dd5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0179-WIP-arm64-dts-meson-gxm-vega-s96-set-rc-vega-s95-ir-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 44e21ed525bdbcc043bb424d57a6e8193adb6546 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Fri, 26 Apr 2019 08:47:22 +0000 -Subject: [PATCH 179/187] WIP: arm64: dts: meson-gxm-vega-s96: set rc-vega-s95 - ir keymap - -S96 uses the same remote as the S95 series devices. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts -index e2ea6753263b..c25fd80b14bf 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts -@@ -35,3 +35,10 @@ - reg = <0>; - }; - }; -+ -+&ir { -+ status = "okay"; -+ pinctrl-0 = <&remote_input_ao_pins>; -+ pinctrl-names = "default"; -+ linux,rc-map-name = "rc-vega-s95"; -+}; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0180-WIP-experimental-ELD-changes-from-kwiboo.patch b/packages/linux/patches/amlogic/amlogic-0180-WIP-experimental-ELD-changes-from-kwiboo.patch deleted file mode 100644 index 44f0544875..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0180-WIP-experimental-ELD-changes-from-kwiboo.patch +++ /dev/null @@ -1,134 +0,0 @@ -From a6bb466ef46fd00da15ffbfdd6f946f6a4889d6b Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Thu, 15 Aug 2019 11:27:55 +0000 -Subject: [PATCH 180/187] WIP: experimental ELD changes from @kwiboo - ---- - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 55 ++++++++++++++--------- - drivers/gpu/drm/drm_edid.c | 3 +- - include/drm/drm_edid.h | 1 + - 3 files changed, 37 insertions(+), 22 deletions(-) - -diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index d9297b20771d..d92400414c7a 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -2161,22 +2161,8 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) - hdmi->rxsense); - } - --static enum drm_connector_status --dw_hdmi_connector_detect(struct drm_connector *connector, bool force) --{ -- struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -- connector); -- -- mutex_lock(&hdmi->mutex); -- hdmi->force = DRM_FORCE_UNSPECIFIED; -- dw_hdmi_update_power(hdmi); -- dw_hdmi_update_phy_mask(hdmi); -- mutex_unlock(&hdmi->mutex); -- -- return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); --} -- --static int dw_hdmi_connector_get_modes(struct drm_connector *connector) -+static int dw_hdmi_connector_update_edid(struct drm_connector *connector, -+ bool add_modes) - { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); -@@ -2195,7 +2181,10 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) - hdmi->sink_has_audio = drm_detect_monitor_audio(edid); - drm_connector_update_edid_property(connector, edid); - cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); -- ret = drm_add_edid_modes(connector, edid); -+ if (add_modes) -+ ret = drm_add_edid_modes(connector, edid); -+ else -+ drm_edid_to_eld(connector, edid); - kfree(edid); - } else { - dev_dbg(hdmi->dev, "failed to get edid\n"); -@@ -2204,6 +2193,34 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) - return ret; - } - -+static enum drm_connector_status -+dw_hdmi_connector_detect(struct drm_connector *connector, bool force) -+{ -+ enum drm_connector_status status; -+ struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -+ connector); -+ -+ mutex_lock(&hdmi->mutex); -+ hdmi->force = DRM_FORCE_UNSPECIFIED; -+ dw_hdmi_update_power(hdmi); -+ dw_hdmi_update_phy_mask(hdmi); -+ mutex_unlock(&hdmi->mutex); -+ -+ status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); -+ -+ if (status == connector_status_connected) -+ dw_hdmi_connector_update_edid(connector, false); -+ else -+ cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); -+ -+ return status; -+} -+ -+static int dw_hdmi_connector_get_modes(struct drm_connector *connector) -+{ -+ return dw_hdmi_connector_update_edid(connector, true); -+} -+ - static void dw_hdmi_connector_force(struct drm_connector *connector) - { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, -@@ -2411,10 +2428,6 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) - dw_hdmi_setup_rx_sense(hdmi, - phy_stat & HDMI_PHY_HPD, - phy_stat & HDMI_PHY_RX_SENSE); -- -- if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) -- cec_notifier_set_phys_addr(hdmi->cec_notifier, -- CEC_PHYS_ADDR_INVALID); - } - - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index 82a4ceed3fcf..4965b49ab8d2 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -4077,7 +4077,7 @@ static void clear_eld(struct drm_connector *connector) - * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The - * HDCP and Port_ID ELD fields are left for the graphics driver to fill in. - */ --static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) -+void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) - { - uint8_t *eld = connector->eld; - u8 *cea; -@@ -4162,6 +4162,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) - DRM_DEBUG_KMS("ELD size %d, SAD count %d\n", - drm_eld_size(eld), total_sad_count); - } -+EXPORT_SYMBOL(drm_edid_to_eld); - - /** - * drm_edid_to_sad - extracts SADs from EDID -diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h -index b9719418c3d2..49987818fe23 100644 ---- a/include/drm/drm_edid.h -+++ b/include/drm/drm_edid.h -@@ -337,6 +337,7 @@ struct drm_connector; - struct drm_connector_state; - struct drm_display_mode; - -+void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); - int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads); - int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb); - int drm_av_sync_delay(struct drm_connector *connector, --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0181-FROMLIST-drm-meson-init-g12a-osd2-yuv2rgb-instead-of.patch b/packages/linux/patches/amlogic/amlogic-0181-FROMLIST-drm-meson-init-g12a-osd2-yuv2rgb-instead-of.patch deleted file mode 100644 index 8128bdbf21..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0181-FROMLIST-drm-meson-init-g12a-osd2-yuv2rgb-instead-of.patch +++ /dev/null @@ -1,77 +0,0 @@ -From d60c9f3da26cbde0209923d1fcc726acad374904 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -Date: Mon, 19 Aug 2019 16:20:17 +0200 -Subject: [PATCH 181/187] FROMLIST: drm/meson: init g12a osd2 yuv2rgb instead - of osd1 - -Following vendor change, to avoid: -> green line displayed when osd alpha 0xff/0x00 continuos -replace yuv2rgb of osd1 for osd2 for G12A & compatible SoCs. - -Fixes: 728883948b0d ("drm/meson: Add G12A Support for VIU setup") -Signed-off-by: Neil Armstrong ---- - drivers/gpu/drm/meson/meson_viu.c | 26 +++++++++++++------------- - 1 file changed, 13 insertions(+), 13 deletions(-) - -diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c -index 4b36e4b21b51..4e769954703c 100644 ---- a/drivers/gpu/drm/meson/meson_viu.c -+++ b/drivers/gpu/drm/meson/meson_viu.c -@@ -78,32 +78,32 @@ static int eotf_bypass_coeff[EOTF_COEFF_SIZE] = { - EOTF_COEFF_RIGHTSHIFT /* right shift */ - }; - --static void meson_viu_set_g12a_osd1_matrix(struct meson_drm *priv, -+static void meson_viu_set_g12a_osd2_matrix(struct meson_drm *priv, - int *m, bool csc_on) - { -- /* VPP WRAP OSD1 matrix */ -+ /* VPP WRAP OSD2 matrix */ - writel(((m[0] & 0xfff) << 16) | (m[1] & 0xfff), -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_PRE_OFFSET0_1)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_PRE_OFFSET0_1)); - writel(m[2] & 0xfff, -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_PRE_OFFSET2)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_PRE_OFFSET2)); - writel(((m[3] & 0x1fff) << 16) | (m[4] & 0x1fff), -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF00_01)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_COEF00_01)); - writel(((m[5] & 0x1fff) << 16) | (m[6] & 0x1fff), -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF02_10)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_COEF02_10)); - writel(((m[7] & 0x1fff) << 16) | (m[8] & 0x1fff), -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_COEF11_12)); - writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff), -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_COEF20_21)); - writel((m[11] & 0x1fff) << 16, -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_COEF22)); - - writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff), -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_OFFSET0_1)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_OFFSET0_1)); - writel(m[20] & 0xfff, -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_OFFSET2)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_OFFSET2)); - - writel_bits_relaxed(BIT(0), csc_on ? BIT(0) : 0, -- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_EN_CTRL)); -+ priv->io_base + _REG(VPP_WRAP_OSD2_MATRIX_EN_CTRL)); - } - - static void meson_viu_set_osd_matrix(struct meson_drm *priv, -@@ -360,7 +360,7 @@ void meson_viu_init(struct meson_drm *priv) - meson_vpu_is_compatible(priv, "amlogic,meson-gxl-vpu")) - meson_viu_load_matrix(priv); - else if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu")) -- meson_viu_set_g12a_osd1_matrix(priv, RGB709_to_YUV709l_coeff, -+ meson_viu_set_g12a_osd2_matrix(priv, RGB709_to_YUV709l_coeff, - true); - - /* Initialize OSD1 fifo control register */ --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0182-WIP-arm64-dts-meson-libretech-ac-update-model-and-co.patch b/packages/linux/patches/amlogic/amlogic-0182-WIP-arm64-dts-meson-libretech-ac-update-model-and-co.patch deleted file mode 100644 index cfbed0dd2a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0182-WIP-arm64-dts-meson-libretech-ac-update-model-and-co.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3c42ac6e8af1f046b7d57ade9fbd83baff263fea Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Mon, 26 Aug 2019 02:32:41 +0000 -Subject: [PATCH 182/187] WIP: arm64: dts: meson: libretech-ac: update model - and compatible - -Shorten the model description and change the compatible to LaFrite, which is -what everyone calls the board. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -index 82b1c4851147..bc7138b7fdc6 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -@@ -12,9 +12,9 @@ - #include "meson-gxl-s905x.dtsi" - - / { -- compatible = "libretech,aml-s805x-ac", "amlogic,s805x", -+ compatible = "libretech,lafrite", "amlogic,s805x", - "amlogic,meson-gxl"; -- model = "Libre Computer Board AML-S805X-AC"; -+ model = "Libre Computer AML-S805X-AC"; - - aliases { - serial0 = &uart_AO; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0183-WIP-arm64-dts-meson-libretech-cc-update-model-and-co.patch b/packages/linux/patches/amlogic/amlogic-0183-WIP-arm64-dts-meson-libretech-cc-update-model-and-co.patch deleted file mode 100644 index b283b06319..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0183-WIP-arm64-dts-meson-libretech-cc-update-model-and-co.patch +++ /dev/null @@ -1,33 +0,0 @@ -From af26fa71f74926b792db183b8dd1bc4b385b462b Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Mon, 26 Aug 2019 02:37:17 +0000 -Subject: [PATCH 183/187] WIP: arm64: dts: meson: libretech-cc: update model - and compatible - -Shorten the model description and change the compatible to LePotato, which -is what everyone calls the board. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -index 82a8620040dc..9d7a451c9589 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts -@@ -12,8 +12,9 @@ - #include "meson-gxl-s905x.dtsi" - - / { -- compatible = "libretech,cc", "amlogic,s905x", "amlogic,meson-gxl"; -- model = "Libre Computer Board AML-S905X-CC"; -+ compatible = "libretech,lepotato", "amlogic,s905x", -+ "amlogic,meson-gxl"; -+ model = "Libre Computer AML-S905X-CC"; - - aliases { - serial0 = &uart_AO; --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0184-WIP-dt-bindings-arm-amlogic-change-LaFrite-compatibl.patch b/packages/linux/patches/amlogic/amlogic-0184-WIP-dt-bindings-arm-amlogic-change-LaFrite-compatibl.patch deleted file mode 100644 index 0fbdc55a2a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0184-WIP-dt-bindings-arm-amlogic-change-LaFrite-compatibl.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0f44b3dc66c8e23b1c8406702769d5c0cc00495d Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Mon, 26 Aug 2019 02:40:56 +0000 -Subject: [PATCH 184/187] WIP: dt-bindings: arm: amlogic: change LaFrite - compatible - -Signed-off-by: Christian Hewitt ---- - Documentation/devicetree/bindings/arm/amlogic.yaml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml -index c1658ec57482..49db2767b02b 100644 ---- a/Documentation/devicetree/bindings/arm/amlogic.yaml -+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -76,7 +76,7 @@ properties: - items: - - enum: - - amlogic,p241 -- - libretech,aml-s805x-ac -+ - libretech,lafrite - - const: amlogic,s805x - - const: amlogic,meson-gxl - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0185-WIP-dt-bindings-arm-amlogic-change-LePotato-compatib.patch b/packages/linux/patches/amlogic/amlogic-0185-WIP-dt-bindings-arm-amlogic-change-LePotato-compatib.patch deleted file mode 100644 index 9dde584876..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0185-WIP-dt-bindings-arm-amlogic-change-LePotato-compatib.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ede3e8a62e0782de396c9ef096e16c6e78fc4b5f Mon Sep 17 00:00:00 2001 -From: Christian Hewitt -Date: Mon, 26 Aug 2019 02:42:56 +0000 -Subject: [PATCH 185/187] WIP: dt-bindings: arm: amlogic: change LePotato - compatible - -Signed-off-by: Christian Hewitt ---- - Documentation/devicetree/bindings/arm/amlogic.yaml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml -index 49db2767b02b..420626b2de7f 100644 ---- a/Documentation/devicetree/bindings/arm/amlogic.yaml -+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -95,7 +95,7 @@ properties: - - amlogic,p212 - - hwacom,amazetv - - khadas,vim -- - libretech,cc -+ - libretech,lepotato - - nexbox,a95x - - seirobotics,sei510 - - const: amlogic,s905x --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0186-lafrite-audio.patch b/packages/linux/patches/amlogic/amlogic-0186-lafrite-audio.patch deleted file mode 100644 index 624828f13c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0186-lafrite-audio.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 371457288f9eaa301b312454bd3bc095bc440891 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 24 Aug 2019 12:25:01 +0000 -Subject: [PATCH 186/187] lafrite audio - ---- - .../amlogic/meson-gxl-s805x-libretech-ac.dts | 37 +++++++++++++++++++ - 1 file changed, 37 insertions(+) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -index bc7138b7fdc6..43757f327a89 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -@@ -105,6 +105,43 @@ - vin-supply = <&vcc_3v3>; - regulator-always-on; - }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "meson-gx-audio"; -+ -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; -+ assigned-clock-parents = <0>, <0>, <0>; -+ assigned-clock-rates = <294912000>, -+ <270950400>, -+ <393216000>; -+ -+ simple-audio-card,dai-link@0 { -+ /* HDMI Output */ -+ format = "i2s"; -+ mclk-fs = <256>; -+ bitclock-master = <&aiu_i2s>; -+ frame-master = <&aiu_i2s>; -+ -+ cpu { -+ sound-dai = <&aiu_i2s>; -+ }; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+}; -+ -+&audio { -+ status = "okay"; -+}; -+ -+&aiu_i2s { -+ status = "okay"; - }; - - &cec_AO { --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0187-lafrite-AMLGX.patch b/packages/linux/patches/amlogic/amlogic-0187-lafrite-AMLGX.patch deleted file mode 100644 index 7542f7f4b6..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0187-lafrite-AMLGX.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fa8cb67226b8e144eca935b96d98065203a2a414 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sat, 24 Aug 2019 12:26:01 +0000 -Subject: [PATCH 187/187] lafrite AMLGX - ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -index 43757f327a89..f21e015150a6 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -@@ -108,7 +108,7 @@ - - sound { - compatible = "simple-audio-card"; -- simple-audio-card,name = "meson-gx-audio"; -+ simple-audio-card,name = "AMLGX"; - - assigned-clocks = <&clkc CLKID_MPLL2>, - <&clkc CLKID_MPLL0>, --- -2.17.1 - diff --git a/packages/mediacenter/kodi/patches/kodi-999.16-disable-beelink-mouse.patch b/packages/mediacenter/kodi/patches/kodi-999.16-disable-beelink-mouse.patch new file mode 100644 index 0000000000..5e3bfe592c --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-999.16-disable-beelink-mouse.patch @@ -0,0 +1,13 @@ +diff --git a/system/peripherals.xml b/system/peripherals.xml +index ff303e99ae..4d7306b0ce 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -42,7 +42,7 @@ + Since libCEC is now used to scan for devices, the warning will not be displayed without this mapping --> + + +- ++ + + + diff --git a/packages/sysutils/busybox/scripts/dtfile b/packages/sysutils/busybox/scripts/dtfile index 96fa8a8f87..8fd21c64f8 100755 --- a/packages/sysutils/busybox/scripts/dtfile +++ b/packages/sysutils/busybox/scripts/dtfile @@ -8,10 +8,10 @@ COMPATIBLE=$(cat /proc/device-tree/compatible 2>/dev/null | tr -d '\000' | sed - if [ -n "$COMPATIBLE" ]; then if [ -e /flash/extlinux/extlinux.conf ]; then DTFILE=$(grep FDT /flash/extlinux/extlinux.conf | sed 's, *FDT /,,g') - elif [ -e /flash/boot.ini ]; then - DTFILE=$(grep -m 1 dtb_name /flash/boot.ini | cut -d \" -f2 | sed 's,/dtb/,,g') elif [ -e /flash/uEnv.ini ]; then DTFILE=$(grep dtb_name /flash/uEnv.ini | sed 's,dtb_name=/dtb/,,g') + elif [ -e /flash/boot.ini ]; then + DTFILE=$(grep -m 1 dtb_name /flash/boot.ini | cut -d \" -f2 | sed 's,/dtb/,,g') else DTFILE="" fi diff --git a/packages/tools/amlogic-boot-fip/package.mk b/packages/tools/amlogic-boot-fip/package.mk index 4dad3dec0a..9a6fe09060 100644 --- a/packages/tools/amlogic-boot-fip/package.mk +++ b/packages/tools/amlogic-boot-fip/package.mk @@ -3,62 +3,10 @@ PKG_NAME="amlogic-boot-fip" PKG_LICENSE="nonfree" -PKG_SITE="" -PKG_LONGDESC="Amlogic Boot Firmare files used to wrap U-Boot to provide a functional boot blob" +PKG_SITE="https://github.com/LibreELEC/amlogic-boot-fip" +PKG_VERSION="b4587c01df1d81be5935402b079b0f92ef2933c0" +PKG_SHA256="" +PKG_URL="https://github.com/LibreELEC/amlogic-boot-fip/archive/${PKG_VERSION}.tar.gz" +PKG_LONGDESC="Firmware Image Package (FIP) sources used to sign Amlogic u-boot binaries in LibreELEC images" PKG_TOOLCHAIN="manual" PKG_STAMP="$UBOOT_SYSTEM" - -case "$UBOOT_SYSTEM" in - khadas-vim) - PKG_VERSION="20180207" - PKG_SHA256="8dfdf0a267bbedde2229f22d41f0573f67a182a2bb4852db3baae884315f5acc" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/khadas-vim_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; - khadas-vim2) - PKG_VERSION="20180207" - PKG_SHA256="3631fcb22e34878d751d2b7e55c02043818afc2c152534a7e2ac794b676b002e" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/khadas-vim2_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; - lafrite) - PKG_VERSION="20180418" - PKG_SHA256="36079b23eac2764290395764b609170420229d925219fce506f542cb39115346" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/libretech-ac_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; - lepotato) - PKG_VERSION="20180418" - PKG_SHA256="fdba17b469396e55e296f5e8ea5cdee1877f3eebc8cd6e0e301841a326fbaf53" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/libretech-cc_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; - nanopi-k2) - PKG_VERSION="20170412" - PKG_SHA256="4b5778098ca2a4f7ade06db7752ec9f77775d67e438d6fba0c669a4959ff7200" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/nanopi-k2_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; - odroid-c2) - PKG_VERSION="s905_6.0.1_v3.7" - PKG_SHA256="3ee700fd3a6439997060ac6d21217b0adba3a801876707fae70988f8ce6c3fef" - PKG_URL="https://github.com/hardkernel/u-boot/archive/${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="u-boot-${PKG_VERSION}" - ;; - odroid-n2) - PKG_VERSION="20190220" - PKG_SHA256="48fd24c347758feb432adc1aef13c58be5fcaab65809146bed5796d4075c2e19" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/odroid-n2_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; - *|p212) - PKG_VERSION="20170606" - PKG_SHA256="957c96037bcd792a4139cc33eded2f006d55a82c0c56ae69ef43bdcb76a255e2" - PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/p212_fip_${PKG_VERSION}.tar.gz" - PKG_SOURCE_DIR="fip" - ;; -esac - -post_unpack() { - rm -f $PKG_BUILD/acs_tool.pyc -} diff --git a/packages/tools/amlogic-boot-fip/sources/acs_tool.py b/packages/tools/amlogic-boot-fip/sources/acs_tool.py deleted file mode 100755 index 9cb46fe1c0..0000000000 --- a/packages/tools/amlogic-boot-fip/sources/acs_tool.py +++ /dev/null @@ -1,134 +0,0 @@ -# uncompyle6 version 3.2.4 -# Python bytecode 2.7 (62211) -# Decompiled from: Python 3.6.7 (default, Nov 3 2018, 21:32:46) -# [GCC 8.2.0] -# Embedded file name: acs_tool.py -# Compiled at: 2015-09-17 07:30:19 -import sys, os, os.path, json -from struct import * -import codecs, shutil, copy, collections -ENTRY_POINT_OFFSET = 4 -BL2_HEADER_OFFSET = 4096 -ACS_TOOL_VERSION = 1 -acs_v1 = collections.OrderedDict() -acs_v1['acs_magic'] = 'acs__' -acs_v1['chip_type'] = 1 -acs_v1['version'] = 2 -acs_v1['acs_set_length'] = 8 -acs_v1['ddr_magic'] = 'ddrs_' -acs_v1['ddr_set_version'] = 1 -acs_v1['ddr_set_length'] = 2 -acs_v1['ddr_set_addr'] = 8 -acs_v1['ddrt_magic'] = 'ddrt_' -acs_v1['ddrt_set_version'] = 1 -acs_v1['ddrt_set_length'] = 2 -acs_v1['ddrt_set_addr'] = 8 -acs_v1['pll_magic'] = 'pll__' -acs_v1['pll_set_version'] = 1 -acs_v1['pll_set_length'] = 2 -acs_v1['pll_set_addr'] = 8 -check_excepts = [ - 'ddr_set_addr', 'ddrt_set_addr', 'pll_set_addr'] -check_excepts_length = ['ddr_set_length', 'ddrt_set_length', 'pll_set_length'] -key_versions = ['version', 'ddr_set_version', 'ddrt_set_version', 'pll_set_version'] - -class acs_tool(object): - - def __init__(self, file_des, file_des_tmp, file_src, debug): - self.debug = int(debug) - self.file_des = file_des - self.file_src = file_src - self.file_des_tmp = file_des_tmp - self.acs_des = copy.deepcopy(acs_v1) - self.acs_src = copy.deepcopy(acs_v1) - self.acs_base = copy.deepcopy(acs_v1) - - def init_acs(self, acs_struct, file_name, bl2): - seek_position = 0 - file_handler = open(file_name, 'rb') - file_handler.seek(ENTRY_POINT_OFFSET) - acs_entry_point, = unpack('H', file_handler.read(2)) - acs_entry_point -= bl2 * BL2_HEADER_OFFSET - seek_position = acs_entry_point - self.log_print(file_name) - for key in list(acs_struct.keys()): - file_handler.seek(seek_position) - if isinstance(acs_struct[key], str): - seek_position += len(acs_struct[key]) - acs_struct[key] = file_handler.read(len(acs_struct[key])).decode('utf-8') - else: - if isinstance(acs_struct[key], int): - seek_position += acs_struct[key] - if 1 == acs_struct[key]: - acs_struct[key], = unpack('B', file_handler.read(1)) - else: - acs_struct[key], = unpack('H', file_handler.read(2)) - if key in check_excepts: - acs_struct[key] -= bl2 * BL2_HEADER_OFFSET - self.log_print(key + ' ' + str(acs_struct[key])) - - file_handler.close() - - def check_acs(self): - err_counter = 0 - for key in list(self.acs_des.keys()): - if self.acs_des[key] != self.acs_src[key] and key not in check_excepts: - print("Warning! ACS %s doesn't match!! %s/%s" % (key, self.acs_des[key], self.acs_src[key])) - - for key in key_versions: - if self.acs_des[key] > self.acs_src[key]: - self.acs_des[key] = self.acs_src[key] - print('Warning! ACS src %s too old!' % key) - - for key in list(self.acs_base.keys()): - if isinstance(self.acs_base[key], str): - if self.acs_des[key] != self.acs_base[key]: - err_counter += 1 - print('Error! ACS DES %s error!! Value: %s, Expect: %s' % (key, self.acs_des[key], self.acs_base[key])) - if self.acs_src[key] != self.acs_base[key]: - err_counter += 1 - print('Error! ACS DES %s error!! Value: %s, Expect: %s' % (key, self.acs_src[key], self.acs_base[key])) - - if self.acs_des['version'] > ACS_TOOL_VERSION: - print('Error! Please update acs tool! v%s>v%s' % (self.acs_des['version'], ACS_TOOL_VERSION)) - err_counter += 1 - return err_counter - - def copy_data(self): - file_des = open(self.file_des_tmp, 'r+b') - file_src = open(self.file_src, 'rb') - for key_addr, key_length in zip(check_excepts, check_excepts_length): - file_des.seek(self.acs_des[key_addr]) - file_src.seek(self.acs_src[key_addr]) - file_des.write(file_src.read(self.acs_des[key_length])) - - file_des.close() - file_src.close() - return 0 - - def run(self): - shutil.copyfile(self.file_des, self.file_des_tmp) - self.init_acs(self.acs_des, self.file_des_tmp, 1) - self.init_acs(self.acs_src, self.file_src, 0) - if self.check_acs(): - print('ACS check failed! Compile Abort!') - return -1 - self.copy_data() - print('ACS tool process done.') - - def log_print(self, log): - if self.debug: - print(log) - - -if __name__ == '__main__': - if sys.argv[1] == '--help' or sys.argv[1] == '-help': - print('acs_tool.py [bl2.bin] [bl2_tmp.bin] [acs.bin] [debug(1/0)]') - exit(1) - if len(sys.argv) != 5: - print('acs_tool.py [bl2.bin] [bl2_tmp.bin] [acs.bin] [debug(1/0)]') - exit(1) - tool = acs_tool(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) - if tool.run(): - exit(1) -# okay decompiling acs_tool.pyc diff --git a/packages/tools/u-boot/patches/u-boot-0001-khadas-vim3l.patch b/packages/tools/u-boot/patches/u-boot-0001-khadas-vim3l.patch new file mode 100644 index 0000000000..e8d9f35425 --- /dev/null +++ b/packages/tools/u-boot/patches/u-boot-0001-khadas-vim3l.patch @@ -0,0 +1,257 @@ +commit 29b1265c75d65900b25ae2dfd90e9a55565ea4c7 +Author: chewitt +Date: Fri Dec 6 06:00:59 2019 +0000 + + ARM: dts: Import Khadas VIM3L DT from Linux 5.5-rc1 + +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index 3dc9c4d41c..b6c9f821ee 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -152,6 +152,7 @@ dtb-$(CONFIG_ARCH_MESON) += \ + meson-g12a-sei510.dtb \ + meson-g12b-odroid-n2.dtb \ + meson-g12b-a311d-khadas-vim3.dtb \ ++ meson-sm1-khadas-vim3l.dtb \ + meson-sm1-sei610.dtb + dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \ + tegra20-medcom-wide.dtb \ +diff --git a/arch/arm/dts/meson-sm1-khadas-vim3l.dts b/arch/arm/dts/meson-sm1-khadas-vim3l.dts +new file mode 100644 +index 0000000000..dbbf29a0db +--- /dev/null ++++ b/arch/arm/dts/meson-sm1-khadas-vim3l.dts +@@ -0,0 +1,95 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 BayLibre, SAS ++ * Author: Neil Armstrong ++ */ ++ ++/dts-v1/; ++ ++#include "meson-sm1.dtsi" ++#include "meson-khadas-vim3.dtsi" ++ ++/ { ++ compatible = "khadas,vim3l", "amlogic,sm1"; ++ model = "Khadas VIM3L"; ++ ++ vddcpu: regulator-vddcpu { ++ /* ++ * Silergy SY8030DEC Regulator. ++ */ ++ compatible = "pwm-regulator"; ++ ++ regulator-name = "VDDCPU"; ++ regulator-min-microvolt = <690000>; ++ regulator-max-microvolt = <1050000>; ++ ++ vin-supply = <&vsys_3v3>; ++ ++ pwms = <&pwm_AO_cd 1 1250 0>; ++ pwm-dutycycle-range = <100 0>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU1_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU2_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vddcpu>; ++ operating-points-v2 = <&cpu_opp_table>; ++ clocks = <&clkc CLKID_CPU3_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&pwm_AO_cd { ++ pinctrl-0 = <&pwm_ao_d_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin1"; ++ status = "okay"; ++}; ++ ++/* ++ * The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential ++ * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between ++ * an USB3.0 Type A connector and a M.2 Key M slot. ++ * The PHY driving these differential lines is shared between ++ * the USB3.0 controller and the PCIe Controller, thus only ++ * a single controller can use it. ++ * If the MCU is configured to mux the PCIe/USB3.0 differential lines ++ * to the M.2 Key M slot, uncomment the following block to disable ++ * USB3.0 from the USB Complex and enable the PCIe controller. ++ * The End User is not expected to uncomment the following except for ++ * testing purposes, but instead rely on the firmware/bootloader to ++ * update these nodes accordingly if PCIe mode is selected by the MCU. ++ */ ++/* ++&pcie { ++ status = "okay"; ++}; ++ ++&usb { ++ phys = <&usb2_phy0>, <&usb2_phy1>; ++ phy-names = "usb2-phy0", "usb2-phy1"; ++}; ++ */ +diff --git a/board/amlogic/w400/README.khadas-vim3l b/board/amlogic/w400/README.khadas-vim3l +new file mode 100644 +index 0000000000..a9b01ef85b +--- /dev/null ++++ b/board/amlogic/w400/README.khadas-vim3l +@@ -0,0 +1,132 @@ ++U-Boot for Khadas VIM3L ++======================= ++ ++Khadas VIM3 is a single board computer manufactured by Shenzhen Wesion ++Technology Co., Ltd. with the following specifications: ++ ++ - Amlogic S905D3 Arm Cortex-A55 quad-core SoC ++ - 2GB LPDDR4 SDRAM ++ - Gigabit Ethernet ++ - HDMI 2.1 display ++ - 40-pin GPIO header ++ - 1 x USB 3.0 Host, 1 x USB 2.0 Host ++ - eMMC, microSD ++ - M.2 ++ - Infrared receiver ++ ++Schematics are available on the manufacturer website. ++ ++Currently the U-Boot port supports the following devices: ++ - serial ++ - eMMC, microSD ++ - Ethernet ++ - I2C ++ - Regulators ++ - Reset controller ++ - Clock controller ++ - ADC ++ ++u-boot compilation ++================== ++ ++ > export ARCH=arm ++ > export CROSS_COMPILE=aarch64-none-elf- ++ > make khadas-vim3l_defconfig ++ > make ++ ++Image creation ++============== ++ ++Amlogic doesn't provide sources for the firmware and for tools needed ++to create the bootloader image, so it is necessary to obtain them from ++the git tree published by the board vendor: ++ ++ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz ++ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz ++ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz ++ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz ++ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH ++ ++ > DIR=vim3l-u-boot ++ > git clone --depth 1 \ ++ https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \ ++ $DIR ++ ++ > cd vim3-u-boot ++ > make kvim3l_defconfig ++ > make ++ > export UBOOTDIR=$PWD ++ ++ Go back to mainline U-Boot source tree then : ++ > mkdir fip ++ ++ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/ ++ > cp $UBOOTDIR/build/board/khadas/kvim3/firmware/acs.bin fip/ ++ > cp $UBOOTDIR/fip/g12b/bl2.bin fip/ ++ > cp $UBOOTDIR/fip/g12b/bl30.bin fip/ ++ > cp $UBOOTDIR/fip/g12b/bl31.img fip/ ++ > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/lpddr3_1d.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/piei.fw fip/ ++ > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/ ++ > cp u-boot.bin fip/bl33.bin ++ ++ > sh fip/blx_fix.sh \ ++ fip/bl30.bin \ ++ fip/zero_tmp \ ++ fip/bl30_zero.bin \ ++ fip/bl301.bin \ ++ fip/bl301_zero.bin \ ++ fip/bl30_new.bin \ ++ bl30 ++ ++ > sh fip/blx_fix.sh \ ++ fip/bl2.bin \ ++ fip/zero_tmp \ ++ fip/bl2_zero.bin \ ++ fip/acs.bin \ ++ fip/bl21_zero.bin \ ++ fip/bl2_new.bin \ ++ bl2 ++ ++ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \ ++ --output fip/bl30_new.bin.g12a.enc \ ++ --level v3 ++ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \ ++ --output fip/bl30_new.bin.enc \ ++ --level v3 --type bl30 ++ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \ ++ --output fip/bl31.img.enc \ ++ --level v3 --type bl31 ++ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \ ++ --output fip/bl33.bin.enc \ ++ --level v3 --type bl33 --compress lz4 ++ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \ ++ --output fip/bl2.n.bin.sig ++ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \ ++ --output fip/u-boot.bin \ ++ --bl2 fip/bl2.n.bin.sig \ ++ --bl30 fip/bl30_new.bin.enc \ ++ --bl31 fip/bl31.img.enc \ ++ --bl33 fip/bl33.bin.enc \ ++ --ddrfw1 fip/ddr4_1d.fw \ ++ --ddrfw2 fip/ddr4_2d.fw \ ++ --ddrfw3 fip/ddr3_1d.fw \ ++ --ddrfw4 fip/piei.fw \ ++ --ddrfw5 fip/lpddr4_1d.fw \ ++ --ddrfw6 fip/lpddr4_2d.fw \ ++ --ddrfw7 fip/diag_lpddr4.fw \ ++ --ddrfw8 fip/aml_ddr.fw \ ++ --ddrfw9 fip/lpddr3_1d.fw \ ++ --level v3 ++ ++and then write the image to SD with: ++ ++ > DEV=/dev/your_sd_device ++ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 ++ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444 diff --git a/packages/tools/u-boot/patches/u-boot-0002-khadas-vim3l.patch b/packages/tools/u-boot/patches/u-boot-0002-khadas-vim3l.patch new file mode 100644 index 0000000000..14a4532207 --- /dev/null +++ b/packages/tools/u-boot/patches/u-boot-0002-khadas-vim3l.patch @@ -0,0 +1,74 @@ +commit 97bb89d8cddd29b539708f16a90ddcf1594dac22 +Author: chewitt +Date: Fri Dec 6 05:47:30 2019 +0000 + + boards: amlogic: add Khadas VIM3L support + +diff --git a/configs/khadas-vim3l_defconfig b/configs/khadas-vim3l_defconfig +new file mode 100644 +index 0000000000..51e0f80dfd +--- /dev/null ++++ b/configs/khadas-vim3l_defconfig +@@ -0,0 +1,62 @@ ++CONFIG_ARM=y ++CONFIG_SYS_BOARD="w400" ++CONFIG_ARCH_MESON=y ++CONFIG_SYS_TEXT_BASE=0x01000000 ++CONFIG_MESON_G12A=y ++CONFIG_ENV_SIZE=0x2000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEBUG_UART_BASE=0xff803000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_IDENT_STRING=" khadas-vim3l" ++CONFIG_DEBUG_UART=y ++CONFIG_OF_BOARD_SETUP=y ++CONFIG_MISC_INIT_R=y ++# CONFIG_DISPLAY_CPUINFO is not set ++# CONFIG_CMD_BDI is not set ++# CONFIG_CMD_IMI is not set ++CONFIG_CMD_GPIO=y ++# CONFIG_CMD_LOADS is not set ++CONFIG_CMD_MMC=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_USB_MASS_STORAGE=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_REGULATOR=y ++CONFIG_OF_CONTROL=y ++CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-khadas-vim3l" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_DM_GPIO=y ++CONFIG_DM_MMC=y ++CONFIG_MMC_MESON_GX=y ++CONFIG_PHY_REALTEK=y ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_MESON_G12A_USB_PHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCTRL_MESON_G12A=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MESON_EE_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_RESET=y ++CONFIG_DEBUG_UART_MESON=y ++CONFIG_DEBUG_UART_ANNOUNCE=y ++CONFIG_DEBUG_UART_SKIP_INIT=y ++CONFIG_MESON_SERIAL=y ++CONFIG_USB=y ++CONFIG_DM_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_DWC3=y ++# CONFIG_USB_DWC3_GADGET is not set ++CONFIG_USB_DWC3_MESON_G12A=y ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e ++CONFIG_USB_GADGET_PRODUCT_NUM=0xfada ++CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y ++CONFIG_USB_GADGET_DOWNLOAD=y ++CONFIG_DM_VIDEO=y ++CONFIG_VIDEO_MESON=y ++CONFIG_VIDEO_DT_SIMPLEFB=y ++CONFIG_OF_LIBFDT_OVERLAY=y diff --git a/projects/Amlogic/bootloader/install b/projects/Amlogic/bootloader/install index 40e269023a..0e6f580bda 100644 --- a/projects/Amlogic/bootloader/install +++ b/projects/Amlogic/bootloader/install @@ -6,36 +6,100 @@ echo "$BOOTLOADER: creating u-boot.bin" DESTDIR="$PKG_BUILD/fip" mkdir -p $DESTDIR -FIPDIR="$(get_build_dir amlogic-boot-fip)" +FIPDIR="$(get_build_dir amlogic-boot-fip)/$UBOOT_SYSTEM" case "${UBOOT_SYSTEM}" in box|"") - # No-op, use vendor booloader + # no-op, use vendor booloader + ;; + + khadas-vim3*) + if [ "$UBOOT_SYSTEM" = "khadas-vim3" ]; then + AML_ENCRYPT_BIN="aml_encrypt_g12b" + else + AML_ENCRYPT_BIN="aml_encrypt_g12a" + fi + cp $FIPDIR/bl301.bin $DESTDIR/ + cp $FIPDIR/acs.bin $DESTDIR/ + cp $FIPDIR/aml_ddr.fw $DESTDIR/ + cp $FIPDIR/bl2.bin $DESTDIR/ + cp $FIPDIR/bl30.bin $DESTDIR/ + cp $FIPDIR/bl31.img $DESTDIR/ + cp $FIPDIR/blx_fix.sh $DESTDIR/ + cp $FIPDIR/ddr3_1d.fw $DESTDIR/ + cp $FIPDIR/ddr4_1d.fw $DESTDIR/ + cp $FIPDIR/ddr4_2d.fw $DESTDIR/ + cp $FIPDIR/diag_lpddr4.fw $DESTDIR/ + cp $FIPDIR/lpddr3_1d.fw $DESTDIR/ + cp $FIPDIR/lpddr4_1d.fw $DESTDIR/ + cp $FIPDIR/lpddr4_2d.fw $DESTDIR/ + cp $FIPDIR/piei.fw $DESTDIR/ + cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin + + $FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \ + $DESTDIR/zero_tmp \ + $DESTDIR/bl30_zero.bin \ + $DESTDIR/bl301.bin \ + $DESTDIR/bl301_zero.bin \ + $DESTDIR/bl30_new.bin bl30 + + $FIPDIR/blx_fix.sh $DESTDIR/bl2.bin \ + $DESTDIR/zero_tmp \ + $DESTDIR/bl2_zero.bin \ + $DESTDIR/acs.bin \ + $DESTDIR/bl21_zero.bin \ + $DESTDIR/bl2_new.bin bl2 + + $FIPDIR/$AML_ENCRYPT_BIN --bl30sig --input $DESTDIR/bl30_new.bin \ + --output $DESTDIR/bl30_new.bin.g12a.enc \ + --level v3 + $FIPDIR/$AML_ENCRYPT_BIN --bl3sig --input $DESTDIR/bl30_new.bin.g12a.enc \ + --output $DESTDIR/bl30_new.bin.enc \ + --level v3 --type bl30 + $FIPDIR/$AML_ENCRYPT_BIN --bl3sig --input $DESTDIR/bl31.img \ + --output $DESTDIR/bl31.img.enc \ + --level v3 --type bl31 + $FIPDIR/$AML_ENCRYPT_BIN --bl3sig --input $DESTDIR/bl33.bin --compress lz4 \ + --output $DESTDIR/bl33.bin.enc \ + --level v3 --type bl33 --compress lz4 + $FIPDIR/$AML_ENCRYPT_BIN --bl2sig --input $DESTDIR/bl2_new.bin \ + --output $DESTDIR/bl2.n.bin.sig + $FIPDIR/$AML_ENCRYPT_BIN --bootmk \ + --output $DESTDIR/u-boot.bin \ + --bl2 $DESTDIR/bl2.n.bin.sig \ + --bl30 $DESTDIR/bl30_new.bin.enc \ + --bl31 $DESTDIR/bl31.img.enc \ + --bl33 $DESTDIR/bl33.bin.enc \ + --ddrfw1 $DESTDIR/ddr4_1d.fw \ + --ddrfw2 $DESTDIR/ddr4_2d.fw \ + --ddrfw3 $DESTDIR/ddr3_1d.fw \ + --ddrfw4 $DESTDIR/piei.fw \ + --ddrfw5 $DESTDIR/lpddr4_1d.fw \ + --ddrfw6 $DESTDIR/lpddr4_2d.fw \ + --ddrfw7 $DESTDIR/diag_lpddr4.fw \ + --ddrfw8 $DESTDIR/aml_ddr.fw \ + --ddrfw9 $DESTDIR/lpddr3_1d.fw \ + --level v3 ;; odroid-c2) - FIPDIR+="/fip" - FUSEDIR="$(get_build_dir amlogic-boot-fip)/sd_fuse" - - $FIPDIR/fip_create --bl30 $FIPDIR/gxb/bl30.bin \ - --bl301 $FIPDIR/gxb/bl301.bin \ - --bl31 $FIPDIR/gxb/bl31.bin \ - --bl33 u-boot.bin $DESTDIR/fip.bin + $FIPDIR/fip_create --bl30 $FIPDIR/bl30.bin \ + --bl301 $FIPDIR/bl301.bin \ + --bl31 $FIPDIR/bl31.bin \ + --bl33 $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/fip.bin $FIPDIR/fip_create --dump $DESTDIR/fip.bin - cat $FIPDIR/gxb/bl2.package $DESTDIR/fip.bin > $DESTDIR/boot_new.bin - - $FIPDIR/gxb/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.img + cat $FIPDIR/bl2.package $DESTDIR/fip.bin > $DESTDIR/boot_new.bin + $FIPDIR/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.img dd if=$DESTDIR/u-boot.img of=$DESTDIR/u-boot.gxbb bs=512 skip=96 - dd if=$FUSEDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=1 count=442 - dd if=$FUSEDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 skip=1 seek=1 + dd if=$FIPDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=1 count=442 + dd if=$FIPDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 skip=1 seek=1 dd if=$DESTDIR/u-boot.gxbb of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 seek=97 ;; odroid-n2) - chmod +x $FIPDIR/blx_fix.sh cp $FIPDIR/bl301.bin $DESTDIR/ cp $FIPDIR/acs.bin $DESTDIR/ cp $FIPDIR/aml_ddr.fw $DESTDIR/ @@ -50,7 +114,7 @@ case "${UBOOT_SYSTEM}" in cp $FIPDIR/lpddr4_1d.fw $DESTDIR/ cp $FIPDIR/lpddr4_2d.fw $DESTDIR/ cp $FIPDIR/piei.fw $DESTDIR/ - cp u-boot.bin $DESTDIR/bl33.bin + cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin $FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \ $DESTDIR/zero_tmp \ @@ -98,13 +162,13 @@ case "${UBOOT_SYSTEM}" in ;; nanopi-k2) - cp $FIPDIR/gxb/bl2.bin $DESTDIR/ - cp $FIPDIR/gxb/acs.bin $DESTDIR/ - cp $FIPDIR/gxb/bl21.bin $DESTDIR/ - cp $FIPDIR/gxb/bl30.bin $DESTDIR/ - cp $FIPDIR/gxb/bl301.bin $DESTDIR/ - cp $FIPDIR/gxb/bl31.img $DESTDIR/ - cp u-boot.bin $DESTDIR/bl33.bin + cp $FIPDIR/bl2.bin $DESTDIR/ + cp $FIPDIR/acs.bin $DESTDIR/ + cp $FIPDIR/bl21.bin $DESTDIR/ + cp $FIPDIR/bl30.bin $DESTDIR/ + cp $FIPDIR/bl301.bin $DESTDIR/ + cp $FIPDIR/bl31.img $DESTDIR/ + cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin $FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \ $DESTDIR/zero_tmp \ @@ -133,17 +197,17 @@ case "${UBOOT_SYSTEM}" in cat $DESTDIR/bl2_new.bin $DESTDIR/fip.bin > $DESTDIR/boot_new.bin - $FIPDIR/gxb/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.bin + $FIPDIR/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.bin ;; - *) - cp $FIPDIR/gxl/bl2.bin $DESTDIR/ - cp $FIPDIR/gxl/acs.bin $DESTDIR/ - cp $FIPDIR/gxl/bl21.bin $DESTDIR/ - cp $FIPDIR/gxl/bl30.bin $DESTDIR/ - cp $FIPDIR/gxl/bl301.bin $DESTDIR/ - cp $FIPDIR/gxl/bl31.img $DESTDIR/ - cp u-boot.bin $DESTDIR/bl33.bin + *) # GXL/GXM + cp $FIPDIR/bl2.bin $DESTDIR/ + cp $FIPDIR/acs.bin $DESTDIR/ + cp $FIPDIR/bl21.bin $DESTDIR/ + cp $FIPDIR/bl30.bin $DESTDIR/ + cp $FIPDIR/bl301.bin $DESTDIR/ + cp $FIPDIR/bl31.img $DESTDIR/ + cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin $FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \ $DESTDIR/zero_tmp \ @@ -161,11 +225,11 @@ case "${UBOOT_SYSTEM}" in $DESTDIR/bl21_zero.bin \ $DESTDIR/bl2_new.bin bl2 - $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl30_new.bin - $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl31.img - $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl33.bin - $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input $DESTDIR/bl2_new.bin --output $DESTDIR/bl2.n.bin.sig - $FIPDIR/gxl/aml_encrypt_gxl --bootmk --output $DESTDIR/u-boot.bin --bl2 $DESTDIR/bl2.n.bin.sig --bl30 $DESTDIR/bl30_new.bin.enc --bl31 $DESTDIR/bl31.img.enc --bl33 $DESTDIR/bl33.bin.enc + $FIPDIR/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl30_new.bin + $FIPDIR/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl31.img + $FIPDIR/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl33.bin + $FIPDIR/aml_encrypt_gxl --bl2sig --input $DESTDIR/bl2_new.bin --output $DESTDIR/bl2.n.bin.sig + $FIPDIR/aml_encrypt_gxl --bootmk --output $DESTDIR/u-boot.bin --bl2 $DESTDIR/bl2.n.bin.sig --bl30 $DESTDIR/bl30_new.bin.enc --bl31 $DESTDIR/bl31.img.enc --bl33 $DESTDIR/bl33.bin.enc ;; esac @@ -189,3 +253,4 @@ fi if find_file_path bootloader/${UBOOT_SYSTEM}.ini; then cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader/boot.ini fi + diff --git a/projects/Amlogic/bootloader/release b/projects/Amlogic/bootloader/release index af0bd402f0..e10e15b2ca 100644 --- a/projects/Amlogic/bootloader/release +++ b/projects/Amlogic/bootloader/release @@ -21,6 +21,7 @@ mkdir -p "$DSTDIR/dtb" AMLG12) cp -a "$SRCDIR"/*g12a*.dtb "$DSTDIR/dtb" cp -a "$SRCDIR"/*g12b*.dtb "$DSTDIR/dtb" + cp -a "$SRCDIR"/*sm1*.dtb "$DSTDIR/dtb" ;; *) cp -a "$SRCDIR"/*.dtb "$DSTDIR/dtb" diff --git a/projects/Amlogic/bootloader/scripts/s905_autoscript.src b/projects/Amlogic/bootloader/scripts/s905_autoscript.src index 538c810736..8b83de1748 100644 --- a/projects/Amlogic/bootloader/scripts/s905_autoscript.src +++ b/projects/Amlogic/bootloader/scripts/s905_autoscript.src @@ -1,3 +1,5 @@ +if fatload mmc 0 0x1000000 u-boot.ext; then go 0x1000000; fi; +if fatload usb 0 0x1000000 u-boot.ext; then go 0x1000000; fi; setenv env_addr 0x1040000 setenv boot_start 'bootm ${loadaddr} - ${dtb_mem_addr}' setenv addmac 'if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; fi' diff --git a/projects/Amlogic/bootloader/update.sh b/projects/Amlogic/bootloader/update.sh index 924fc1d704..41df972da5 100644 --- a/projects/Amlogic/bootloader/update.sh +++ b/projects/Amlogic/bootloader/update.sh @@ -27,7 +27,7 @@ for dtbfile in $BOOT_ROOT/*.dtb ; do dtb=$(basename $dtbfile) echo "Updating $dtb" - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/ 2>/dev/null || true done fi diff --git a/projects/Amlogic/config/kernel-firmware.dat b/projects/Amlogic/config/kernel-firmware.dat index e69de29bb2..c291f3b716 100644 --- a/projects/Amlogic/config/kernel-firmware.dat +++ b/projects/Amlogic/config/kernel-firmware.dat @@ -0,0 +1,5 @@ +ath9k_htc +mediatek/mt7668pr2h.bin +rtlwifi/rtl8192cufw_TMSC.bin +rtlwifi/rtl8192cufw.bin +meson diff --git a/projects/Amlogic/devices/AMLG12/options b/projects/Amlogic/devices/AMLG12/options index 6a43ebe9db..319a48fb87 100644 --- a/projects/Amlogic/devices/AMLG12/options +++ b/projects/Amlogic/devices/AMLG12/options @@ -21,21 +21,6 @@ ;; esac - # Kernel target - KERNEL_TARGET="uImage.lzo" - - # Kernel uImage load address - KERNEL_UIMAGE_LOADADDR="0x1980000" - - # Kernel uImage entry address - KERNEL_UIMAGE_ENTRYADDR="0x1980000" - - # Additional kernel make parameters - KERNEL_MAKE_EXTRACMD="dtbs" - - # kernel serial console - EXTRA_CMDLINE="console=ttyAML0,115200n8 console=tty0" - # OpenGL-ES implementation to use OPENGLES="libmali" diff --git a/projects/Amlogic/devices/AMLGX/options b/projects/Amlogic/devices/AMLGX/options index 9bab35f01d..f3eac9fba8 100644 --- a/projects/Amlogic/devices/AMLGX/options +++ b/projects/Amlogic/devices/AMLGX/options @@ -21,21 +21,6 @@ ;; esac - # Kernel target - KERNEL_TARGET="uImage.lzo" - - # Kernel uImage load address - KERNEL_UIMAGE_LOADADDR="0x1980000" - - # Kernel uImage entry address - KERNEL_UIMAGE_ENTRYADDR="0x1980000" - - # Additional kernel make parameters - KERNEL_MAKE_EXTRACMD="dtbs" - - # kernel serial console - EXTRA_CMDLINE="console=ttyAML0,115200n8 console=tty0" - # OpenGL-ES implementation to use OPENGLES="mesa" @@ -47,3 +32,7 @@ # Mali GPU family MALI_FAMILY="450 t820" + + # set the addon dirs + ADDON_PATH="$ADDON_VERSION/AMLG12/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" diff --git a/projects/Amlogic/filesystem/usr/bin/cputemp b/projects/Amlogic/filesystem/usr/bin/cputemp index 801603b096..312f817d74 100755 --- a/projects/Amlogic/filesystem/usr/bin/cputemp +++ b/projects/Amlogic/filesystem/usr/bin/cputemp @@ -4,7 +4,7 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) case $(dtsoc) in - amlogic,g12*) + amlogic,g12*|amlogic,sm1) TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone1/temp) ;; *) diff --git a/projects/Amlogic/filesystem/usr/bin/emmctool b/projects/Amlogic/filesystem/usr/bin/emmctool index 29830e17bf..66dfeae564 100755 --- a/projects/Amlogic/filesystem/usr/bin/emmctool +++ b/projects/Amlogic/filesystem/usr/bin/emmctool @@ -3,95 +3,229 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) -BOOT=$(grep /flash /proc/mounts | awk '{print $1}' | sed 's/p[012]//g') -EMMC=$(ls /dev/mmcblk*rpmb | sed 's/rpmb//g' | head -n 1) +# ** !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! ** +# This script is not supported on generic box devices. If you choose to +# modify it to run on other hardware and you brick your device you will +# receive no support to restore your device. You have been warned! -do_checkboot(){ - case $(dtname) in - khadas,vim|khadas,vim2|libretech*) - if [ "$BOOT" = "$EMMC" ]; then - echo "error: You are booted from the eMMC module!" - exit 1 - fi - ;; - *) - echo "error: Your device is not supported for eMMC boot!" - exit 1 - ;; - esac +do_backup(){ + do_umount + echo "info: compressing ${EMMC} to ${2}, this will take time" + dd if="${EMMC}" | gzip > of="${2}" + echo "info: compressing completed" } do_detect(){ + # used on LibreComputer LePotato/LaFrite where pre-formatted modules + # must be attached after boot (LibreComputer supports this) else the + # device always boots to the pre-formatted OS on the module. echo "info: rebinding d0074000.mmc" echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/unbind echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/bind sleep 1 - parted -s $EMMC unit s print + parted -s "${EMMC}" unit s print } do_info(){ + BOOTINFO=$(dd if="${BOOT}" count=2048 2>/dev/null | strings | grep -e '^U-Boot ' | awk '{print $2}') + EMMCINFO=$(dd if="${EMMC}" count=2048 2>/dev/null | strings | grep -e '^U-Boot ' | awk '{print $2}') echo "" - echo "info: boot device is $BOOT" - echo "info: emmc device is $EMMC" + if [ -n "${BOOTINFO}" ]; then + echo "info: boot device is $BOOT, U-boot version is ${BOOTINFO}" + else + echo "info: boot device is $BOOT" + fi + if [ -n "${EMMCINFO}" ]; then + echo "info: emmc device is $EMMC, U-boot version is ${EMMCINFO}" + else + echo "info: emmc device is $EMMC" + fi + echo "" + parted -s "${EMMC}" print + echo "" +} + +do_labels(){ + if [ -n "${2}" ] && [ -n "${3}" ]; then + BOOTLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }') + DISKLABEL=$(echo "${3}" | awk 'BEGIN { getline; print toupper($0) }') + else + BOOTLABEL="EMMC_BOOT" + DISKLABEL="EMMC_DISK" + fi + echo "info: using boot=LABEL=${BOOTLABEL} and disk=LABEL=${DISKLABEL}" + do_umount + echo "info: changing label values on partitions" + fatlabel "${EMMC}p1" "${BOOTLABEL}" + e2label "${EMMC}p2" "${DISKLABEL}" + sleep 1 + echo "info: remounting ${EMMC}p1 to /var/media/${BOOTLABEL}" + mkdir -p "/var/media/${BOOTLABEL}" + mount "${EMMC}p1" "/var/media/${BOOTLABEL}" + echo "info: remounting ${EMMC}p2 to /var/media/${DISKLABEL}" + mkdir -p "/var/media/${DISKLABEL}" + mount "${EMMC}p2" "/var/media/${DISKLABEL}" + sleep 1 + echo "info: changing label values in extlinux.conf" + sed -i "s/boot=LABEL=\w*/boot=LABEL=${BOOTLABEL}/g" "/var/media/${BOOTLABEL}/extlinux/extlinux.conf" + sed -i "s/disk=LABEL=\w*/disk=LABEL=${DISKLABEL}/g" "/var/media/${BOOTLABEL}/extlinux/extlinux.conf" + sleep 1 + echo "" + blkid | grep "${EMMC}p" + echo "" + cat "/var/media/${BOOTLABEL}/extlinux/extlinux.conf" echo "" - parted -s $EMMC print } do_resize(){ - for mount in $(grep ${EMMC}p2 /proc/mounts | awk '{print $1}'); do + if [ -z "${DISKLABEL}" ]; then + DISKLABEL=$(blkid | grep "${EMMC}"p2 | awk -F'"' '{print $2}') + fi + do_umount + echo "info: resizing partition ${EMMC}p2 to 100%" + parted -s -m "${EMMC}" resizepart 2 100% || parted -s -m "${EMMC}" resizepart 2 yes 100% + sleep 5 + do_umount + echo "info: checking filesystem" + e2fsck -f "${EMMC}p2" + sleep 1 + echo "info: resizing filesystem" + resize2fs "${EMMC}p2" + sync + sleep 1 + echo "info: remounting ${EMMC}p2 to /var/media/${DISKLABEL}" + mkdir -p "/var/media/${DISKLABEL}" + mount "${EMMC}p2" "/var/media/${DISKLABEL}" + sleep 1 + if [ -f "/var/media/${DISKLABEL}/.please_resize_me" ]; then + rm "/var/media/${DISKLABEL}/.please_resize_me" + fi + parted -s "${EMMC}" unit s print +} + +do_storage(){ + if [ -n "${2}" ]; then + DISKLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }') + else + DISKLABEL="EMMC_DISK" + fi + do_umount + echo "info: converting emmc for /storage use" + parted -s "${EMMC}" mklabel gpt + parted -s "${EMMC}" -a min unit s mkpart EMMC_STORAGE ext4 34 100% + sleep 1 + mkfs.ext4 "${EMMC}p1" + sleep 1 + e2label "${EMMC}p1" EMMC_STORAGE + echo "info: changing label values in extlinux.conf" + mount -o remount,rw /flash + sleep 1 + sed -i "s/disk=LABEL=\w*/disk=LABEL=${DISKLABEL}/g" "/flash/extlinux/extlinux.conf" + mount -o remount,ro /flash + sleep 1 + echo "" + blkid | grep "${EMMC}p" + echo "" + cat "/flash/extlinux/extlinux.conf" + echo "" +} + +do_umount(){ + for mount in $(grep "${EMMC}" /proc/mounts | awk '{print $1}'); do echo "info: unmounting $mount" umount -f "$mount" sleep 1 done - echo "info: resizing ${EMMC}p2 to 100%" - parted -s -m $EMMC resizepart 2 100% - partprobe - sleep 1 - echo "info: remounting ${EMMC}p2 to /var/media/STORAGE" - mount ${EMMC}p2 /var/media/STORAGE - sleep 1 - if [ -f /var/media/STORAGE/.please_resize_me ]; then - rm /var/media/STORAGE/.please_resize_me +} + +do_write(){ + do_umount + if [ "${2: -7}" == ".img.gz" ]; then + echo "info: writing ${2} to ${EMMC}" + gunzip -c "${2}" | dd of="${EMMC}" bs=1M + elif [ "${2: -4}" == ".img" ]; then + echo "info: writing ${2} to ${EMMC}" + dd if="${2}" of="${EMMC}" bs=1M + else + echo "error: ${2} is not a valid image file!" + exit 1 fi - parted -s $EMMC unit s print } do_zero(){ - for mount in $(grep ${EMMC}p /proc/mounts | awk '{print $1}'); do - echo "info: unmounting $mount" - umount -f "$mount" - sleep 1 - done - dd if=/dev/zero of=$EMMC bs=1M + do_umount + echo "info: zeroing ${EMMC}, be patient, this will take time" + dd if="/dev/zero" of="${EMMC}" bs=1M + echo "info: zeroing complete" } do_help(){ echo "" - echo "usage: emmctool -d : (detect) detects a module attached after boot" - echo " emmctool -r : (resize) expands the storage partition to 100%" - echo " emmctool -i : (info) show information about the emmc module" - echo " emmctool -z : (zero) erases/wipes the module" - echo " emmctool -h : (help) displays this message" + echo "usage: emmctool (w)rite : write .img/.img.gz to the eMMC module" + echo " (b)backup : dump the emmc partition to an .img.gz file" + echo " (d)etect : detect an eMMC module attached after boot" + echo " (i)nfo : show info about the eMMC module" + echo " (l)abels : change eMMC disk labels to ${BOOTLABEL}/${DISKLABEL}" + echo " (r)esize : resize the storage partition to 100%" + echo " (s)storage : convert emmc for use as /storage (boot from sdcard)" + echo " (z)ero : zero (erase/wipe) the eMMC module" + echo " (h)elp : displays this help message" echo "" } -case $1 in - --detect|-d|detect) - do_checkboot +BOOT=$(grep /flash /proc/mounts | awk '{print $1}' | sed 's/p[012]//g') +EMMC=$(find /dev -name "mmcblk*rpmb" | sed 's/rpmb//g' | head -n 1) + +if [ -z "${EMMC}" ]; then + echo "error: no emmc module detected!" + exit 1 +fi + +case $(dtname) in + friendlyarm*|hardkernel*|khadas*|libretech*|wetek*) + if [ "${BOOT}" = "${EMMC}" ]; then + do_info + echo "Your device is booted from the eMMC module!" + echo "" + exit 1 + fi + ;; + *) + echo "Your device is not supported!" + echo "" + exit 1 + ;; +esac + +case "${1}" in + backup) + do_backup "$@" + ;; + detect|d) do_detect ;; - --info|-i|info) + info|i) do_info ;; - --resize|-r|resize) - do_checkboot + labels|l) + do_labels "$@" + ;; + resize|r) do_resize ;; - --zero|-z|zero) - do_checkboot + storage|s) + do_storage "$@" + ;; + write|w) + do_write "$@" + do_resize + do_labels + ;; + zero|z) do_zero ;; *) + do_info do_help ;; esac diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-SEI510.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-SEI510.conf new file mode 100644 index 0000000000..d91d1af058 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-SEI510.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12A-SEI510.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-TANIX-TX5MAX.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-TANIX-TX5MAX.conf new file mode 100644 index 0000000000..c1b0507b93 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-TANIX-TX5MAX.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12A-TANIX-TX5MAX.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +G12A-TANIX-TX5MAX.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-U200.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-U200.conf new file mode 100644 index 0000000000..dfc63d46c2 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-U200.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12A-U200.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +G12A-U200.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-X96-MAX.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-X96-MAX.conf new file mode 100644 index 0000000000..8ca9c27905 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12A-X96-MAX.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12A-X96-MAX.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +G12A-X96-MAX.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-GTKING-PRO.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-GTKING-PRO.conf new file mode 100644 index 0000000000..3280edf7d2 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-GTKING-PRO.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv) + + + +G12B-GTKING-PRO.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-GTKING.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-GTKING.conf new file mode 100644 index 0000000000..105fdede28 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-GTKING.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12B-GTKING.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +G12B-GTKING.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-KHADAS-VIM3.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-KHADAS-VIM3.conf new file mode 100644 index 0000000000..e84d92702b --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-KHADAS-VIM3.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12B-KHADAS-VIM3.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-ODROID-N2.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-ODROID-N2.conf new file mode 100644 index 0000000000..1d125a19bf --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-ODROID-N2.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv) + + + +G12B-ODROID-N2.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-UGOOS-AM6.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-UGOOS-AM6.conf new file mode 100644 index 0000000000..0c93e3e8a2 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/G12B-UGOOS-AM6.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +G12B-UGOOS-AM6.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +G12B-UGOOS-AM6.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GX-P230-Q200.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GX-P230-Q200.conf new file mode 100644 index 0000000000..4647790980 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GX-P230-Q200.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GX-P230-Q200.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-NANOPI-K2.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-NANOPI-K2.conf new file mode 100644 index 0000000000..0eeaa60cdc --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-NANOPI-K2.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-NANOPI-K2.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-NEXBOX-A95X.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-NEXBOX-A95X.conf new file mode 100644 index 0000000000..de66bf3b21 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-NEXBOX-A95X.conf @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-NEXBOX-A95X.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXBB-NEXBOX-A95X.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-ODROID-C2.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-ODROID-C2.conf new file mode 100644 index 0000000000..48a2f9372f --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-ODROID-C2.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-ODROID-C2.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-P20X.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-P20X.conf new file mode 100644 index 0000000000..f64cdbf544 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-P20X.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-P20X.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXBB-P20X.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-TRONSMART.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-TRONSMART.conf new file mode 100644 index 0000000000..8a697d88bc --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-TRONSMART.conf @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-TRONSMART.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXBB-TRONSMART.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-WETEK-HUB.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-WETEK-HUB.conf new file mode 100644 index 0000000000..d1b34847a4 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-WETEK-HUB.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-WETEK-HUB.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-WETEK-PLAY2.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-WETEK-PLAY2.conf new file mode 100644 index 0000000000..067051574f --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXBB-WETEK-PLAY2.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +GXBB-WETEK-PLAY2.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXBB-WETEK-PLAY2.pcm.iec958.1 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 1 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-HWACOM-AMAZETV.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-HWACOM-AMAZETV.conf new file mode 100644 index 0000000000..cdca883329 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-HWACOM-AMAZETV.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXL-HWACOM-AMAZETV.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-KHADAS-VIM.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-KHADAS-VIM.conf new file mode 100644 index 0000000000..0a643b988f --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-KHADAS-VIM.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXL-KHADAS-VIM.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-CC.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-CC.conf new file mode 100644 index 0000000000..244dec6880 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-CC.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXL-LIBRETECH-CC.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-S805X-AC.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-S805X-AC.conf new file mode 100644 index 0000000000..8dc8e939ac --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-S805X-AC.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXL-LIBRETECH-S805X-AC.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-S9XX-PC.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-S9XX-PC.conf new file mode 100644 index 0000000000..2a2f1ef381 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-LIBRETECH-S9XX-PC.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXL-LIBRETECH-S9XX-PC.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S805X-P241.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S805X-P241.conf new file mode 100644 index 0000000000..f2f58323e9 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S805X-P241.conf @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXL-S805X-P241.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S905D-SML5442TW.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S905D-SML5442TW.conf new file mode 100644 index 0000000000..a1cabb416a --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S905D-SML5442TW.conf @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv) + + + +GXL-S905D-SML5442TW.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXL-S905D-SML5442TW.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S905X-P212.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S905X-P212.conf new file mode 100644 index 0000000000..37c3664108 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXL-S905X-P212.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +GXL-S905X-P212.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-KHADAS-VIM2.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-KHADAS-VIM2.conf new file mode 100644 index 0000000000..93b4ef91a8 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-KHADAS-VIM2.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXM-KHADAS-VIM2.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-NEXBOX-A1.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-NEXBOX-A1.conf new file mode 100644 index 0000000000..9693ce4b96 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-NEXBOX-A1.conf @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXM-NEXBOX-A1.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXM-NEXBOX-A1.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-RBOX-PRO.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-RBOX-PRO.conf new file mode 100644 index 0000000000..d7f2bc3dc6 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/GXM-RBOX-PRO.conf @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + + + +GXM-RBOX-PRO.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} + + + +GXM-RBOX-PRO.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 1 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-A95XF3-AIR.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-A95XF3-AIR.conf new file mode 100644 index 0000000000..606b36fda2 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-A95XF3-AIR.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +SM1-A95XF3-AIR.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-KHADAS-VIM3L.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-KHADAS-VIM3L.conf new file mode 100644 index 0000000000..a76367bf9a --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-KHADAS-VIM3L.conf @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +SM1-KHADAS-VIM3L.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-SEI610.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-SEI610.conf new file mode 100644 index 0000000000..ec8069c163 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/SM1-SEI610.conf @@ -0,0 +1,35 @@ + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + + + +SM1-SEI610.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + subdevice 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Amlogic/linux/linux.aarch64.conf b/projects/Amlogic/linux/linux.aarch64.conf index 18cd191b70..d9dbb3798e 100644 --- a/projects/Amlogic/linux/linux.aarch64.conf +++ b/projects/Amlogic/linux/linux.aarch64.conf @@ -1,7 +1,6 @@ - # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.3.0 Kernel Configuration +# Linux/arm64 5.6.0-rc4 Kernel Configuration # # @@ -12,9 +11,10 @@ CONFIG_GCC_VERSION=80300 CONFIG_CLANG_VERSION=0 CONFIG_CC_CAN_LINK=y CONFIG_CC_HAS_ASM_GOTO=y +CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_WARN_MAYBE_UNINITIALIZED=y CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y +CONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y # @@ -22,7 +22,6 @@ CONFIG_THREAD_INFO_IN_TASK=y # CONFIG_INIT_ENV_ARG_LIMIT=32 # CONFIG_COMPILE_TEST is not set -# CONFIG_HEADER_TEST is not set CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_BUILD_SALT="" @@ -86,7 +85,8 @@ CONFIG_PREEMPT_VOLUNTARY=y # CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set +CONFIG_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_SCHED_AVG_IRQ=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_TASKSTATS is not set # CONFIG_PSI is not set @@ -105,10 +105,10 @@ CONFIG_RCU_STALL_COMMON=y CONFIG_RCU_NEED_SEGCBLIST=y # end of RCU Subsystem -CONFIG_IKCONFIG=m +CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_IKHEADERS is not set -CONFIG_LOG_BUF_SHIFT=17 +CONFIG_LOG_BUF_SHIFT=18 CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 CONFIG_GENERIC_SCHED_CLOCK=y @@ -119,6 +119,7 @@ CONFIG_GENERIC_SCHED_CLOCK=y # end of Scheduler features CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y +CONFIG_CC_HAS_INT128=y CONFIG_ARCH_SUPPORTS_INT128=y CONFIG_CGROUPS=y CONFIG_PAGE_COUNTER=y @@ -128,16 +129,17 @@ CONFIG_MEMCG_KMEM=y CONFIG_BLK_CGROUP=y CONFIG_CGROUP_WRITEBACK=y CONFIG_CGROUP_SCHED=y -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_RT_GROUP_SCHED is not set -# CONFIG_CGROUP_PIDS is not set -# CONFIG_CGROUP_RDMA is not set +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_RDMA=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_PROC_PID_CPUSET=y CONFIG_CGROUP_DEVICE=y CONFIG_CGROUP_CPUACCT=y -# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_PERF=y CONFIG_CGROUP_BPF=y # CONFIG_CGROUP_DEBUG is not set CONFIG_SOCK_CGROUP_DATA=y @@ -148,9 +150,9 @@ CONFIG_IPC_NS=y CONFIG_PID_NS=y CONFIG_NET_NS=y # CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_SCHED_AUTOGROUP is not set +CONFIG_SCHED_AUTOGROUP=y # CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set +CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="@INITRAMFS_SOURCE@" CONFIG_INITRAMFS_ROOT_UID=0 @@ -161,7 +163,8 @@ CONFIG_INITRAMFS_ROOT_GID=0 # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set -CONFIG_INITRAMFS_COMPRESSION="" +CONFIG_INITRAMFS_COMPRESSION_NONE=y +CONFIG_BOOT_CONFIG=y CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SYSCTL=y @@ -169,11 +172,10 @@ CONFIG_HAVE_UID16=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_BPF=y CONFIG_EXPERT=y -# CONFIG_UID16 is not set +CONFIG_UID16=y CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SYSFS_SYSCALL is not set -CONFIG_SYSCTL_SYSCALL=y +CONFIG_SGETMASK_SYSCALL=y +CONFIG_SYSFS_SYSCALL=y CONFIG_FHANDLE=y CONFIG_POSIX_TIMERS=y CONFIG_PRINTK=y @@ -183,6 +185,7 @@ CONFIG_ELF_CORE=y CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_FUTEX_PI=y +CONFIG_HAVE_FUTEX_CMPXCHG=y CONFIG_EPOLL=y CONFIG_SIGNALFD=y CONFIG_TIMERFD=y @@ -193,9 +196,10 @@ CONFIG_IO_URING=y CONFIG_ADVISE_SYSCALLS=y CONFIG_MEMBARRIER=y CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_ALL=y CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_BPF_SYSCALL=y +CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y # CONFIG_USERFAULTFD is not set CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y CONFIG_RSEQ=y @@ -219,7 +223,7 @@ CONFIG_SLUB_DEBUG=y CONFIG_SLUB=y # CONFIG_SLOB is not set CONFIG_SLAB_MERGE_DEFAULT=y -# CONFIG_SLAB_FREELIST_RANDOM is not set +CONFIG_SLAB_FREELIST_RANDOM=y # CONFIG_SLAB_FREELIST_HARDENED is not set # CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set CONFIG_SLUB_CPU_PARTIAL=y @@ -246,6 +250,7 @@ CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ZONE_DMA=y CONFIG_ZONE_DMA32=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_SMP=y @@ -254,6 +259,7 @@ CONFIG_FIX_EARLYCON_MEM=y CONFIG_PGTABLE_LEVELS=4 CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_BROKEN_GAS_INST=y # # Platform selection @@ -280,6 +286,7 @@ CONFIG_ARCH_MESON=y # CONFIG_ARCH_REALTEK is not set # CONFIG_ARCH_RENESAS is not set # CONFIG_ARCH_ROCKCHIP is not set +# CONFIG_ARCH_S32 is not set # CONFIG_ARCH_SEATTLE is not set # CONFIG_ARCH_STRATIX10 is not set # CONFIG_ARCH_SYNQUACER is not set @@ -306,19 +313,26 @@ CONFIG_ARM64_ERRATUM_826319=y CONFIG_ARM64_ERRATUM_827319=y CONFIG_ARM64_ERRATUM_824069=y CONFIG_ARM64_ERRATUM_819472=y -# CONFIG_ARM64_ERRATUM_832075 is not set +CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_ERRATUM_843419=y -# CONFIG_ARM64_ERRATUM_1024718 is not set -# CONFIG_ARM64_ERRATUM_1418040 is not set -# CONFIG_ARM64_ERRATUM_1165522 is not set -# CONFIG_ARM64_ERRATUM_1286807 is not set -# CONFIG_ARM64_ERRATUM_1463225 is not set +CONFIG_ARM64_ERRATUM_1024718=y +CONFIG_ARM64_ERRATUM_1418040=y +CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT_VHE=y +CONFIG_ARM64_ERRATUM_1165522=y +CONFIG_ARM64_ERRATUM_1530923=y +CONFIG_ARM64_ERRATUM_1286807=y +CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT_NVHE=y +CONFIG_ARM64_ERRATUM_1319367=y +CONFIG_ARM64_ERRATUM_1463225=y +CONFIG_ARM64_ERRATUM_1542419=y # CONFIG_CAVIUM_ERRATUM_22375 is not set # CONFIG_CAVIUM_ERRATUM_23154 is not set # CONFIG_CAVIUM_ERRATUM_27456 is not set # CONFIG_CAVIUM_ERRATUM_30115 is not set +# CONFIG_CAVIUM_TX2_ERRATUM_219 is not set # CONFIG_QCOM_FALKOR_ERRATUM_1003 is not set +CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y # CONFIG_QCOM_FALKOR_ERRATUM_1009 is not set # CONFIG_QCOM_QDF2400_ERRATUM_0065 is not set # CONFIG_SOCIONEXT_SYNQUACER_PREITS is not set @@ -336,17 +350,18 @@ CONFIG_ARM64_VA_BITS=48 CONFIG_ARM64_PA_BITS_48=y CONFIG_ARM64_PA_BITS=48 # CONFIG_CPU_BIG_ENDIAN is not set -# CONFIG_SCHED_MC is not set -# CONFIG_SCHED_SMT is not set +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_SMT=y CONFIG_NR_CPUS=8 CONFIG_HOTPLUG_CPU=y # CONFIG_NUMA is not set CONFIG_HOLES_IN_ZONE=y # CONFIG_HZ_100 is not set -# CONFIG_HZ_250 is not set -CONFIG_HZ_300=y +CONFIG_HZ_250=y +# CONFIG_HZ_300 is not set # CONFIG_HZ_1000 is not set -CONFIG_HZ=300 +CONFIG_HZ=250 CONFIG_SCHED_HRTICK=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_ARCH_SPARSEMEM_ENABLE=y @@ -373,8 +388,9 @@ CONFIG_HARDEN_EL2_VECTORS=y CONFIG_ARM64_SSBD=y CONFIG_RODATA_FULL_DEFAULT_ENABLED=y # CONFIG_ARM64_SW_TTBR0_PAN is not set +CONFIG_ARM64_TAGGED_ADDR_ABI=y CONFIG_COMPAT=y -# CONFIG_KUSER_HELPERS is not set +CONFIG_KUSER_HELPERS=y CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y @@ -383,38 +399,47 @@ CONFIG_SETEND_EMULATION=y # # ARMv8.1 architectural features # -# CONFIG_ARM64_HW_AFDBM is not set -# CONFIG_ARM64_PAN is not set -# CONFIG_ARM64_LSE_ATOMICS is not set -# CONFIG_ARM64_VHE is not set +CONFIG_ARM64_HW_AFDBM=y +CONFIG_ARM64_PAN=y +CONFIG_ARM64_USE_LSE_ATOMICS=y +CONFIG_ARM64_VHE=y # end of ARMv8.1 architectural features # # ARMv8.2 architectural features # -# CONFIG_ARM64_UAO is not set +CONFIG_ARM64_UAO=y # CONFIG_ARM64_PMEM is not set -# CONFIG_ARM64_RAS_EXTN is not set -# CONFIG_ARM64_CNP is not set +CONFIG_ARM64_RAS_EXTN=y +CONFIG_ARM64_CNP=y # end of ARMv8.2 architectural features # # ARMv8.3 architectural features # -# CONFIG_ARM64_PTR_AUTH is not set +CONFIG_ARM64_PTR_AUTH=y # end of ARMv8.3 architectural features +# +# ARMv8.5 architectural features +# +CONFIG_ARM64_E0PD=y +CONFIG_ARCH_RANDOM=y +# end of ARMv8.5 architectural features + CONFIG_ARM64_SVE=y CONFIG_ARM64_MODULE_PLTS=y -# CONFIG_ARM64_PSEUDO_NMI is not set -# CONFIG_RANDOMIZE_BASE is not set +CONFIG_ARM64_PSEUDO_NMI=y +# CONFIG_ARM64_DEBUG_PRIORITY_MASKING is not set +CONFIG_RELOCATABLE=y +CONFIG_RANDOMIZE_BASE=y +CONFIG_RANDOMIZE_MODULE_REGION_FULL=y # end of Kernel Features # # Boot options # CONFIG_CMDLINE="" -# CONFIG_CMDLINE_FORCE is not set # CONFIG_EFI is not set # end of Boot options @@ -453,15 +478,16 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y -# CONFIG_CPU_IDLE_GOV_LADDER is not set +CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y -# CONFIG_CPU_IDLE_GOV_TEO is not set +CONFIG_CPU_IDLE_GOV_TEO=y CONFIG_DT_IDLE_STATES=y # # ARM CPU Idle Drivers # CONFIG_ARM_CPUIDLE=y +CONFIG_ARM_PSCI_CPUIDLE=y # end of ARM CPU Idle Drivers # end of CPU Idle @@ -533,6 +559,7 @@ CONFIG_CRYPTO_AES_ARM64_CE_CCM=y CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y CONFIG_CRYPTO_CHACHA20_NEON=y +CONFIG_CRYPTO_POLY1305_NEON=y # CONFIG_CRYPTO_NHPOLY1305_NEON is not set CONFIG_CRYPTO_AES_ARM64_BS=y @@ -545,6 +572,7 @@ CONFIG_JUMP_LABEL=y CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y CONFIG_HAVE_NMI=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y @@ -555,6 +583,7 @@ CONFIG_ARCH_HAS_KEEPINITRD=y CONFIG_ARCH_HAS_SET_MEMORY=y CONFIG_ARCH_HAS_SET_DIRECT_MAP=y CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_HAVE_ASM_MODVERSIONS=y CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y CONFIG_HAVE_RSEQ=y CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y @@ -564,7 +593,8 @@ CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y -CONFIG_HAVE_RCU_TABLE_FREE=y +CONFIG_MMU_GATHER_TABLE_FREE=y +CONFIG_MMU_GATHER_RCU_TABLE_FREE=y CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y @@ -589,10 +619,11 @@ CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 +CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y +CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_COMPAT_OLD_SIGACTION=y -CONFIG_64BIT_TIME=y CONFIG_COMPAT_32BIT_TIME=y CONFIG_HAVE_ARCH_VMAP_STACK=y CONFIG_VMAP_STACK=y @@ -600,10 +631,10 @@ CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y CONFIG_STRICT_KERNEL_RWX=y CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_STRICT_MODULE_RWX=y -CONFIG_REFCOUNT_FULL=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y CONFIG_ARCH_USE_MEMREMAP_PROT=y # CONFIG_LOCK_EVENT_COUNTS is not set +CONFIG_ARCH_HAS_RELR=y # # GCOV-based kernel profiling @@ -626,10 +657,13 @@ CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_SRCVERSION_ALL is not set # CONFIG_MODULE_SIG is not set # CONFIG_MODULE_COMPRESS is not set +# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set +# CONFIG_UNUSED_SYMBOLS is not set # CONFIG_TRIM_UNUSED_KSYMS is not set CONFIG_MODULES_TREE_LOOKUP=y CONFIG_BLOCK=y CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BLK_CGROUP_RWSTAT=y CONFIG_BLK_DEV_BSG=y CONFIG_BLK_DEV_BSGLIB=y # CONFIG_BLK_DEV_INTEGRITY is not set @@ -638,6 +672,7 @@ CONFIG_BLK_DEV_BSGLIB=y # CONFIG_BLK_CMDLINE_PARSER is not set # CONFIG_BLK_WBT is not set # CONFIG_BLK_CGROUP_IOLATENCY is not set +# CONFIG_BLK_CGROUP_IOCOST is not set CONFIG_BLK_DEBUG_FS=y # CONFIG_BLK_SED_OPAL is not set @@ -676,7 +711,8 @@ CONFIG_BLK_PM=y CONFIG_MQ_IOSCHED_DEADLINE=y CONFIG_MQ_IOSCHED_KYBER=y CONFIG_IOSCHED_BFQ=y -# CONFIG_BFQ_GROUP_IOSCHED is not set +CONFIG_BFQ_GROUP_IOSCHED=y +# CONFIG_BFQ_CGROUP_DEBUG is not set # end of IO Schedulers CONFIG_PADATA=y @@ -775,14 +811,12 @@ CONFIG_COMPACTION=y CONFIG_MIGRATION=y CONFIG_CONTIG_ALLOC=y CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_BOUNCE=y # CONFIG_KSM is not set CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y # CONFIG_MEMORY_FAILURE is not set -CONFIG_TRANSPARENT_HUGEPAGE=y -CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y -# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set -CONFIG_TRANSPARENT_HUGE_PAGECACHE=y +# CONFIG_TRANSPARENT_HUGEPAGE is not set CONFIG_CLEANCACHE=y CONFIG_FRONTSWAP=y CONFIG_CMA=y @@ -816,7 +850,9 @@ CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_UNIX_SCM=y # CONFIG_UNIX_DIAG is not set -# CONFIG_TLS is not set +CONFIG_TLS=y +# CONFIG_TLS_DEVICE is not set +# CONFIG_TLS_TOE is not set CONFIG_XFRM=y # CONFIG_XFRM_USER is not set # CONFIG_XFRM_INTERFACE is not set @@ -838,7 +874,7 @@ CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m +CONFIG_NET_IP_TUNNEL=y CONFIG_IP_MROUTE_COMMON=y CONFIG_IP_MROUTE=y # CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set @@ -846,7 +882,7 @@ CONFIG_IP_MROUTE=y # CONFIG_IP_PIMSM_V2 is not set # CONFIG_SYN_COOKIES is not set # CONFIG_NET_IPVTI is not set -CONFIG_NET_UDP_TUNNEL=m +CONFIG_NET_UDP_TUNNEL=y CONFIG_NET_FOU=m # CONFIG_NET_FOU_IP_TUNNELS is not set # CONFIG_INET_AH is not set @@ -897,6 +933,7 @@ CONFIG_IPV6_FOU=m # CONFIG_IPV6_MROUTE is not set # CONFIG_IPV6_SEG6_LWTUNNEL is not set # CONFIG_IPV6_SEG6_HMAC is not set +# CONFIG_MPTCP is not set # CONFIG_NETWORK_SECMARK is not set # CONFIG_NETWORK_PHY_TIMESTAMPING is not set CONFIG_NETFILTER=y @@ -1151,6 +1188,7 @@ CONFIG_NET_SCH_FQ_CODEL=y # CONFIG_NET_SCH_HHF is not set # CONFIG_NET_SCH_PIE is not set # CONFIG_NET_SCH_PLUG is not set +# CONFIG_NET_SCH_ETS is not set # CONFIG_NET_SCH_DEFAULT is not set # @@ -1253,6 +1291,7 @@ CONFIG_BT_HCIUART_QCA=y # CONFIG_AF_RXRPC is not set # CONFIG_AF_KCM is not set +CONFIG_STREAM_PARSER=y CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -1273,7 +1312,7 @@ CONFIG_MAC80211_HAS_RC=y CONFIG_MAC80211_RC_MINSTREL=y CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_MESH=y CONFIG_MAC80211_LEDS=y # CONFIG_MAC80211_DEBUGFS is not set # CONFIG_MAC80211_MESSAGE_TRACING is not set @@ -1293,8 +1332,10 @@ CONFIG_RFKILL_GPIO=m # CONFIG_LWTUNNEL is not set CONFIG_DST_CACHE=y CONFIG_GRO_CELLS=y +CONFIG_NET_SOCK_MSG=y CONFIG_PAGE_POOL=y -CONFIG_FAILOVER=y +CONFIG_FAILOVER=m +CONFIG_ETHTOOL_NETLINK=y CONFIG_HAVE_EBPF_JIT=y # @@ -1321,6 +1362,7 @@ CONFIG_FW_LOADER=y CONFIG_EXTRA_FIRMWARE="" # CONFIG_FW_LOADER_USER_HELPER is not set # CONFIG_FW_LOADER_COMPRESS is not set +CONFIG_FW_CACHE=y # end of Firmware loader CONFIG_WANT_DEV_COREDUMP=y @@ -1346,6 +1388,7 @@ CONFIG_GENERIC_ARCH_TOPOLOGY=y # Bus devices # # CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_MOXTET is not set # CONFIG_SIMPLE_PM_BUS is not set # CONFIG_VEXPRESS_CONFIG is not set # end of Bus devices @@ -1414,8 +1457,8 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 # # EEPROM support # -# CONFIG_EEPROM_AT24 is not set -CONFIG_EEPROM_AT25=m +CONFIG_EEPROM_AT24=m +# CONFIG_EEPROM_AT25 is not set # CONFIG_EEPROM_LEGACY is not set # CONFIG_EEPROM_MAX6875 is not set CONFIG_EEPROM_93CX6=m @@ -1437,39 +1480,7 @@ CONFIG_EEPROM_93CX6=m # # Intel MIC & related support # - -# -# Intel MIC Bus Driver -# - -# -# SCIF Bus Driver -# - -# -# VOP Bus Driver -# # CONFIG_VOP_BUS is not set - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# - -# -# VOP Driver -# # end of Intel MIC & related support # CONFIG_ECHO is not set @@ -1527,6 +1538,8 @@ CONFIG_MII=y CONFIG_NET_CORE=y # CONFIG_BONDING is not set # CONFIG_DUMMY is not set +CONFIG_WIREGUARD=y +# CONFIG_WIREGUARD_DEBUG is not set # CONFIG_EQUALIZER is not set # CONFIG_NET_TEAM is not set CONFIG_MACVLAN=m @@ -1545,10 +1558,6 @@ CONFIG_TUN=y CONFIG_VETH=m # CONFIG_NLMON is not set -# -# CAIF transport drivers -# - # # Distributed Switch Architecture drivers # @@ -1581,6 +1590,7 @@ CONFIG_ETHERNET=y # CONFIG_NET_VENDOR_NETRONOME is not set # CONFIG_NET_VENDOR_NI is not set # CONFIG_ETHOC is not set +# CONFIG_NET_VENDOR_PENSANDO is not set # CONFIG_NET_VENDOR_QUALCOMM is not set # CONFIG_NET_VENDOR_RENESAS is not set # CONFIG_NET_VENDOR_ROCKER is not set @@ -1599,15 +1609,16 @@ CONFIG_DWMAC_MESON=y # CONFIG_NET_VENDOR_SYNOPSYS is not set # CONFIG_NET_VENDOR_VIA is not set # CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_NET_VENDOR_XILINX is not set CONFIG_MDIO_DEVICE=y CONFIG_MDIO_BUS=y # CONFIG_MDIO_BCM_UNIMAC is not set CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS_MUX=y -# CONFIG_MDIO_BUS_MUX_GPIO is not set +CONFIG_MDIO_BUS_MUX_GPIO=y CONFIG_MDIO_BUS_MUX_MESON_G12A=y CONFIG_MDIO_BUS_MUX_MMIOREG=y -# CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set +CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y # CONFIG_MDIO_GPIO is not set # CONFIG_MDIO_HISI_FEMAC is not set # CONFIG_MDIO_MSCC_MIIM is not set @@ -1615,19 +1626,20 @@ CONFIG_MDIO_BUS_MUX_MMIOREG=y CONFIG_PHYLINK=y CONFIG_PHYLIB=y CONFIG_SWPHY=y -# CONFIG_LED_TRIGGER_PHY is not set +CONFIG_LED_TRIGGER_PHY=y # # MII PHY device drivers # # CONFIG_SFP is not set +# CONFIG_ADIN_PHY is not set # CONFIG_AMD_PHY is not set # CONFIG_AQUANTIA_PHY is not set # CONFIG_AX88796B_PHY is not set -# CONFIG_AT803X_PHY is not set # CONFIG_BCM7XXX_PHY is not set # CONFIG_BCM87XX_PHY is not set # CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM84881_PHY is not set # CONFIG_CICADA_PHY is not set # CONFIG_CORTINA_PHY is not set # CONFIG_DAVICOM_PHY is not set @@ -1635,6 +1647,7 @@ CONFIG_SWPHY=y # CONFIG_DP83TC811_PHY is not set # CONFIG_DP83848_PHY is not set # CONFIG_DP83867_PHY is not set +# CONFIG_DP83869_PHY is not set CONFIG_FIXED_PHY=y # CONFIG_ICPLUS_PHY is not set # CONFIG_INTEL_XWAY_PHY is not set @@ -1649,6 +1662,7 @@ CONFIG_MICROCHIP_PHY=m # CONFIG_MICROSEMI_PHY is not set # CONFIG_NATIONAL_PHY is not set # CONFIG_NXP_TJA11XX_PHY is not set +# CONFIG_AT803X_PHY is not set # CONFIG_QSEMI_PHY is not set CONFIG_REALTEK_PHY=y # CONFIG_RENESAS_PHY is not set @@ -1769,9 +1783,9 @@ CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m CONFIG_BRCMFMAC_PROTO_BCDC=y CONFIG_BRCMFMAC_SDIO=y -CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCMFMAC_USB is not set # CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set +CONFIG_BRCMDBG=y CONFIG_WLAN_VENDOR_CISCO=y CONFIG_WLAN_VENDOR_INTEL=y CONFIG_WLAN_VENDOR_INTERSIL=y @@ -1907,7 +1921,6 @@ CONFIG_KEYBOARD_GPIO_POLLED=m # CONFIG_KEYBOARD_OMAP4 is not set # CONFIG_KEYBOARD_TM2_TOUCHKEY is not set # CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_CROS_EC is not set # CONFIG_KEYBOARD_CAP11XX is not set # CONFIG_KEYBOARD_BCM is not set CONFIG_INPUT_MOUSE=y @@ -1949,6 +1962,7 @@ CONFIG_JOYSTICK_XPAD_LEDS=y CONFIG_JOYSTICK_PSXPAD_SPI=m CONFIG_JOYSTICK_PSXPAD_SPI_FF=y # CONFIG_JOYSTICK_PXRC is not set +# CONFIG_JOYSTICK_FSIA6B is not set # CONFIG_INPUT_TABLET is not set # CONFIG_INPUT_TOUCHSCREEN is not set CONFIG_INPUT_MISC=y @@ -1979,7 +1993,6 @@ CONFIG_INPUT_GPIO_ROTARY_ENCODER=m # CONFIG_INPUT_ADXL34X is not set # CONFIG_INPUT_IMS_PCU is not set # CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set @@ -2040,6 +2053,7 @@ CONFIG_DEVMEM=y CONFIG_SERIAL_EARLYCON=y CONFIG_SERIAL_8250=y # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +# CONFIG_SERIAL_8250_16550A_VARIANTS is not set # CONFIG_SERIAL_8250_FINTEK is not set CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_NR_UARTS=1 @@ -2050,6 +2064,7 @@ CONFIG_SERIAL_8250_EXTENDED=y CONFIG_SERIAL_8250_SHARE_IRQ=y # CONFIG_SERIAL_8250_DETECT_IRQ is not set # CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_DWLIB=y CONFIG_SERIAL_8250_FSL=y CONFIG_SERIAL_8250_DW=y # CONFIG_SERIAL_8250_RT288X is not set @@ -2077,6 +2092,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_SERIAL_XILINX_PS_UART is not set # CONFIG_SERIAL_ARC is not set # CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_FSL_LINFLEXUART is not set # CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set # end of Serial drivers @@ -2096,6 +2112,8 @@ CONFIG_HW_RANDOM_OPTEE=m # CONFIG_XILLYBUS is not set # end of Character devices +# CONFIG_RANDOM_TRUST_BOOTLOADER is not set + # # I2C support # @@ -2103,7 +2121,7 @@ CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=m +CONFIG_I2C_MUX=y # # Multiplexer I2C Chip support @@ -2113,8 +2131,8 @@ CONFIG_I2C_MUX=m # CONFIG_I2C_MUX_GPMUX is not set # CONFIG_I2C_MUX_LTC4306 is not set # CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set +CONFIG_I2C_MUX_PCA954x=y +CONFIG_I2C_MUX_PINCTRL=y # CONFIG_I2C_MUX_REG is not set # CONFIG_I2C_DEMUX_PINCTRL is not set # CONFIG_I2C_MUX_MLXCPLD is not set @@ -2136,7 +2154,8 @@ CONFIG_I2C_DESIGNWARE_CORE=y CONFIG_I2C_DESIGNWARE_PLATFORM=y # CONFIG_I2C_DESIGNWARE_SLAVE is not set # CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set +CONFIG_I2C_GPIO=y +# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set CONFIG_I2C_MESON=y # CONFIG_I2C_NOMADIK is not set # CONFIG_I2C_OCORES is not set @@ -2149,7 +2168,6 @@ CONFIG_I2C_MESON=y # External I2C/SMBus adapter drivers # # CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_ROBOTFUZZ_OSIF is not set # CONFIG_I2C_TAOS_EVM is not set # CONFIG_I2C_TINY_USB is not set @@ -2157,7 +2175,6 @@ CONFIG_I2C_MESON=y # # Other I2C/SMBus bus drivers # -# CONFIG_I2C_CROS_EC_TUNNEL is not set # end of I2C Hardware Bus support # CONFIG_I2C_STUB is not set @@ -2249,6 +2266,8 @@ CONFIG_PINCTRL_MESON8_PMX=y CONFIG_PINCTRL_MESON_AXG=y CONFIG_PINCTRL_MESON_AXG_PMX=y CONFIG_PINCTRL_MESON_G12A=y +CONFIG_PINCTRL_MESON_A1=y +# CONFIG_PINCTRL_EQUILIBRIUM is not set CONFIG_GPIOLIB=y CONFIG_GPIOLIB_FASTPATH_LIMIT=512 CONFIG_OF_GPIO=y @@ -2267,9 +2286,11 @@ CONFIG_GPIO_DWAPB=y CONFIG_GPIO_GENERIC_PLATFORM=y # CONFIG_GPIO_GRGPIO is not set # CONFIG_GPIO_HLWD is not set +# CONFIG_GPIO_LOGICVC is not set # CONFIG_GPIO_MB86S7X is not set # CONFIG_GPIO_PL061 is not set # CONFIG_GPIO_SAMA5D2_PIOBU is not set +# CONFIG_GPIO_SIFIVE is not set # CONFIG_GPIO_SYSCON is not set # CONFIG_GPIO_XGENE is not set # CONFIG_GPIO_XILINX is not set @@ -2356,7 +2377,6 @@ CONFIG_POWER_SUPPLY=y # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set # CONFIG_CHARGER_RT9455 is not set -# CONFIG_CHARGER_CROS_USBPD is not set # CONFIG_CHARGER_UCS1002 is not set CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set @@ -2372,6 +2392,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_ADM1026 is not set # CONFIG_SENSORS_ADM1029 is not set # CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM1177 is not set # CONFIG_SENSORS_ADM9240 is not set # CONFIG_SENSORS_ADT7310 is not set # CONFIG_SENSORS_ADT7410 is not set @@ -2379,6 +2400,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_ADT7462 is not set # CONFIG_SENSORS_ADT7470 is not set # CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_AS370 is not set # CONFIG_SENSORS_ASC7621 is not set CONFIG_SENSORS_ARM_SCPI=y # CONFIG_SENSORS_ASPEED is not set @@ -2401,6 +2423,8 @@ CONFIG_SENSORS_GPIO_FAN=m # CONFIG_SENSORS_POWR1220 is not set # CONFIG_SENSORS_LINEAGE is not set # CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2947_I2C is not set +# CONFIG_SENSORS_LTC2947_SPI is not set # CONFIG_SENSORS_LTC2990 is not set # CONFIG_SENSORS_LTC4151 is not set # CONFIG_SENSORS_LTC4215 is not set @@ -2414,6 +2438,7 @@ CONFIG_SENSORS_GPIO_FAN=m # CONFIG_SENSORS_MAX1668 is not set # CONFIG_SENSORS_MAX197 is not set # CONFIG_SENSORS_MAX31722 is not set +# CONFIG_SENSORS_MAX31730 is not set # CONFIG_SENSORS_MAX6621 is not set # CONFIG_SENSORS_MAX6639 is not set # CONFIG_SENSORS_MAX6642 is not set @@ -2467,7 +2492,6 @@ CONFIG_SENSORS_PWM_FAN=m # CONFIG_SENSORS_STTS751 is not set # CONFIG_SENSORS_SMM665 is not set # CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set # CONFIG_SENSORS_ADS7828 is not set # CONFIG_SENSORS_ADS7871 is not set # CONFIG_SENSORS_AMC6821 is not set @@ -2481,6 +2505,7 @@ CONFIG_SENSORS_PWM_FAN=m # CONFIG_SENSORS_TMP108 is not set # CONFIG_SENSORS_TMP401 is not set # CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_TMP513 is not set # CONFIG_SENSORS_VT1211 is not set # CONFIG_SENSORS_W83773G is not set # CONFIG_SENSORS_W83781D is not set @@ -2501,12 +2526,10 @@ CONFIG_THERMAL_OF=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y # CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set # CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set # CONFIG_THERMAL_GOV_FAIR_SHARE is not set CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_BANG_BANG is not set # CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set # CONFIG_CPU_THERMAL is not set # CONFIG_CLOCK_THERMAL is not set # CONFIG_DEVFREQ_THERMAL is not set @@ -2575,8 +2598,6 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_BCM590XX is not set # CONFIG_MFD_BD9571MWV is not set # CONFIG_MFD_AXP20X_I2C is not set -CONFIG_MFD_CROS_EC=y -# CONFIG_MFD_CROS_EC_CHARDEV is not set # CONFIG_MFD_MADERA is not set # CONFIG_PMIC_DA903X is not set # CONFIG_MFD_DA9052_SPI is not set @@ -2665,6 +2686,7 @@ CONFIG_MFD_WM5102=y # CONFIG_MFD_WM8994 is not set # CONFIG_MFD_ROHM_BD718XX is not set # CONFIG_MFD_ROHM_BD70528 is not set +# CONFIG_MFD_ROHM_BD71828 is not set # CONFIG_MFD_STPMIC1 is not set # CONFIG_MFD_STMFX is not set # CONFIG_RAVE_SP_CORE is not set @@ -2699,6 +2721,8 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_MAX8952 is not set # CONFIG_REGULATOR_MAX8973 is not set # CONFIG_REGULATOR_MCP16502 is not set +# CONFIG_REGULATOR_MP8859 is not set +# CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set @@ -2712,6 +2736,7 @@ CONFIG_REGULATOR_PWM=y # CONFIG_REGULATOR_S5M8767 is not set # CONFIG_REGULATOR_SLG51000 is not set # CONFIG_REGULATOR_SY8106A is not set +# CONFIG_REGULATOR_SY8824X is not set # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set @@ -2757,7 +2782,7 @@ CONFIG_IR_PWM_TX=m # CONFIG_IR_SERIAL is not set # CONFIG_IR_SIR is not set CONFIG_RC_XBOX_DVD=m -CONFIG_MEDIA_SUPPORT=m +CONFIG_MEDIA_SUPPORT=y # # Multimedia core support @@ -2775,13 +2800,14 @@ CONFIG_MEDIA_CONTROLLER_REQUEST_API=y CONFIG_VIDEO_DEV=y CONFIG_VIDEO_V4L2_SUBDEV_API=y CONFIG_VIDEO_V4L2=y +CONFIG_VIDEO_V4L2_I2C=y # CONFIG_VIDEO_ADV_DEBUG is not set # CONFIG_VIDEO_FIXED_MINOR_RANGES is not set CONFIG_VIDEO_TUNER=m -CONFIG_V4L2_MEM2MEM_DEV=y -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_VMALLOC=y -CONFIG_DVB_CORE=m +CONFIG_V4L2_MEM2MEM_DEV=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_DVB_CORE=y # CONFIG_DVB_MMAP is not set CONFIG_DVB_NET=y CONFIG_TTPCI_EEPROM=m @@ -2903,11 +2929,9 @@ CONFIG_VIDEO_EM28XX_RC=m CONFIG_V4L_MEM2MEM_DRIVERS=y CONFIG_VIDEO_MEM2MEM_DEINTERLACE=m # CONFIG_VIDEO_SH_VEU is not set -CONFIG_VIDEO_MESON_VDEC=m # CONFIG_V4L_TEST_DRIVERS is not set # CONFIG_DVB_PLATFORM_DRIVERS is not set CONFIG_CEC_PLATFORM_DRIVERS=y -# CONFIG_VIDEO_CROS_EC_CEC is not set CONFIG_VIDEO_MESON_AO_CEC=m CONFIG_VIDEO_MESON_G12A_AO_CEC=m @@ -3017,8 +3041,10 @@ CONFIG_VIDEO_CX25840=m # # Camera sensor devices # +# CONFIG_VIDEO_HI556 is not set # CONFIG_VIDEO_IMX258 is not set # CONFIG_VIDEO_IMX274 is not set +# CONFIG_VIDEO_IMX290 is not set # CONFIG_VIDEO_IMX319 is not set # CONFIG_VIDEO_IMX355 is not set # CONFIG_VIDEO_OV2640 is not set @@ -3030,6 +3056,7 @@ CONFIG_VIDEO_CX25840=m # CONFIG_VIDEO_OV5647 is not set # CONFIG_VIDEO_OV6650 is not set # CONFIG_VIDEO_OV5670 is not set +# CONFIG_VIDEO_OV5675 is not set # CONFIG_VIDEO_OV5695 is not set # CONFIG_VIDEO_OV7251 is not set # CONFIG_VIDEO_OV772X is not set @@ -3113,32 +3140,32 @@ CONFIG_VIDEO_CX25840=m CONFIG_CXD2880_SPI_DRV=m # end of Media SPI Adapters -CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER=y # # Customize TV tuners # -CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_SIMPLE=y CONFIG_MEDIA_TUNER_TDA18250=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_TEA5761=m -CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_TDA8290=y +CONFIG_MEDIA_TUNER_TDA827X=y +CONFIG_MEDIA_TUNER_TDA18271=y +CONFIG_MEDIA_TUNER_TDA9887=y +CONFIG_MEDIA_TUNER_TEA5761=y +CONFIG_MEDIA_TUNER_TEA5767=y # CONFIG_MEDIA_TUNER_MSI001 is not set -CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT20XX=y CONFIG_MEDIA_TUNER_MT2060=m CONFIG_MEDIA_TUNER_MT2063=m CONFIG_MEDIA_TUNER_MT2266=m # CONFIG_MEDIA_TUNER_MT2131 is not set CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_XC2028=y +CONFIG_MEDIA_TUNER_XC5000=y +CONFIG_MEDIA_TUNER_XC4000=y CONFIG_MEDIA_TUNER_MXL5005S=m CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MC44S803=y CONFIG_MEDIA_TUNER_MAX2165=m CONFIG_MEDIA_TUNER_TDA18218=m CONFIG_MEDIA_TUNER_FC0011=m @@ -3335,6 +3362,7 @@ CONFIG_DRM=y # CONFIG_DRM_DEBUG_SELFTEST is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_KMS_FB_HELPER=y +# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 # CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set @@ -3343,7 +3371,7 @@ CONFIG_DRM_LOAD_EDID_FIRMWARE=y CONFIG_DRM_GEM_CMA_HELPER=y CONFIG_DRM_KMS_CMA_HELPER=y CONFIG_DRM_GEM_SHMEM_HELPER=y -CONFIG_DRM_SCHED=y +CONFIG_DRM_SCHED=m # # I2C encoder or helper chips @@ -3383,12 +3411,19 @@ CONFIG_DRM_PANEL=y # CONFIG_DRM_PANEL_SIMPLE is not set # CONFIG_DRM_PANEL_ILITEK_IL9322 is not set # CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LB035Q02 is not set # CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set +# CONFIG_DRM_PANEL_NOVATEK_NT39016 is not set # CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set # CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set +# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set +# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set +# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set # CONFIG_DRM_PANEL_TPO_TPG110 is not set # end of Display Panels @@ -3398,10 +3433,9 @@ CONFIG_DRM_PANEL_BRIDGE=y # # Display Interface Bridges # -# CONFIG_DRM_ANALOGIX_ANX78XX is not set # CONFIG_DRM_CDNS_DSI is not set # CONFIG_DRM_DUMB_VGA_DAC is not set -# CONFIG_DRM_LVDS_ENCODER is not set +# CONFIG_DRM_LVDS_CODEC is not set # CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set # CONFIG_DRM_NXP_PTN3460 is not set # CONFIG_DRM_PARADE_PS8622 is not set @@ -3413,6 +3447,8 @@ CONFIG_DRM_PANEL_BRIDGE=y # CONFIG_DRM_TOSHIBA_TC358767 is not set # CONFIG_DRM_TI_TFP410 is not set # CONFIG_DRM_TI_SN65DSI86 is not set +# CONFIG_DRM_ANALOGIX_ANX6345 is not set +# CONFIG_DRM_ANALOGIX_ANX78XX is not set # CONFIG_DRM_I2C_ADV7511 is not set CONFIG_DRM_DW_HDMI=y # CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set @@ -3426,7 +3462,14 @@ CONFIG_DRM_DW_HDMI_I2S_AUDIO=y # CONFIG_DRM_MXSFB is not set CONFIG_DRM_MESON=y CONFIG_DRM_MESON_DW_HDMI=y -# CONFIG_DRM_TINYDRM is not set +# CONFIG_DRM_GM12U320 is not set +# CONFIG_TINYDRM_HX8357D is not set +# CONFIG_TINYDRM_ILI9225 is not set +# CONFIG_TINYDRM_ILI9341 is not set +# CONFIG_TINYDRM_MI0283QT is not set +# CONFIG_TINYDRM_REPAPER is not set +# CONFIG_TINYDRM_ST7586 is not set +# CONFIG_TINYDRM_ST7735R is not set # CONFIG_DRM_PL111 is not set CONFIG_DRM_LIMA=m CONFIG_DRM_PANFROST=m @@ -3463,7 +3506,7 @@ CONFIG_FB_ARMCLCD=y # CONFIG_FB_IBM_GXT4500 is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_METRONOME is not set -# CONFIG_FB_SIMPLE is not set +CONFIG_FB_SIMPLE=y # CONFIG_FB_SSD1307 is not set # end of Frame buffer Devices @@ -3474,7 +3517,7 @@ CONFIG_FB_ARMCLCD=y CONFIG_BACKLIGHT_CLASS_DEVICE=y # CONFIG_BACKLIGHT_GENERIC is not set # CONFIG_BACKLIGHT_PWM is not set -# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_QCOM_WLED is not set # CONFIG_BACKLIGHT_ADP8860 is not set # CONFIG_BACKLIGHT_ADP8870 is not set # CONFIG_BACKLIGHT_LM3630A is not set @@ -3578,6 +3621,7 @@ CONFIG_SND_SOC=y # # ASoC support for Amlogic platforms # +CONFIG_SND_MESON_AIU=y CONFIG_SND_MESON_AXG_FIFO=y CONFIG_SND_MESON_AXG_FRDDR=y CONFIG_SND_MESON_AXG_TODDR=y @@ -3589,12 +3633,14 @@ CONFIG_SND_MESON_AXG_SOUND_CARD=y CONFIG_SND_MESON_AXG_SPDIFOUT=y CONFIG_SND_MESON_AXG_SPDIFIN=y CONFIG_SND_MESON_AXG_PDM=y +CONFIG_SND_MESON_CARD_UTILS=y +CONFIG_SND_MESON_CODEC_GLUE=y +CONFIG_SND_MESON_GX_SOUND_CARD=y +CONFIG_SND_MESON_G12A_TOACODEC=y CONFIG_SND_MESON_G12A_TOHDMITX=y +CONFIG_SND_SOC_MESON_T9015=y # end of ASoC support for Amlogic platforms -CONFIG_SND_SOC_MESON_GX=y -CONFIG_SND_SOC_MESON_GX_I2S=y -CONFIG_SND_SOC_MESON_GX_SPDIF=y # CONFIG_SND_SOC_SOF_TOPLEVEL is not set # @@ -3617,6 +3663,8 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_ADAU1761_I2C is not set # CONFIG_SND_SOC_ADAU1761_SPI is not set # CONFIG_SND_SOC_ADAU7002 is not set +# CONFIG_SND_SOC_ADAU7118_HW is not set +# CONFIG_SND_SOC_ADAU7118_I2C is not set # CONFIG_SND_SOC_AK4104 is not set # CONFIG_SND_SOC_AK4118 is not set # CONFIG_SND_SOC_AK4458 is not set @@ -3628,7 +3676,6 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_ALC5623 is not set # CONFIG_SND_SOC_BD28623 is not set # CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CROS_EC_CODEC is not set # CONFIG_SND_SOC_CS35L32 is not set # CONFIG_SND_SOC_CS35L33 is not set # CONFIG_SND_SOC_CS35L34 is not set @@ -3649,6 +3696,7 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_CS4349 is not set # CONFIG_SND_SOC_CS53L30 is not set # CONFIG_SND_SOC_CX2072X is not set +# CONFIG_SND_SOC_DA7213 is not set # CONFIG_SND_SOC_DMIC is not set CONFIG_SND_SOC_HDMI_CODEC=y CONFIG_SND_SOC_ES7134=y @@ -3683,7 +3731,7 @@ CONFIG_SND_SOC_MAX98357A=y # CONFIG_SND_SOC_RT5616 is not set # CONFIG_SND_SOC_RT5631 is not set # CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIMPLE_AMPLIFIER is not set +CONFIG_SND_SOC_SIMPLE_AMPLIFIER=y # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set CONFIG_SND_SOC_SPDIF=y # CONFIG_SND_SOC_SSM2305 is not set @@ -3694,6 +3742,8 @@ CONFIG_SND_SOC_SPDIF=y # CONFIG_SND_SOC_STA350 is not set # CONFIG_SND_SOC_STI_SAS is not set # CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS2562 is not set +# CONFIG_SND_SOC_TAS2770 is not set # CONFIG_SND_SOC_TAS5086 is not set # CONFIG_SND_SOC_TAS571X is not set # CONFIG_SND_SOC_TAS5720 is not set @@ -3709,6 +3759,7 @@ CONFIG_SND_SOC_SPDIF=y # CONFIG_SND_SOC_TS3A227E is not set # CONFIG_SND_SOC_TSCS42XX is not set # CONFIG_SND_SOC_TSCS454 is not set +# CONFIG_SND_SOC_UDA1334 is not set # CONFIG_SND_SOC_WM8510 is not set # CONFIG_SND_SOC_WM8523 is not set # CONFIG_SND_SOC_WM8524 is not set @@ -3736,6 +3787,7 @@ CONFIG_SND_SOC_SPDIF=y # CONFIG_SND_SOC_MAX9759 is not set # CONFIG_SND_SOC_MT6351 is not set # CONFIG_SND_SOC_MT6358 is not set +# CONFIG_SND_SOC_MT6660 is not set # CONFIG_SND_SOC_NAU8540 is not set # CONFIG_SND_SOC_NAU8810 is not set # CONFIG_SND_SOC_NAU8822 is not set @@ -3777,6 +3829,7 @@ CONFIG_HID_CHICONY=y # CONFIG_HID_PRODIKEYS is not set # CONFIG_HID_CMEDIA is not set # CONFIG_HID_CP2112 is not set +# CONFIG_HID_CREATIVE_SB0540 is not set CONFIG_HID_CYPRESS=y CONFIG_HID_DRAGONRISE=m CONFIG_DRAGONRISE_FF=y @@ -3788,7 +3841,6 @@ CONFIG_HID_EZKEY=y # CONFIG_HID_GEMBIRD is not set # CONFIG_HID_GFRM is not set # CONFIG_HID_HOLTEK is not set -# CONFIG_HID_GOOGLE_HAMMER is not set # CONFIG_HID_GT683R is not set # CONFIG_HID_KEYTOUCH is not set CONFIG_HID_KYE=y @@ -3875,6 +3927,9 @@ CONFIG_USB_HIDDEV=y CONFIG_USB_OHCI_LITTLE_ENDIAN=y CONFIG_USB_SUPPORT=y CONFIG_USB_COMMON=y +# CONFIG_USB_LED_TRIG is not set +# CONFIG_USB_ULPI_BUS is not set +# CONFIG_USB_CONN_GPIO is not set CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y @@ -3891,7 +3946,6 @@ CONFIG_USB_OTG=y # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 CONFIG_USB_MON=m -# CONFIG_USB_WUSB_CBAF is not set # # USB Host Controller Drivers @@ -3955,6 +4009,7 @@ CONFIG_USB_UAS=m # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set # CONFIG_USBIP_CORE is not set +# CONFIG_USB_CDNS3 is not set # CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_HOST is not set @@ -4043,7 +4098,6 @@ CONFIG_USB_SERIAL_PL2303=m # CONFIG_USB_EMI26 is not set # CONFIG_USB_ADUTUX is not set # CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set # CONFIG_USB_LEGOTOWER is not set # CONFIG_USB_LCD is not set # CONFIG_USB_CYPRESS_CY7C63 is not set @@ -4101,11 +4155,27 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 # end of USB Peripheral Controller # CONFIG_USB_CONFIGFS is not set -# CONFIG_TYPEC is not set +CONFIG_TYPEC=m +CONFIG_TYPEC_TCPM=m +# CONFIG_TYPEC_TCPCI is not set +CONFIG_TYPEC_FUSB302=m +# CONFIG_TYPEC_UCSI is not set +# CONFIG_TYPEC_HD3SS3220 is not set +# CONFIG_TYPEC_TPS6598X is not set + +# +# USB Type-C Multiplexer/DeMultiplexer Switch support +# +# CONFIG_TYPEC_MUX_PI3USB30532 is not set +# end of USB Type-C Multiplexer/DeMultiplexer Switch support + +# +# USB Type-C Alternate Mode drivers +# +# CONFIG_TYPEC_DP_ALTMODE is not set +# end of USB Type-C Alternate Mode drivers + CONFIG_USB_ROLE_SWITCH=y -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_UWB is not set CONFIG_MMC=y CONFIG_PWRSEQ_EMMC=y CONFIG_PWRSEQ_SIMPLE=y @@ -4142,6 +4212,7 @@ CONFIG_LEDS_CLASS=y # CONFIG_LEDS_BCM6328 is not set # CONFIG_LEDS_BCM6358 is not set # CONFIG_LEDS_CR0014114 is not set +# CONFIG_LEDS_EL15203000 is not set # CONFIG_LEDS_LM3530 is not set # CONFIG_LEDS_LM3532 is not set # CONFIG_LEDS_LM3642 is not set @@ -4244,7 +4315,6 @@ CONFIG_RTC_DRV_HYM8563=m # CONFIG_RTC_DRV_PCF8563 is not set # CONFIG_RTC_DRV_PCF8583 is not set # CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BD70528 is not set # CONFIG_RTC_DRV_BQ32K is not set # CONFIG_RTC_DRV_S35390A is not set # CONFIG_RTC_DRV_FM3130 is not set @@ -4303,11 +4373,11 @@ CONFIG_RTC_DRV_DS3232_HWMON=y # CONFIG_RTC_DRV_RP5C01 is not set # CONFIG_RTC_DRV_V3020 is not set # CONFIG_RTC_DRV_ZYNQMP is not set -# CONFIG_RTC_DRV_CROS_EC is not set # # on-CPU RTC drivers # +CONFIG_RTC_DRV_MESON_VRTC=m # CONFIG_RTC_DRV_PL030 is not set CONFIG_RTC_DRV_PL031=y # CONFIG_RTC_DRV_CADENCE is not set @@ -4326,6 +4396,8 @@ CONFIG_RTC_DRV_PL031=y CONFIG_SYNC_FILE=y # CONFIG_SW_SYNC is not set # CONFIG_UDMABUF is not set +# CONFIG_DMABUF_SELFTESTS is not set +# CONFIG_DMABUF_HEAPS is not set # end of DMABUF options # CONFIG_AUXDISPLAY is not set @@ -4339,14 +4411,118 @@ CONFIG_SYNC_FILE=y # # end of Microsoft Hyper-V guest support +# CONFIG_GREYBUS is not set CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +# CONFIG_RTL8723BS is not set +# CONFIG_R8712U is not set +# CONFIG_R8188EU is not set +# CONFIG_VT6656 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16240 is not set +# end of Accelerometers + +# +# Analog to digital converters +# +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set +# end of Analog to digital converters + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set +# end of Analog digital bi-direction converters + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7746 is not set +# end of Capacitance to digital converters + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set +# end of Direct Digital Synthesis + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set +# end of Network Analyzer, Impedance Converters + +# +# Active energy metering IC +# +# CONFIG_ADE7854 is not set +# end of Active energy metering IC + +# +# Resolver to digital converters +# +# CONFIG_AD2S1210 is not set +# end of Resolver to digital converters +# end of IIO staging drivers + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# end of Speakup console speech + CONFIG_STAGING_MEDIA=y -CONFIG_MEDIA_SUPPORT=y +CONFIG_VIDEO_MESON_VDEC=m + +# +# soc_camera sensor drivers +# + +# +# Android +# +# end of Android + +# CONFIG_STAGING_BOARD is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_UNISYSSPAR is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set +# CONFIG_MOST is not set +# CONFIG_KS7010 is not set +# CONFIG_PI433 is not set + +# +# Gasket devices +# +# end of Gasket devices + +# CONFIG_XIL_AXIS_FIFO is not set +# CONFIG_FIELDBUS_DEV is not set +# CONFIG_USB_WUSB_CBAF is not set +# CONFIG_UWB is not set +# CONFIG_STAGING_EXFAT_FS is not set +# CONFIG_WFX is not set # CONFIG_GOLDFISH is not set -CONFIG_CHROME_PLATFORMS=y -# CONFIG_CROS_EC_I2C is not set -# CONFIG_CROS_EC_SPI is not set -CONFIG_CROS_EC_PROTO=y +# CONFIG_MFD_CROS_EC is not set +# CONFIG_CHROME_PLATFORMS is not set # CONFIG_MELLANOX_PLATFORM is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y @@ -4374,7 +4550,7 @@ CONFIG_CLK_QORIQ=y CONFIG_COMMON_CLK_XGENE=y CONFIG_COMMON_CLK_PWM=y # CONFIG_COMMON_CLK_VC5 is not set -# CONFIG_COMMON_CLK_FIXED_MMIO is not set +CONFIG_COMMON_CLK_FIXED_MMIO=y CONFIG_COMMON_CLK_MESON_REGMAP=y CONFIG_COMMON_CLK_MESON_DUALDIV=y CONFIG_COMMON_CLK_MESON_MPLL=y @@ -4404,6 +4580,7 @@ CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y CONFIG_FSL_ERRATUM_A008585=y # CONFIG_HISILICON_ERRATUM_161010101 is not set # CONFIG_ARM64_ERRATUM_858921 is not set +# CONFIG_MICROCHIP_PIT64B is not set # end of Clock Source drivers CONFIG_MAILBOX=y @@ -4458,6 +4635,8 @@ CONFIG_MESON_CANVAS=y CONFIG_MESON_CLK_MEASURE=y CONFIG_MESON_GX_SOCINFO=y CONFIG_MESON_GX_PM_DOMAINS=y +CONFIG_MESON_EE_PM_DOMAINS=y +CONFIG_MESON_SECURE_PM_DOMAINS=y CONFIG_MESON_MX_SOCINFO=y # end of Amlogic SoC drivers @@ -4475,6 +4654,8 @@ CONFIG_MESON_MX_SOCINFO=y # # NXP/Freescale QorIQ SoC drivers # +# CONFIG_QUICC_ENGINE is not set +# CONFIG_FSL_RCPM is not set # end of NXP/Freescale QorIQ SoC drivers # @@ -4482,13 +4663,6 @@ CONFIG_MESON_MX_SOCINFO=y # # end of i.MX SoC drivers -# -# IXP4xx SoC drivers -# -# CONFIG_IXP4XX_QMGR is not set -# CONFIG_IXP4XX_NPE is not set -# end of IXP4xx SoC drivers - # # Qualcomm SoC drivers # @@ -4532,7 +4706,6 @@ CONFIG_EXTCON=y # CONFIG_EXTCON_RT8973A is not set # CONFIG_EXTCON_SM5502 is not set CONFIG_EXTCON_USB_GPIO=y -# CONFIG_EXTCON_USBC_CROS_EC is not set # CONFIG_MEMORY is not set CONFIG_IIO=y CONFIG_IIO_BUFFER=y @@ -4557,13 +4730,13 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_ADXL372_I2C is not set # CONFIG_BMA180 is not set # CONFIG_BMA220 is not set +# CONFIG_BMA400 is not set # CONFIG_BMC150_ACCEL is not set # CONFIG_DA280 is not set # CONFIG_DA311 is not set # CONFIG_DMARD06 is not set # CONFIG_DMARD09 is not set # CONFIG_DMARD10 is not set -# CONFIG_IIO_CROS_EC_ACCEL_LEGACY is not set # CONFIG_IIO_ST_ACCEL_3AXIS is not set # CONFIG_KXSD9 is not set CONFIG_KXCJK1013=m @@ -4584,9 +4757,11 @@ CONFIG_KXCJK1013=m # # Analog to digital converters # +# CONFIG_AD7091R5 is not set # CONFIG_AD7124 is not set # CONFIG_AD7266 is not set # CONFIG_AD7291 is not set +# CONFIG_AD7292 is not set # CONFIG_AD7298 is not set # CONFIG_AD7476 is not set # CONFIG_AD7606_IFACE_PARALLEL is not set @@ -4607,6 +4782,7 @@ CONFIG_KXCJK1013=m # CONFIG_INA2XX_ADC is not set # CONFIG_LTC2471 is not set # CONFIG_LTC2485 is not set +# CONFIG_LTC2496 is not set # CONFIG_LTC2497 is not set # CONFIG_MAX1027 is not set # CONFIG_MAX11100 is not set @@ -4664,8 +4840,6 @@ CONFIG_MESON_SARADC=y # CONFIG_VZ89X is not set # end of Chemical Sensors -# CONFIG_IIO_CROS_EC_SENSORS_CORE is not set - # # Hid Sensor IIO Common # @@ -4783,9 +4957,12 @@ CONFIG_MESON_SARADC=y # Inertial measurement units # # CONFIG_ADIS16400 is not set +# CONFIG_ADIS16460 is not set # CONFIG_ADIS16480 is not set # CONFIG_BMI160_I2C is not set # CONFIG_BMI160_SPI is not set +# CONFIG_FXOS8700_I2C is not set +# CONFIG_FXOS8700_SPI is not set # CONFIG_KMX61 is not set # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_SPI is not set @@ -4796,6 +4973,7 @@ CONFIG_MESON_SARADC=y # Light sensors # # CONFIG_ADJD_S311 is not set +# CONFIG_ADUX1020 is not set # CONFIG_AL3320A is not set # CONFIG_APDS9300 is not set # CONFIG_APDS9960 is not set @@ -4816,6 +4994,7 @@ CONFIG_MESON_SARADC=y # CONFIG_LV0104CS is not set # CONFIG_MAX44000 is not set # CONFIG_MAX44009 is not set +# CONFIG_NOA1305 is not set # CONFIG_OPT3001 is not set # CONFIG_PA12203001 is not set # CONFIG_SI1133 is not set @@ -4831,6 +5010,7 @@ CONFIG_MESON_SARADC=y # CONFIG_US5182D is not set # CONFIG_VCNL4000 is not set # CONFIG_VCNL4035 is not set +# CONFIG_VEML6030 is not set # CONFIG_VEML6070 is not set # CONFIG_VL6180 is not set # CONFIG_ZOPT2201 is not set @@ -4876,6 +5056,7 @@ CONFIG_MESON_SARADC=y # # CONFIG_AD5272 is not set # CONFIG_DS1803 is not set +# CONFIG_MAX5432 is not set # CONFIG_MAX5481 is not set # CONFIG_MAX5487 is not set # CONFIG_MCP4018 is not set @@ -4896,6 +5077,7 @@ CONFIG_MESON_SARADC=y # # CONFIG_ABP060MG is not set # CONFIG_BMP280 is not set +# CONFIG_DLHL60D is not set # CONFIG_DPS310 is not set # CONFIG_HP03 is not set # CONFIG_MPL115_I2C is not set @@ -4921,6 +5103,7 @@ CONFIG_MESON_SARADC=y # CONFIG_ISL29501 is not set # CONFIG_LIDAR_LITE_V2 is not set # CONFIG_MB1232 is not set +# CONFIG_PING is not set # CONFIG_RFD77402 is not set # CONFIG_SRF04 is not set # CONFIG_SX9500 is not set @@ -4938,6 +5121,7 @@ CONFIG_MESON_SARADC=y # # Temperature sensors # +# CONFIG_LTC2983 is not set # CONFIG_MAXIM_THERMOCOUPLE is not set # CONFIG_MLX90614 is not set # CONFIG_MLX90632 is not set @@ -4950,7 +5134,6 @@ CONFIG_MESON_SARADC=y CONFIG_PWM=y CONFIG_PWM_SYSFS=y -# CONFIG_PWM_CROS_EC is not set # CONFIG_PWM_FSL_FTM is not set CONFIG_PWM_MESON=y # CONFIG_PWM_PCA9685 is not set @@ -4970,6 +5153,8 @@ CONFIG_MESON_IRQ_GPIO=y # CONFIG_IPACK_BUS is not set CONFIG_RESET_CONTROLLER=y +# CONFIG_RESET_BRCMSTB_RESCAL is not set +# CONFIG_RESET_INTEL_GW is not set CONFIG_RESET_MESON=y CONFIG_RESET_MESON_AUDIO_ARB=y # CONFIG_RESET_TI_SYSCON is not set @@ -4996,6 +5181,7 @@ CONFIG_PHY_MESON_G12A_USB3_PCIE=y # CONFIG_PHY_MAPPHONE_MDM6600 is not set # CONFIG_PHY_OCELOT_SERDES is not set # CONFIG_PHY_SAMSUNG_USB2 is not set +# CONFIG_PHY_INTEL_EMMC is not set # end of PHY Subsystem # CONFIG_POWERCAP is not set @@ -5023,6 +5209,7 @@ CONFIG_ARM_PMU=y # CONFIG_DAX is not set CONFIG_NVMEM=y CONFIG_NVMEM_SYSFS=y +# CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_MESON_EFUSE=y # CONFIG_MESON_MX_EFUSE is not set @@ -5044,6 +5231,17 @@ CONFIG_OPTEE=y CONFIG_OPTEE_SHM_NUM_PRIV_PAGES=1 # end of TEE drivers +CONFIG_MULTIPLEXER=y + +# +# Multiplexer drivers +# +# CONFIG_MUX_ADG792A is not set +# CONFIG_MUX_ADGS1408 is not set +# CONFIG_MUX_GPIO is not set +# CONFIG_MUX_MMIO is not set +# end of Multiplexer drivers + CONFIG_PM_OPP=y # CONFIG_SIOX is not set # CONFIG_SLIMBUS is not set @@ -5098,6 +5296,7 @@ CONFIG_F2FS_STAT_FS=y # CONFIG_F2FS_FS_XATTR is not set CONFIG_F2FS_CHECK_FS=y # CONFIG_F2FS_FAULT_INJECTION is not set +# CONFIG_F2FS_FS_COMPRESSION is not set # CONFIG_FS_DAX is not set CONFIG_FS_POSIX_ACL=y CONFIG_EXPORTFS=y @@ -5105,6 +5304,7 @@ CONFIG_EXPORTFS=y CONFIG_FILE_LOCKING=y CONFIG_MANDATORY_FILE_LOCKING=y # CONFIG_FS_ENCRYPTION is not set +# CONFIG_FS_VERITY is not set CONFIG_FSNOTIFY=y CONFIG_DNOTIFY=y CONFIG_INOTIFY_USER=y @@ -5114,6 +5314,7 @@ CONFIG_AUTOFS4_FS=y CONFIG_AUTOFS_FS=y CONFIG_FUSE_FS=m # CONFIG_CUSE is not set +# CONFIG_VIRTIO_FS is not set CONFIG_OVERLAY_FS=m # CONFIG_OVERLAY_FS_REDIRECT_DIR is not set CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y @@ -5208,6 +5409,7 @@ CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 # CONFIG_PSTORE is not set # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set +# CONFIG_EROFS_FS is not set CONFIG_NETWORK_FILESYSTEMS=y CONFIG_NFS_FS=y CONFIG_NFS_V2=y @@ -5225,6 +5427,7 @@ CONFIG_ROOT_NFS=y CONFIG_NFS_FSCACHE=y # CONFIG_NFS_USE_LEGACY_DNS is not set CONFIG_NFS_USE_KERNEL_DNS=y +CONFIG_NFS_DISABLE_UDP_SUPPORT=y # CONFIG_NFSD is not set CONFIG_GRACE_PERIOD=y CONFIG_LOCKD=y @@ -5246,6 +5449,7 @@ CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y # CONFIG_CIFS_DEBUG is not set # CONFIG_CIFS_DFS_UPCALL is not set CONFIG_CIFS_FSCACHE=y +# CONFIG_CIFS_ROOT is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set CONFIG_NLS=y @@ -5301,13 +5505,13 @@ CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y # CONFIG_DLM is not set # CONFIG_UNICODE is not set +CONFIG_IO_WQ=y # end of File systems # # Security options # CONFIG_KEYS=y -CONFIG_KEYS_COMPAT=y # CONFIG_KEYS_REQUEST_CACHE is not set # CONFIG_PERSISTENT_KEYRINGS is not set # CONFIG_BIG_KEYS is not set @@ -5347,8 +5551,8 @@ CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ALGAPI2=y CONFIG_CRYPTO_AEAD=y CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_SKCIPHER=y +CONFIG_CRYPTO_SKCIPHER2=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG=y @@ -5371,6 +5575,7 @@ CONFIG_CRYPTO_CRYPTD=y # CONFIG_CRYPTO_AUTHENC is not set # CONFIG_CRYPTO_TEST is not set CONFIG_CRYPTO_SIMD=y +CONFIG_CRYPTO_ENGINE=y # # Public-key cryptography @@ -5380,6 +5585,7 @@ CONFIG_CRYPTO_DH=y CONFIG_CRYPTO_ECC=m CONFIG_CRYPTO_ECDH=m # CONFIG_CRYPTO_ECRDSA is not set +# CONFIG_CRYPTO_CURVE25519 is not set # # Authenticated Encryption with Associated Data @@ -5388,17 +5594,13 @@ CONFIG_CRYPTO_CCM=y CONFIG_CRYPTO_GCM=y # CONFIG_CRYPTO_CHACHA20POLY1305 is not set # CONFIG_CRYPTO_AEGIS128 is not set -# CONFIG_CRYPTO_AEGIS128L is not set -# CONFIG_CRYPTO_AEGIS256 is not set -# CONFIG_CRYPTO_MORUS640 is not set -# CONFIG_CRYPTO_MORUS1280 is not set CONFIG_CRYPTO_SEQIV=y CONFIG_CRYPTO_ECHAINIV=m # # Block modes # -CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_CFB=m CONFIG_CRYPTO_CTR=y CONFIG_CRYPTO_CTS=m @@ -5409,6 +5611,7 @@ CONFIG_CRYPTO_ECB=y # CONFIG_CRYPTO_XTS is not set # CONFIG_CRYPTO_KEYWRAP is not set # CONFIG_CRYPTO_ADIANTUM is not set +# CONFIG_CRYPTO_ESSIV is not set # # Hash modes @@ -5423,7 +5626,9 @@ CONFIG_CRYPTO_HMAC=y # CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_CRC32=y -# CONFIG_CRYPTO_XXHASH is not set +CONFIG_CRYPTO_XXHASH=m +CONFIG_CRYPTO_BLAKE2B=m +# CONFIG_CRYPTO_BLAKE2S is not set CONFIG_CRYPTO_CRCT10DIF=y CONFIG_CRYPTO_GHASH=y # CONFIG_CRYPTO_POLY1305 is not set @@ -5449,7 +5654,6 @@ CONFIG_CRYPTO_SHA512=y CONFIG_CRYPTO_AES=y # CONFIG_CRYPTO_AES_TI is not set # CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_LIB_ARC4=y CONFIG_CRYPTO_ARC4=y # CONFIG_CRYPTO_BLOWFISH is not set # CONFIG_CRYPTO_CAMELLIA is not set @@ -5492,12 +5696,34 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=y # CONFIG_CRYPTO_USER_API_RNG is not set # CONFIG_CRYPTO_USER_API_AEAD is not set CONFIG_CRYPTO_HASH_INFO=y + +# +# Crypto library routines +# +CONFIG_CRYPTO_LIB_AES=y +CONFIG_CRYPTO_LIB_ARC4=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_BLAKE2S=y +CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y +CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y +CONFIG_CRYPTO_LIB_CHACHA=y +CONFIG_CRYPTO_LIB_CURVE25519_GENERIC=y +CONFIG_CRYPTO_LIB_CURVE25519=y +CONFIG_CRYPTO_LIB_DES=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=9 +CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305=y +CONFIG_CRYPTO_LIB_POLY1305=y +CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y +CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_HW=y # CONFIG_CRYPTO_DEV_ATMEL_ECC is not set # CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set # CONFIG_CRYPTO_DEV_CCP is not set +# CONFIG_CRYPTO_DEV_SAFEXCEL is not set # CONFIG_CRYPTO_DEV_CCREE is not set # CONFIG_CRYPTO_DEV_HISI_SEC is not set +CONFIG_CRYPTO_DEV_AMLOGIC_GXL=y +# CONFIG_CRYPTO_DEV_AMLOGIC_GXL_DEBUG is not set CONFIG_ASYMMETRIC_KEY_TYPE=y CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y CONFIG_X509_CERTIFICATE_PARSER=y @@ -5567,7 +5793,6 @@ CONFIG_XZ_DEC=y # CONFIG_XZ_DEC_SPARC is not set # CONFIG_XZ_DEC_TEST is not set CONFIG_GENERIC_ALLOCATOR=y -CONFIG_XARRAY_MULTI=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_DMA=y @@ -5580,9 +5805,8 @@ CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y -CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y -CONFIG_ARCH_HAS_DMA_MMAP_PGPROT=y CONFIG_SWIOTLB=y +CONFIG_DMA_NONCOHERENT_MMAP=y CONFIG_DMA_REMAP=y CONFIG_DMA_DIRECT_REMAP=y CONFIG_DMA_CMA=y @@ -5606,13 +5830,10 @@ CONFIG_NLATTR=y CONFIG_CLZ_TAB=y # CONFIG_IRQ_POLL is not set CONFIG_MPILIB=y -CONFIG_DIMLIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_COMPAT_VDSO=y -# CONFIG_CROSS_COMPILE_COMPAT_VDSO is not set CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y @@ -5636,6 +5857,8 @@ CONFIG_CONSOLE_LOGLEVEL_QUIET=4 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_BOOT_PRINTK_DELAY is not set CONFIG_DYNAMIC_DEBUG=y +CONFIG_SYMBOLIC_ERRNAME=y +# CONFIG_DEBUG_BUGVERBOSE is not set # end of printk and dmesg options # @@ -5646,10 +5869,8 @@ CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_WARN=2048 CONFIG_STRIP_ASM_SYMS=y # CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y # CONFIG_HEADERS_INSTALL is not set -# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_OPTIMIZE_INLINING=y # CONFIG_DEBUG_SECTION_MISMATCH is not set CONFIG_SECTION_MISMATCH_WARN_ONLY=y CONFIG_ARCH_WANT_FRAME_POINTERS=y @@ -5657,9 +5878,20 @@ CONFIG_FRAME_POINTER=y # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set # end of Compile-time checks and compiler options +# +# Generic Kernel Debugging Instruments +# CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_DEBUG_FS=y +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y +# CONFIG_UBSAN is not set +CONFIG_UBSAN_ALIGNMENT=y +# end of Generic Kernel Debugging Instruments + CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y @@ -5671,12 +5903,15 @@ CONFIG_DEBUG_MISC=y # CONFIG_PAGE_OWNER is not set # CONFIG_PAGE_POISONING is not set # CONFIG_DEBUG_RODATA_TEST is not set +CONFIG_GENERIC_PTDUMP=y +# CONFIG_PTDUMP_DEBUGFS is not set # CONFIG_DEBUG_OBJECTS is not set # CONFIG_SLUB_DEBUG_ON is not set # CONFIG_SLUB_STATS is not set CONFIG_HAVE_DEBUG_KMEMLEAK=y # CONFIG_DEBUG_KMEMLEAK is not set # CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_SCHED_STACK_END_CHECK is not set # CONFIG_DEBUG_VM is not set CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y # CONFIG_DEBUG_VIRTUAL is not set @@ -5689,28 +5924,29 @@ CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_KASAN_STACK=1 # end of Memory Debugging -CONFIG_ARCH_HAS_KCOV=y -CONFIG_CC_HAS_SANCOV_TRACE_PC=y -# CONFIG_KCOV is not set # CONFIG_DEBUG_SHIRQ is not set # -# Debug Lockups and Hangs +# Debug Oops, Lockups and Hangs # +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 # CONFIG_SOFTLOCKUP_DETECTOR is not set CONFIG_DETECT_HUNG_TASK=y CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 # CONFIG_WQ_WATCHDOG is not set -# end of Debug Lockups and Hangs +# end of Debug Oops, Lockups and Hangs -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 +# +# Scheduler Debugging +# # CONFIG_SCHED_DEBUG is not set # CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_STACK_END_CHECK is not set +# end of Scheduler Debugging + # CONFIG_DEBUG_TIMEKEEPING is not set # @@ -5735,11 +5971,17 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set # CONFIG_DEBUG_KOBJECT is not set CONFIG_HAVE_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_BUGVERBOSE is not set + +# +# Debug kernel data structures +# # CONFIG_DEBUG_LIST is not set # CONFIG_DEBUG_PLIST is not set # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# end of Debug kernel data structures + # CONFIG_DEBUG_CREDENTIALS is not set # @@ -5755,33 +5997,41 @@ CONFIG_RCU_CPU_STALL_TIMEOUT=21 # CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set # CONFIG_LATENCYTOP is not set CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_HAVE_C_RECORDMCOUNT=y CONFIG_TRACING_SUPPORT=y # CONFIG_FTRACE is not set -# CONFIG_RUNTIME_TESTING_MENU is not set -# CONFIG_MEMTEST is not set -# CONFIG_BUG_ON_DATA_CORRUPTION is not set # CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_UBSAN is not set -CONFIG_UBSAN_ALIGNMENT=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set -# CONFIG_ARM64_PTDUMP_DEBUGFS is not set + +# +# arm64 Debugging +# # CONFIG_PID_IN_CONTEXTIDR is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set # CONFIG_DEBUG_WX is not set # CONFIG_DEBUG_ALIGN_RODATA is not set # CONFIG_ARM64_RELOC_TEST is not set # CONFIG_CORESIGHT is not set +# end of arm64 Debugging + +# +# Kernel Testing and Coverage +# +# CONFIG_KUNIT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_ARCH_HAS_KCOV=y +CONFIG_CC_HAS_SANCOV_TRACE_PC=y +# CONFIG_KCOV is not set +# CONFIG_RUNTIME_TESTING_MENU is not set +# CONFIG_MEMTEST is not set +# end of Kernel Testing and Coverage # end of Kernel hacking diff --git a/projects/Amlogic/options b/projects/Amlogic/options index 6e6ee3e929..d61cd46be2 100644 --- a/projects/Amlogic/options +++ b/projects/Amlogic/options @@ -11,6 +11,21 @@ # Kernel to use LINUX="amlogic" + # Kernel target + KERNEL_TARGET="uImage.lzo" + + # Kernel uImage load address + KERNEL_UIMAGE_LOADADDR="0x1080000" + + # Kernel uImage entry address + KERNEL_UIMAGE_ENTRYADDR="0x1080000" + + # Additional kernel make parameters + KERNEL_MAKE_EXTRACMD="dtbs" + + # kernel serial console + EXTRA_CMDLINE="systemd.debug_shell=ttyAML0 console=ttyAML0,115200n8 console=tty0" + ################################################################################ # setup build defaults ################################################################################ @@ -37,10 +52,13 @@ # Windowmanager to use (fluxbox / none) WINDOWMANAGER="none" + # Use a vendor specific KODI repo + KODI_VENDOR="amlogic" + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="dvb-firmware brcmfmac_sdio-firmware meson-firmware" + FIRMWARE="dvb-firmware brcmfmac_sdio-firmware kernel-firmware qca-firmware" # build with installer (yes / no) INSTALLER_SUPPORT="no" diff --git a/projects/Amlogic/packages/systemd/scripts/cpufreq b/projects/Amlogic/packages/systemd/scripts/cpufreq index 8fb2b3976a..940e090a58 100755 --- a/projects/Amlogic/packages/systemd/scripts/cpufreq +++ b/projects/Amlogic/packages/systemd/scripts/cpufreq @@ -4,15 +4,21 @@ # Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) -SYS_CPUFREQ_GOV=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ) -SYS_ONDEMAND_DIR="/sys/devices/system/cpu/cpufreq/ondemand/" +SYS_CPUFREQ_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) -# Configure frequency scaling properties if [ "${SYS_CPUFREQ_GOV}" = "ondemand" ]; then - echo 1 > "${SYS_ONDEMAND_DIR}/io_is_busy" - echo 50 > "${SYS_ONDEMAND_DIR}/up_threshold" - echo 100000 > "${SYS_ONDEMAND_DIR}/sampling_rate" - echo 50 > "${SYS_ONDEMAND_DIR}/sampling_down_factor" + for io_is_busy in $(find /sys/devices/system/cpu -name io_is_busy); do + echo 1 > "${io_is_busy}" + done + for up_threshold in $(find /sys/devices/system/cpu -name up_threshold); do + echo 50 > "${up_threshold}" + done + for sampling_rate in $(find /sys/devices/system/cpu -name sampling_rate); do + echo 100000 > "${sampling_rate}" + done + for sampling_down_factor in $(find /sys/devices/system/cpu -name sampling_down_factor); do + echo 50 > "${sampling_down_factor}" + done else echo "cpufreq: settings not found for current cpu governor." | systemd-cat -p info fi diff --git a/scripts/uboot_helper b/scripts/uboot_helper index 9b6fd98455..e08608dadc 100755 --- a/scripts/uboot_helper +++ b/scripts/uboot_helper @@ -136,6 +136,18 @@ devices = \ 'dtb': '', 'config': 'p212_defconfig' }, + 'khadas-vim': { + 'dtb': 'meson-gxl-s905x-khadas-vim.dtb', + 'config': 'khadas-vim_defconfig' + }, + 'khadas-vim2': { + 'dtb': 'meson-gxm-khadas-vim2.dtb', + 'config': 'khadas-vim2_defconfig' + }, + 'lafrite': { + 'dtb': 'meson-gxl-s805x-libretech-ac.dtb', + 'config': 'libretech-ac_defconfig' + }, 'lepotato': { 'dtb': 'meson-gxl-s905x-libretech-cc.dtb', 'config': 'libretech-cc_defconfig' @@ -154,6 +166,14 @@ devices = \ 'dtb': '', 'config': 'p212_defconfig' }, + 'khadas-vim3': { + 'dtb': 'meson-g12b-a311d-khadas-vim3.dtb', + 'config': 'khadas-vim3_defconfig' + }, + 'khadas-vim3l': { + 'dtb': 'meson-sm1-khadas-vim3l.dtb', + 'config': 'khadas-vim3l_defconfig' + }, 'odroid-n2': { 'dtb': 'meson-g12b-odroid-n2.dtb', 'config': 'odroid-n2_defconfig'