From d920da3376132c67e0d136ebac116d933df42be2 Mon Sep 17 00:00:00 2001 From: chewitt Date: Sun, 8 Mar 2020 13:56:41 +0000 Subject: [PATCH] amlogic: update Linux patches to 5.7.x --- packages/linux/package.mk | 7 - ...frost-Don-t-try-to-map-on-error-faul.patch | 77 - ...ROMGIT-drm-lima-update-register-info.patch | 30 - ...-FROMGIT-drm-lima-add-lima_vm_map_bo.patch | 81 - ...rm-lima-support-heap-buffer-creation.patch | 327 --- ...-recover-task-by-enlarging-heap-buff.patch | 247 -- ...-lima-increase-driver-version-to-1.1.patch | 48 - ...-fix-recovering-from-PLBU-out-of-mem.patch | 38 - ...ngs-clk-meson-add-the-gxl-internal-d.patch | 29 - ...n-gxbb-add-the-gxl-internal-dac-gate.patch | 60 - ...n-gxbb-set-audio-output-clock-hierar.patch | 56 - ...e-allow-a-dt-node-to-provide-several.patch | 42 - ...re-ensure-component-names-are-unique.patch | 73 - ...on-g12a-extract-codec-to-codec-utils.patch | 567 ---- ...son-aiu-add-audio-output-dt-bindings.patch | 163 -- ...-meson-aiu-add-i2s-and-spdif-support.patch | 1699 ------------ ...on-aiu-add-hdmi-codec-control-suppor.patch | 281 -- ...on-aiu-add-internal-dac-codec-contro.patch | 279 -- ...C-meson-axg-extract-sound-card-utils.patch | 1041 -------- ...on-gx-add-sound-card-dt-binding-docu.patch | 138 - ...ASoC-meson-gx-add-sound-card-support.patch | 202 -- ...on-aiu-remove-unused-encoder-structu.patch | 36 - ...son-aiu-fix-clk-bulk-size-allocation.patch | 31 - ...-ASoC-meson-aiu-fix-irq-registration.patch | 59 - ...on-aiu-fix-acodec-dai-input-name-ini.patch | 30 - ...on-codec-glue-fix-pcm-format-cast-wa.patch | 32 - ...eson-aiu-simplify-component-addition.patch | 113 - ...s-meson-sm1-sei610-add-missing-inter.patch | 33 - ...-meson_sm-Add-secure-power-domain-su.patch | 46 - ...ngs-power-add-Amlogic-secure-power-d.patch | 110 - ...gic-Add-support-for-Secure-power-dom.patch | 265 -- ...s-meson-a1-add-secure-power-domain-c.patch | 35 - ...son-add-t9015-internal-codec-binding.patch | 79 - ...-meson-add-t9015-internal-DAC-driver.patch | 392 --- ...T-ASoC-meson-g12a-add-tohdmitx-reset.patch | 37 - ...son-add-g12a-toacodec-dt-binding-doc.patch | 92 - ...ASoC-meson-add-g12-internal-DAC-glue.patch | 301 --- ...-meson-axg-card-add-toacodec-support.patch | 27 - ...T-arm64-dts-meson-add-pdm-reset-line.patch | 40 - ...ts-meson-s400-fix-sound-card-codec-n.patch | 45 - ...ts-meson-sei510-fix-sound-card-codec.patch | 35 - ...nfig-enable-meson-gx-audio-as-module.patch | 26 - ...dts-meson-g12a-add-internal-DAC-glue.patch | 110 - ...m64-dts-meson-u200-add-audio-support.patch | 351 --- ...-meson-gx-add-playback-audio-devices.patch | 99 - ...son-add-sound-support-to-the-librete.patch | 127 - ...son-add-audio-playback-to-khadas-vim.patch | 109 - ...eson-gxbb-add-playback-audio-devices.patch | 48 - ...eson-add-audio-playback-to-p20x-dtsi.patch | 90 - ...x-force-max_segs-max_blk_count-value.patch | 37 - ...-meson-add-missing-tsin-pinctrl-for-.patch | 164 -- ...bindings-usb-dwc3-Update-entries-for.patch | 34 - ...3-gadget-Add-support-for-disabling-S.patch | 85 - ...ts-g12-common-add-parkmode_disable_s.patch | 40 - ...bridge-Add-a-drm_bridge_state-object.patch | 622 ----- ...r-du-Plug-atomic-state-hooks-to-the-.patch | 45 - ...dge-analogix-Plug-atomic-state-hooks.patch | 45 - ...dge-Patch-atomic-hooks-to-take-a-drm.patch | 333 --- ...-drm-bridge-Add-an-atomic_check-hook.patch | 202 -- ...dge-Add-the-necessary-bits-to-suppor.patch | 614 ----- ...-pd-Use-bus-format-flags-provided-by.patch | 304 --- ...dge-lvds-codec-Implement-basic-bus-f.patch | 159 -- ...ings-display-bridge-lvds-codec-Add-n.patch | 53 - ...ridge-panel-Propage-bus-format-flags.patch | 52 - ...el-simple-Fix-the-lt089ac29000-bus_f.patch | 40 - ...-imx-imx51-zii-rdu1-Fix-the-display-.patch | 64 - ...dge-dw-hdmi-set-mtmdsclock-for-deep-.patch | 48 - ...dge-dw-hdmi-add-max-bpc-connector-pr.patch | 32 - ...dge-dw-hdmi-Plug-atomic-state-hooks-.patch | 28 - ...dge-synopsys-dw-hdmi-add-bus-format-.patch | 332 --- ...dge-synopsys-dw-hdmi-allow-ycbcr420-.patch | 49 - ...son-venc-make-drm_display_mode-const.patch | 44 - ...on-meson_dw_hdmi-add-bridge-and-swit.patch | 230 -- ...on-dw-hdmi-stop-enforcing-input_bus_.patch | 30 - ...on-venc-add-support-for-YUV420-setup.patch | 85 - ...on-vclk-add-support-for-YUV420-setup.patch | 363 --- ...-drm-meson-Add-YUV420-output-support.patch | 240 -- ...dge-dw-hdmi-fix-AVI-frame-colorimetr.patch | 77 - ...dge-dw-hdmi-Fix-color-space-conversi.patch | 36 - ...dge-dw-hdmi-Add-support-for-RGB-limi.patch | 115 - ...4l2-mem2mem-handle-draining-stopped-.patch | 387 --- ...icodec-use-v4l2-mem2mem-draining-sto.patch | 304 --- ...ia-meson-vdec-bring-up-to-compliance.patch | 742 ------ ...eson-vdec-add-H.264-decoding-support.patch | 645 ----- ...-meson-vdec-align-stride-on-32-bytes.patch | 77 - ...eson-vdec-add-helpers-for-lossless-f.patch | 73 - ...eson-vdec-add-common-HEVC-decoder-su.patch | 893 ------- ...dia-meson-vdec-add-VP9-input-support.patch | 216 -- ...a-meson-vdec-add-VP9-decoder-support.patch | 2348 ----------------- ...ts-meson-gxbb-odroid-c2-add-rc-odroi.patch | 26 - ...ts-meson-gxbb-vega-s95-fix-missing-b.patch | 45 - ...ts-meson-gxl-s905x-p212-add-bluetoot.patch | 41 - ...4-dts-meson-fix-gxm-khadas-vim2-wifi.patch | 45 - ...ts-meson-gxl-s905x-khadas-vim-add-th.patch | 93 - ...ts-meson-khadas-vim3-move-model-to-g.patch | 46 - ...ts-meson-add-support-for-the-Smartla.patch | 429 --- ...ts-meson-g12b-gtking-add-initial-dev.patch | 611 ----- ...ts-meson-g12b-fix-N2-VIM3-audio-card.patch | 43 - ...th10k-add-QCA9377-sdio-hw_param-item.patch | 69 - ...son-g12b-khadas-vim3-add-the-Etherne.patch | 54 - ...son-gxbb-odroid-c2-disable-LED-heart.patch | 31 - ...son-g12b-odroid-n2-disable-LED-heart.patch | 29 - ...son-g12b-odroid-n2-Add-cvbs-output-t.patch | 47 - ...oC-meson-add-2-8-channel-constraints.patch | 62 - ...dec-fix-chmap_idx-and-reorder-channe.patch | 203 -- ...call-hdmi_set_cts_n-after-clock-is-e.patch | 29 - ...son-khadas-vim3-fix-missing-i2c3-nod.patch | 38 - ...son-khadas-vim3-change-LED-behaviour.patch | 45 - ...son-g12b-gtking-pro-add-initial-devi.patch | 592 ----- .../amlogic/linux-0000-nop-gcc-plugin.patch | 23 - projects/Amlogic/linux/linux.aarch64.conf | 177 +- ...-HACK-set-meson-gx-cma-pool-to-768MB.patch | 12 +- ...HACK-set-meson-g12-cma-pool-to-768MB.patch | 10 +- ...m64-fix-Kodi-sysinfo-CPU-information.patch | 6 +- ...eson-gx-add-ATF-BL32-reserved-memory.patch | 8 +- ...edia-cec-silence-CEC-timeout-message.patch | 6 +- ...-mm-emit-tracepoint-when-RSS-changes.patch | 10 +- ...ways-re-init-sdcards-to-set-default-.patch | 58 + ...ngs-net-bluetooth-Add-device-tree-bi.patch | 39 + ...h-hci_qca-add-compatible-for-QCA9377.patch | 28 + ...h-hci_qca-allow-max-speed-to-be-set-.patch | 61 + ...ts-meson-S922X-extend-cpu-opp-points.patch | 57 + ...4-dts-meson-kvim3-move-hdmi-to-tdm-a.patch | 76 + ...ngs-sram-Add-Amlogic-SCP-SRAM-compat.patch | 29 + ...fconfig-enable-meson-gx-audio-as-mod.patch | 44 + ...T-arm64-dts-meson-gx-add-aiu-support.patch | 121 + ...s-meson-p230-q200-add-initial-audio-.patch | 62 +- ...s-meson-libretech-cc-add-initial-aud.patch | 66 +- ...s-meson-libretech-ac-add-initial-aud.patch | 64 +- ...s-meson-libretech-pc-add-initial-aud.patch | 77 + ...ge-dw-hdmi-Add-support-for-RGB-limit.patch | 134 + ...ge-dw-hdmi-rework-csc-related-functi.patch | 89 + ...ngs-arm-amlogic-add-odroid-c4-bindin.patch | 28 + ...s-meson-sm1-add-support-for-Hardkern.patch | 440 +++ ...s-meson-g12b-move-G12B-thermal-nodes.patch | 82 + ...-dts-meson-sm1-add-cpu-thermal-nodes.patch | 79 + ...m64-dts-meson-gxl-add-acodec-support.patch | 37 + ...s-meson-p230-q200-add-internal-DAC-s.patch | 85 + ...s-meson-libretech-cc-add-internal-DA.patch | 82 + ...s-meson-libretech-ac-add-internal-DA.patch | 82 + ...s-meson-libretech-pc-add-internal-DA.patch | 83 + ...arm64-dts-meson-g12-add-internal-DAC.patch | 10 +- ...-dts-meson-g12-add-internal-DAC-glue.patch | 38 + ...ngs-reset-meson-add-gxl-internal-dac.patch | 8 +- ...ngs-add-vendor-prefix-for-Smartlabs-.patch | 10 +- ...ngs-arm-amlogic-add-support-for-the-.patch | 6 +- ...s-meson-add-support-for-the-Smartlab.patch | 122 + ...s-meson-add-ethernet-interrupt-to-we.patch | 12 +- ...s-meson-convert-ugoos-am6-to-common-.patch | 915 +++++++ ...ngs-arm-amlogic-add-support-for-the-.patch | 7 +- ...s-meson-g12b-gtking-add-initial-devi.patch | 194 ++ ...ngs-arm-amlogic-add-support-for-the-.patch | 13 +- ...s-meson-g12b-gtking-pro-add-initial-.patch | 175 ++ ...ERS-update-the-Amlogic-VDEC-driver-m.patch | 34 + ...edia-meson-vdec-enable-mcrcc-for-VP9.patch | 67 + ...ngs-net-meson-dwmac-Add-the-amlogic-.patch | 43 + ...ngs-net-dwmac-meson-Document-the-tim.patch | 58 + ...ac-dwmac-meson8b-use-FIELD_PREP-inst.patch | 49 + ...ac-dwmac-meson8b-Move-the-documentat.patch | 46 + ...ac-dwmac-meson8b-Add-the-PRG_ETH0_AD.patch | 54 + ...ac-dwmac-meson8b-Fetch-the-timing-ad.patch | 47 + ...ac-dwmac-meson8b-Make-the-clock-enab.patch | 66 + ...ac-dwmac-meson8b-add-support-for-the.patch | 172 ++ ...ngs-phy-meson8b-usb2-Convert-to-json.patch | 129 + ...ngs-phy-meson8b-usb2-Add-compatible-.patch | 34 + ...logic-meson8b-usb2-Use-a-MMIO-regmap.patch | 166 ++ ...gic-meson8b-usb2-Don-t-set-REG_ADP_B.patch | 112 + ...gic-meson8b-usb2-unset-the-IDDQ-bit-.patch | 92 + ...gic-meson8b-usb2-Add-a-compatible-st.patch | 56 + ...meson-Add-the-Ethernet-timing-adjust.patch | 51 + ...meson-Switch-existing-boards-with-RG.patch | 66 + ...n-gx-limit-segments-to-1-when-dram-a.patch | 46 + ...a-meson-vdec-fix-another-case-of-VP9.patch | 133 + ...bridge-dw-hdmi-do-not-force-none-sca.patch | 16 +- ...meson-add-mode-selection-limits-agai.patch | 182 ++ ...fourcc-Add-modifier-definitions-for-.patch | 80 +- ...meson-add-Amlogic-Video-FBC-register.patch | 8 +- ...meson-overlay-setup-overlay-for-Amlo.patch | 115 +- ...meson-overlay-setup-overlay-for-Amlo.patch | 86 + ...meson-overlay-setup-overlay-for-Amlo.patch | 105 + ...meson-crtc-handle-commit-of-Amlogic-.patch | 15 +- ...mal-devfreq_cooling-Use-PM-QoS-to-se.patch | 165 ++ ...-drm-meson-Remove-unneeded-semicolon.patch | 31 + ...meson-viu-fix-setting-the-OSD-burst-.patch | 81 + ...indings-mfd-add-Khadas-Microcontroll.patch | 72 + ...add-support-for-the-Khadas-System-co.patch | 310 +++ ...mal-add-support-for-the-MCU-controll.patch | 231 ++ ...m-add-support-for-the-Khadas-MCU-Pro.patch | 193 ++ ...TAINERS-add-myself-as-maintainer-for.patch | 38 + ...4-dts-meson-khadas-vim3-add-Khadas-M.patch | 58 + ...-meson-gx-card-fix-sound-dai-dt-sche.patch | 48 + ...-meson-convert-axg-tdm-interface-to-.patch | 8 +- ...-meson-convert-axg-tdm-formatters-to.patch | 30 +- ...ASoC-meson-convert-axg-pdm-to-schema.patch | 7 +- ...SoC-meson-convert-axg-fifo-to-schema.patch | 7 +- ...-meson-convert-axg-spdif-input-to-sc.patch | 8 +- ...-meson-convert-axg-spdif-output-to-s.patch | 8 +- ...-meson-convert-g12a-tohdmitx-control.patch | 9 +- ...-meson-convert-axg-sound-card-contro.patch | 19 +- ...a-videodev2-add-Compressed-Framebuff.patch | 60 + ...a-meson-vdec-handle-bitdepth-on-sour.patch | 117 + ...a-meson-vdec-update-compressed-buffe.patch | 190 ++ ...a-meson-vdec-add-support-for-compres.patch | 322 +++ ...a-meson-vdec-handle-compressed-outpu.patch | 213 ++ ...amlogic-meson-gx-socinfo-Fix-S905X3-.patch | 45 + ...dt-bindings-amlogic-meson-gx-spicc-F.patch | 79 + ...trl-meson-fix-drive-strength-registe.patch | 40 + ...indings-clk-g12a-clkc-Add-NNA-CLK-So.patch | 29 + ...meson-g12a-Add-support-for-NNA-CLK-s.patch | 192 ++ ...panfrost-Fix-inbalance-of-devfreq-re.patch | 66 + ...panfrost-Fix-runtime-PM-imbalance-on.patch | 31 + ...panfrost-Fix-runtime-PM-imbalance-in.patch | 49 + ...panfrost-Reduce-the-amount-of-logs-o.patch | 48 + ...-panfrost-Use-kvfree-to-free-bo-sgts.patch | 46 + ...rost-Add-compatible-string-for-bifro.patch | 28 + ...rost-Make-sure-GPU-is-powered-on-whe.patch | 51 + ...4-dts-meson-add-missing-gxl-rng-cloc.patch | 34 + ...-meson-imply-acodec-glue-on-axg-soun.patch | 26 + ...indings-net-dwmac-meson-Add-a-compat.patch | 51 + ...stmmac-dwmac-meson8b-add-a-compatibl.patch | 38 + ...stmmac-dwmac-meson8b-use-clk_parent_.patch | 143 + ...4-dts-meson-odroid-n2-enable-audio-l.patch | 124 + ...4-dts-meson-odroid-n2-add-jack-audio.patch | 170 ++ ...serial-meson_uart-Init-port-lock-ear.patch | 39 + ...pcm-dpcm-fix-playback-capture-checks.patch | 74 + ...-add-support-for-custom-soft-reset-o.patch | 63 + ...k-meson-g12a-fix-gp0-and-hifi-ranges.patch | 6 +- ...WIP-clk-meson-g12a-fix-hifi-pll-lock.patch | 33 + ...arm-amlogic-add-support-for-the-WeTe.patch | 45 + ...son-add-support-for-the-WeTek-Core-2.patch | 132 + ...arm-amlogic-add-support-for-the-Tani.patch | 10 +- ...son-add-support-for-the-Tanix-TX5-Ma.patch | 31 +- ...-dts-meson-add-common-SM1-ac2xx-dtsi.patch | 411 +++ ...ngs-arm-amlogic-add-X96-AIR-bindings.patch | 35 + ...son-add-initial-device-trees-for-X96.patch | 260 ++ ...-arm-amlogic-add-A95XF3-AIR-bindings.patch | 28 + ...son-sm1-add-support-for-CYX-A95XF3-A.patch | 138 + ...arm-amlogic-add-support-for-the-Beel.patch | 29 + ...son-add-initial-Beelink-GS-King-X-de.patch | 276 ++ ...son-add-multiple-MeCool-device-trees.patch | 266 ++ ...dts-meson-add-audio-playback-to-a95x.patch | 73 + ...son-add-audio-playback-to-khadas-vim.patch | 86 + ...son-add-audio-playback-to-khadas-vim.patch | 20 +- ...eson-add-audio-playback-to-nanopi-k2.patch | 74 + ...eson-add-audio-playback-to-nexbox-a1.patch | 65 +- ...eson-add-audio-playback-to-odroid-c2.patch | 20 +- ...eson-add-audio-playback-to-odroid-c4.patch | 136 + ...dts-meson-add-audio-playback-to-p201.patch | 70 + ...dts-meson-add-audio-playback-to-p200.patch | 99 + ...son-add-audio-playback-to-p212-s905x.patch | 63 +- ...meson-add-audio-playback-to-rbox-pro.patch | 128 + ...dts-meson-add-audio-playback-to-u200.patch | 192 ++ ...son-add-audio-playback-to-vega-s95-d.patch | 102 + ...eson-add-audio-playback-to-wetek-hub.patch | 27 +- ...son-add-audio-playback-to-wetek-play.patch | 49 +- ...-dev_err-g-drivers-net-phy-realtek.c.patch | 44 + ...int-PRG_ETH0-PRG_ETH1-values-at-init.patch | 26 + ...-dts-meson-misc-fixups-for-w400-dtsi.patch | 70 + ...son-add-i2c3-rtc-nodes-and-vrtc-alia.patch | 50 + ...son-add-i2c3-rtc-nodes-and-vrtc-alia.patch | 49 + ...son-add-i2c3-rtc-nodes-and-vrtc-alia.patch | 44 + ...son-enable-rtc-node-on-Khadas-VIM1-V.patch | 48 + ...son-fix-spifc-node-on-Khadas-VIM3-VI.patch | 31 + ...son-fix-mmc0-tuning-error-on-Khadas-.patch | 54 + ...-meson-switch-VIM3-VIM3L-to-rgmii-id.patch | 28 + ...s-meson-switch-ODROID-N2-to-rgmii-id.patch | 27 + ...s-meson-switch-ODROID-C4-to-rgmii-id.patch | 27 + 267 files changed, 12400 insertions(+), 21734 deletions(-) delete mode 100644 packages/linux/patches/amlogic/amlogic-0001-FROMLIST-drm-panfrost-Don-t-try-to-map-on-error-faul.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0002-FROMGIT-drm-lima-update-register-info.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0003-FROMGIT-drm-lima-add-lima_vm_map_bo.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0004-FROMGIT-drm-lima-support-heap-buffer-creation.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0005-FROMGIT-drm-lima-recover-task-by-enlarging-heap-buff.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0006-FROMGIT-drm-lima-increase-driver-version-to-1.1.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0007-FROMGIT-drm-lima-fix-recovering-from-PLBU-out-of-mem.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0009-FROMGIT-dt-bindings-clk-meson-add-the-gxl-internal-d.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-gxbb-add-the-gxl-internal-dac-gate.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-gxbb-set-audio-output-clock-hierar.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0012-FROMGIT-ASoC-core-allow-a-dt-node-to-provide-several.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0013-FROMGIT-ASoC-core-ensure-component-names-are-unique.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0014-FROMGIT-ASoC-meson-g12a-extract-codec-to-codec-utils.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0015-FROMGIT-ASoC-meson-aiu-add-audio-output-dt-bindings.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0016-FROMGIT-ASoC-meson-aiu-add-i2s-and-spdif-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0017-FROMGIT-ASoC-meson-aiu-add-hdmi-codec-control-suppor.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0018-FROMGIT-ASoC-meson-aiu-add-internal-dac-codec-contro.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0019-FROMGIT-ASoC-meson-axg-extract-sound-card-utils.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0020-FROMGIT-ASoC-meson-gx-add-sound-card-dt-binding-docu.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0021-FROMGIT-ASoC-meson-gx-add-sound-card-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0022-FROMGIT-ASoC-meson-aiu-remove-unused-encoder-structu.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0023-FROMGIT-ASoC-meson-aiu-fix-clk-bulk-size-allocation.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0025-FROMGIT-ASoC-meson-aiu-fix-acodec-dai-input-name-ini.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0026-FROMGIT-ASoC-meson-codec-glue-fix-pcm-format-cast-wa.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0028-FROMGIT-arm64-dts-meson-sm1-sei610-add-missing-inter.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0029-FROMGIT-firmware-meson_sm-Add-secure-power-domain-su.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-power-add-Amlogic-secure-power-d.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0031-FROMGIT-soc-amlogic-Add-support-for-Secure-power-dom.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0032-FROMGIT-arm64-dts-meson-a1-add-secure-power-domain-c.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0034-FROMLIST-ASoC-meson-add-t9015-internal-codec-binding.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0035-FROMLIST-ASoC-meson-add-t9015-internal-DAC-driver.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0045-FROMLIST-ASoC-meson-add-g12a-toacodec-dt-binding-doc.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0046-FROMLIST-ASoC-meson-add-g12-internal-DAC-glue.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0047-FROMLIST-ASoC-meson-axg-card-add-toacodec-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0048-FROMLIST-arm64-dts-meson-add-pdm-reset-line.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0049-FROMLIST-arm64-dts-meson-s400-fix-sound-card-codec-n.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0050-FROMLIST-arm64-dts-meson-sei510-fix-sound-card-codec.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0051-WIP-arm64-defconfig-enable-meson-gx-audio-as-module.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0053-WIP-arm64-dts-meson-g12a-add-internal-DAC-glue.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0054-WIP-arm64-dts-meson-u200-add-audio-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0055-WIP-arm64-dts-meson-gx-add-playback-audio-devices.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0059-WIP-arm64-dts-meson-add-sound-support-to-the-librete.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0061-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0062-WIP-arm64-dts-meson-gxbb-add-playback-audio-devices.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0065-WIP-arm64-dts-meson-add-audio-playback-to-p20x-dtsi.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0071-HACK-mmc-meson-gx-force-max_segs-max_blk_count-value.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0075-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0076-FROMLIST-doc-dt-bindings-usb-dwc3-Update-entries-for.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0077-FROMLIST-usb-dwc3-gadget-Add-support-for-disabling-S.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0078-FROMLIST-arm64-dts-g12-common-add-parkmode_disable_s.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-Add-a-drm_bridge_state-object.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-rcar-du-Plug-atomic-state-hooks-to-the-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-analogix-Plug-atomic-state-hooks.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-Patch-atomic-hooks-to-take-a-drm.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-Add-an-atomic_check-hook.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0084-FROMLIST-drm-bridge-Add-the-necessary-bits-to-suppor.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0085-FROMLIST-drm-imx-pd-Use-bus-format-flags-provided-by.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0086-FROMLIST-drm-bridge-lvds-codec-Implement-basic-bus-f.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0087-FROMLIST-dt-bindings-display-bridge-lvds-codec-Add-n.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0088-FROMLIST-drm-bridge-panel-Propage-bus-format-flags.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0089-FROMLIST-drm-panel-simple-Fix-the-lt089ac29000-bus_f.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0090-FROMLIST-ARM-dts-imx-imx51-zii-rdu1-Fix-the-display-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0091-FROMLIST-drm-bridge-dw-hdmi-set-mtmdsclock-for-deep-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0092-FROMLIST-drm-bridge-dw-hdmi-add-max-bpc-connector-pr.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0093-FROMLIST-drm-bridge-dw-hdmi-Plug-atomic-state-hooks-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0094-FROMLIST-drm-bridge-synopsys-dw-hdmi-add-bus-format-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0095-FROMLIST-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-venc-make-drm_display_mode-const.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0097-FROMLIST-drm-meson-meson_dw_hdmi-add-bridge-and-swit.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0098-FROMLIST-drm-meson-dw-hdmi-stop-enforcing-input_bus_.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0099-FROMLIST-drm-meson-venc-add-support-for-YUV420-setup.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0100-FROMLIST-drm-meson-vclk-add-support-for-YUV420-setup.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0102-FROMLIST-drm-bridge-dw-hdmi-fix-AVI-frame-colorimetr.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0103-FROMLIST-drm-bridge-dw-hdmi-Fix-color-space-conversi.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0105-FROMLIST-drm-bridge-dw-hdmi-Add-support-for-RGB-limi.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0107-FROMLIST-media-vicodec-use-v4l2-mem2mem-draining-sto.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0108-FROMLIST-media-meson-vdec-bring-up-to-compliance.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0109-FROMLIST-media-meson-vdec-add-H.264-decoding-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0110-FROMLIST-media-meson-vdec-align-stride-on-32-bytes.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0111-FROMLIST-media-meson-vdec-add-helpers-for-lossless-f.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0112-FROMLIST-media-meson-vdec-add-common-HEVC-decoder-su.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0113-FROMLIST-media-meson-vdec-add-VP9-input-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0114-FROMLIST-media-meson-vdec-add-VP9-decoder-support.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0119-FROMLIST-arm64-dts-meson-gxbb-odroid-c2-add-rc-odroi.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0120-FROMLIST-arm64-dts-meson-gxbb-vega-s95-fix-missing-b.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0122-FROMLIST-arm64-dts-meson-fix-gxm-khadas-vim2-wifi.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0123-FROMLIST-arm64-dts-meson-gxl-s905x-khadas-vim-add-th.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0124-FROMLIST-arm64-dts-meson-khadas-vim3-move-model-to-g.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0127-FROMLIST-arm64-dts-meson-add-support-for-the-Smartla.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0132-FROMLIST-arm64-dts-meson-g12b-fix-N2-VIM3-audio-card.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0133-WIP-ath10k-add-QCA9377-sdio-hw_param-item.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0134-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0135-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0136-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0137-WIP-arm64-dts-meson-g12b-odroid-n2-Add-cvbs-output-t.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0139-WIP-ASoC-meson-add-2-8-channel-constraints.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0140-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0141-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0142-WIP-arm64-dts-meson-khadas-vim3-fix-missing-i2c3-nod.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0143-WIP-arm64-dts-meson-khadas-vim3-change-LED-behaviour.patch delete mode 100644 packages/linux/patches/amlogic/amlogic-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch delete mode 100644 packages/linux/patches/amlogic/linux-0000-nop-gcc-plugin.patch rename packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch => projects/Amlogic/patches/linux/amlogic-0001-HACK-set-meson-gx-cma-pool-to-768MB.patch (68%) rename packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch => projects/Amlogic/patches/linux/amlogic-0002-HACK-set-meson-g12-cma-pool-to-768MB.patch (71%) rename packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch => projects/Amlogic/patches/linux/amlogic-0003-HACK-arm64-fix-Kodi-sysinfo-CPU-information.patch (83%) rename packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch => projects/Amlogic/patches/linux/amlogic-0004-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch (84%) rename packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch => projects/Amlogic/patches/linux/amlogic-0005-HACK-media-cec-silence-CEC-timeout-message.patch (89%) rename packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch => projects/Amlogic/patches/linux/amlogic-0006-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch (91%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0007-HACK-mmc-core-always-re-init-sdcards-to-set-default-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0008-FROMGIT-dt-bindings-net-bluetooth-Add-device-tree-bi.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0009-FROMGIT-Bluetooth-hci_qca-add-compatible-for-QCA9377.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0010-FROMGIT-Bluetooth-hci_qca-allow-max-speed-to-be-set-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0011-FROMGIT-arm64-dts-meson-S922X-extend-cpu-opp-points.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0012-FROMGIT-arm64-dts-meson-kvim3-move-hdmi-to-tdm-a.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0013-FROMGIT-dt-bindings-sram-Add-Amlogic-SCP-SRAM-compat.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0014-FROMGIT-arm64-defconfig-enable-meson-gx-audio-as-mod.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0015-FROMGIT-arm64-dts-meson-gx-add-aiu-support.patch rename packages/linux/patches/amlogic/amlogic-0056-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch => projects/Amlogic/patches/linux/amlogic-0016-FROMGIT-arm64-dts-meson-p230-q200-add-initial-audio-.patch (58%) rename packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch => projects/Amlogic/patches/linux/amlogic-0017-FROMGIT-arm64-dts-meson-libretech-cc-add-initial-aud.patch (50%) rename packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch => projects/Amlogic/patches/linux/amlogic-0018-FROMGIT-arm64-dts-meson-libretech-ac-add-initial-aud.patch (50%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0019-FROMGIT-arm64-dts-meson-libretech-pc-add-initial-aud.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0020-FROMGIT-drm-bridge-dw-hdmi-Add-support-for-RGB-limit.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0021-FROMGIT-drm-bridge-dw-hdmi-rework-csc-related-functi.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0022-FROMGIT-dt-bindings-arm-amlogic-add-odroid-c4-bindin.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0023-FROMGIT-arm64-dts-meson-sm1-add-support-for-Hardkern.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0024-FROMGIT-arm64-dts-meson-g12b-move-G12B-thermal-nodes.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0025-FROMGIT-arm64-dts-meson-sm1-add-cpu-thermal-nodes.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0026-FROMGIT-arm64-dts-meson-gxl-add-acodec-support.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0027-FROMGIT-arm64-dts-meson-p230-q200-add-internal-DAC-s.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0028-FROMGIT-arm64-dts-meson-libretech-cc-add-internal-DA.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0029-FROMGIT-arm64-dts-meson-libretech-ac-add-internal-DA.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0030-FROMGIT-arm64-dts-meson-libretech-pc-add-internal-DA.patch rename packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch => projects/Amlogic/patches/linux/amlogic-0031-FROMGIT-arm64-dts-meson-g12-add-internal-DAC.patch (76%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0032-FROMGIT-arm64-dts-meson-g12-add-internal-DAC-glue.patch rename packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch => projects/Amlogic/patches/linux/amlogic-0033-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch (74%) rename packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch => projects/Amlogic/patches/linux/amlogic-0034-FROMGIT-dt-bindings-add-vendor-prefix-for-Smartlabs-.patch (79%) rename packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch => projects/Amlogic/patches/linux/amlogic-0035-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch (87%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0036-FROMGIT-arm64-dts-meson-add-support-for-the-Smartlab.patch rename packages/linux/patches/amlogic/amlogic-0138-WIP-arm64-dts-meson-wetek-fix-ethmac-node-probing.patch => projects/Amlogic/patches/linux/amlogic-0037-FROMGIT-arm64-dts-meson-add-ethernet-interrupt-to-we.patch (70%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0038-FROMGIT-arm64-dts-meson-convert-ugoos-am6-to-common-.patch rename packages/linux/patches/amlogic/amlogic-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch => projects/Amlogic/patches/linux/amlogic-0039-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch (79%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0040-FROMGIT-arm64-dts-meson-g12b-gtking-add-initial-devi.patch rename packages/linux/patches/amlogic/amlogic-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch => projects/Amlogic/patches/linux/amlogic-0041-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch (69%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0042-FROMGIT-arm64-dts-meson-g12b-gtking-pro-add-initial-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0043-FROMGIT-MAINTAINERS-update-the-Amlogic-VDEC-driver-m.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0044-FROMGIT-media-meson-vdec-enable-mcrcc-for-VP9.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0045-FROMGIT-dt-bindings-net-meson-dwmac-Add-the-amlogic-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0046-FROMGIT-dt-bindings-net-dwmac-meson-Document-the-tim.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0047-FROMGIT-net-stmmac-dwmac-meson8b-use-FIELD_PREP-inst.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0048-FROMGIT-net-stmmac-dwmac-meson8b-Move-the-documentat.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0049-FROMGIT-net-stmmac-dwmac-meson8b-Add-the-PRG_ETH0_AD.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0050-FROMGIT-net-stmmac-dwmac-meson8b-Fetch-the-timing-ad.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0051-FROMGIT-net-stmmac-dwmac-meson8b-Make-the-clock-enab.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0052-FROMGIT-net-stmmac-dwmac-meson8b-add-support-for-the.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0053-FROMGIT-dt-bindings-phy-meson8b-usb2-Convert-to-json.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0054-FROMGIT-dt-bindings-phy-meson8b-usb2-Add-compatible-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0055-FROMGIT-phy-amlogic-meson8b-usb2-Use-a-MMIO-regmap.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0056-FROMGIT-phy-amlogic-meson8b-usb2-Don-t-set-REG_ADP_B.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0057-FROMGIT-phy-amlogic-meson8b-usb2-unset-the-IDDQ-bit-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0058-FROMGIT-phy-amlogic-meson8b-usb2-Add-a-compatible-st.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0059-FROMGIT-ARM-dts-meson-Add-the-Ethernet-timing-adjust.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0060-FROMGIT-ARM-dts-meson-Switch-existing-boards-with-RG.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0061-FROMGIT-mmc-meson-gx-limit-segments-to-1-when-dram-a.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0062-FROMLIST-v1-media-meson-vdec-fix-another-case-of-VP9.patch rename packages/linux/patches/amlogic/amlogic-0104-FROMLIST-drm-bridge-dw-hdmi-do-not-force-none-scan-m.patch => projects/Amlogic/patches/linux/amlogic-0063-FROMLIST-v2-drm-bridge-dw-hdmi-do-not-force-none-sca.patch (68%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0064-FROMLIST-v2-drm-meson-add-mode-selection-limits-agai.patch rename packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch => projects/Amlogic/patches/linux/amlogic-0065-FROMLIST-v6-drm-fourcc-Add-modifier-definitions-for-.patch (56%) rename packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch => projects/Amlogic/patches/linux/amlogic-0066-FROMLIST-v6-drm-meson-add-Amlogic-Video-FBC-register.patch (88%) rename packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch => projects/Amlogic/patches/linux/amlogic-0067-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch (81%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0068-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0069-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch rename packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch => projects/Amlogic/patches/linux/amlogic-0070-FROMLIST-v6-drm-meson-crtc-handle-commit-of-Amlogic-.patch (94%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0071-FROMLIST-v1-thermal-devfreq_cooling-Use-PM-QoS-to-se.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0072-FROMLIST-v1-drm-meson-Remove-unneeded-semicolon.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0073-FROMLIST-v1-drm-meson-viu-fix-setting-the-OSD-burst-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0074-FROMLIST-v2-dt-bindings-mfd-add-Khadas-Microcontroll.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0075-FROMLIST-v2-mfd-add-support-for-the-Khadas-System-co.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0076-FROMLIST-v2-thermal-add-support-for-the-MCU-controll.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0077-FROMLIST-v2-nvmem-add-support-for-the-Khadas-MCU-Pro.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0078-FROMLIST-v2-MAINTAINERS-add-myself-as-maintainer-for.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0079-FROMLIST-v2-arm64-dts-meson-khadas-vim3-add-Khadas-M.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0080-FROMLIST-v1-ASoC-meson-gx-card-fix-sound-dai-dt-sche.patch rename packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch => projects/Amlogic/patches/linux/amlogic-0081-FROMLIST-v1-ASoC-meson-convert-axg-tdm-interface-to-.patch (92%) rename packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch => projects/Amlogic/patches/linux/amlogic-0082-FROMLIST-v1-ASoC-meson-convert-axg-tdm-formatters-to.patch (88%) rename packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch => projects/Amlogic/patches/linux/amlogic-0083-FROMLIST-v1-ASoC-meson-convert-axg-pdm-to-schema.patch (94%) rename packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch => projects/Amlogic/patches/linux/amlogic-0084-FROMLIST-v1-ASoC-meson-convert-axg-fifo-to-schema.patch (95%) rename packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch => projects/Amlogic/patches/linux/amlogic-0085-FROMLIST-v1-ASoC-meson-convert-axg-spdif-input-to-sc.patch (94%) rename packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch => projects/Amlogic/patches/linux/amlogic-0086-FROMLIST-v1-ASoC-meson-convert-axg-spdif-output-to-s.patch (93%) rename packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch => projects/Amlogic/patches/linux/amlogic-0087-FROMLIST-v1-ASoC-meson-convert-g12a-tohdmitx-control.patch (93%) rename packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch => projects/Amlogic/patches/linux/amlogic-0088-FROMLIST-v1-ASoC-meson-convert-axg-sound-card-contro.patch (95%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0089-FROMLIST-v1-media-videodev2-add-Compressed-Framebuff.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0090-FROMLIST-v1-media-meson-vdec-handle-bitdepth-on-sour.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0091-FROMLIST-v1-media-meson-vdec-update-compressed-buffe.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0092-FROMLIST-v1-media-meson-vdec-add-support-for-compres.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0093-FROMLIST-v1-media-meson-vdec-handle-compressed-outpu.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0094-FROMLIST-v2-soc-amlogic-meson-gx-socinfo-Fix-S905X3-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0095-FROMLIST-v1-spi-dt-bindings-amlogic-meson-gx-spicc-F.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0096-FROMLIST-v1-pinctrl-meson-fix-drive-strength-registe.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0097-FROMLIST-v1-dt-bindings-clk-g12a-clkc-Add-NNA-CLK-So.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0098-FROMLIST-v1-clk-meson-g12a-Add-support-for-NNA-CLK-s.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0099-FROMLIST-v1-drm-panfrost-Fix-inbalance-of-devfreq-re.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0100-FROMLIST-v2-drm-panfrost-Fix-runtime-PM-imbalance-on.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0101-FROMLIST-v1-drm-panfrost-Fix-runtime-PM-imbalance-in.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0102-FROMLIST-v3-drm-panfrost-Reduce-the-amount-of-logs-o.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0103-FROMLIST-v2-drm-panfrost-Use-kvfree-to-free-bo-sgts.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0104-FROMLIST-v1-panfrost-Add-compatible-string-for-bifro.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0105-FROMLIST-v1-panfrost-Make-sure-GPU-is-powered-on-whe.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0106-FROMLIST-v1-arm64-dts-meson-add-missing-gxl-rng-cloc.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0107-FROMLIST-v1-ASoC-meson-imply-acodec-glue-on-axg-soun.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0108-FROMLIST-v1-dt-bindings-net-dwmac-meson-Add-a-compat.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0109-FROMLIST-v1-net-stmmac-dwmac-meson8b-add-a-compatibl.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0110-FROMLIST-v1-net-stmmac-dwmac-meson8b-use-clk_parent_.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0111-FROMLIST-v1-arm64-dts-meson-odroid-n2-enable-audio-l.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0112-FROMLIST-v1-arm64-dts-meson-odroid-n2-add-jack-audio.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0113-FROMLIST-v1-tty-serial-meson_uart-Init-port-lock-ear.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0114-REVERT-ASoC-soc-pcm-dpcm-fix-playback-capture-checks.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0115-WIP-drm-panfrost-add-support-for-custom-soft-reset-o.patch rename packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch => projects/Amlogic/patches/linux/amlogic-0116-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch (87%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0117-WIP-clk-meson-g12a-fix-hifi-pll-lock.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0118-WIP-dt-bindings-arm-amlogic-add-support-for-the-WeTe.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0119-WIP-arm64-dts-meson-add-support-for-the-WeTek-Core-2.patch rename packages/linux/patches/amlogic/amlogic-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch => projects/Amlogic/patches/linux/amlogic-0120-WIP-dt-bindings-arm-amlogic-add-support-for-the-Tani.patch (78%) rename packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch => projects/Amlogic/patches/linux/amlogic-0121-WIP-arm64-dts-meson-add-support-for-the-Tanix-TX5-Ma.patch (96%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0122-WIP-arm64-dts-meson-add-common-SM1-ac2xx-dtsi.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0123-WIP-dt-bindings-arm-amlogic-add-X96-AIR-bindings.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0124-WIP-arm64-dts-meson-add-initial-device-trees-for-X96.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0125-WIP-dt-bindings-arm-amlogic-add-A95XF3-AIR-bindings.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0126-WIP-arm64-dts-meson-sm1-add-support-for-CYX-A95XF3-A.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0127-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0128-WIP-arm64-dts-meson-add-initial-Beelink-GS-King-X-de.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0129-WIP-arm64-dts-meson-add-multiple-MeCool-device-trees.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0130-WIP-arm64-dts-meson-add-audio-playback-to-a95x.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0131-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch rename packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch => projects/Amlogic/patches/linux/amlogic-0132-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch (85%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0133-WIP-arm64-dts-meson-add-audio-playback-to-nanopi-k2.patch rename packages/linux/patches/amlogic/amlogic-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch => projects/Amlogic/patches/linux/amlogic-0134-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch (65%) rename packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch => projects/Amlogic/patches/linux/amlogic-0135-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch (77%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0136-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c4.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0137-WIP-arm64-dts-meson-add-audio-playback-to-p201.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0138-WIP-arm64-dts-meson-add-audio-playback-to-p200.patch rename packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch => projects/Amlogic/patches/linux/amlogic-0139-WIP-arm64-dts-meson-add-audio-playback-to-p212-s905x.patch (50%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0140-WIP-arm64-dts-meson-add-audio-playback-to-rbox-pro.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0141-WIP-arm64-dts-meson-add-audio-playback-to-u200.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0142-WIP-arm64-dts-meson-add-audio-playback-to-vega-s95-d.patch rename packages/linux/patches/amlogic/amlogic-0066-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch => projects/Amlogic/patches/linux/amlogic-0143-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch (70%) rename packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch => projects/Amlogic/patches/linux/amlogic-0144-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch (69%) create mode 100644 projects/Amlogic/patches/linux/amlogic-0145-DEBUG-s-dev_dbg-dev_err-g-drivers-net-phy-realtek.c.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0146-DEBUG-print-PRG_ETH0-PRG_ETH1-values-at-init.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0147-WIP-arm64-dts-meson-misc-fixups-for-w400-dtsi.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0148-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0149-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0150-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0151-WIP-arm64-dts-meson-enable-rtc-node-on-Khadas-VIM1-V.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0152-WIP-arm64-dts-meson-fix-spifc-node-on-Khadas-VIM3-VI.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0153-WIP-arm64-dts-meson-fix-mmc0-tuning-error-on-Khadas-.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0154-WIP-arm64-dts-meson-switch-VIM3-VIM3L-to-rgmii-id.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0155-WIP-arm64-dts-meson-switch-ODROID-N2-to-rgmii-id.patch create mode 100644 projects/Amlogic/patches/linux/amlogic-0156-WIP-arm64-dts-meson-switch-ODROID-C4-to-rgmii-id.patch diff --git a/packages/linux/package.mk b/packages/linux/package.mk index ec8473370a..896066f23e 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -15,13 +15,6 @@ PKG_STAMP="$KERNEL_TARGET $KERNEL_MAKE_EXTRACMD" PKG_PATCH_DIRS="$LINUX" case "$LINUX" in - amlogic) - 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" - ;; raspberrypi) PKG_VERSION="d00cdd80abb2a8c201cae2f6bd80e27eb2f7d347" # 5.4.45 PKG_SHA256="4c6e5c458dfd07c8557afaedb54ad037f8d35c741f297a1b92ed796c69dec9de" 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 deleted file mode 100644 index 3cdc8f27ac..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0001-FROMLIST-drm-panfrost-Don-t-try-to-map-on-error-faul.patch +++ /dev/null @@ -1,77 +0,0 @@ -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-drm-lima-update-register-info.patch b/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-drm-lima-update-register-info.patch deleted file mode 100644 index e1ced805e5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0002-FROMGIT-drm-lima-update-register-info.patch +++ /dev/null @@ -1,30 +0,0 @@ -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-drm-lima-add-lima_vm_map_bo.patch b/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-drm-lima-add-lima_vm_map_bo.patch deleted file mode 100644 index 5ec5f96e6e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0003-FROMGIT-drm-lima-add-lima_vm_map_bo.patch +++ /dev/null @@ -1,81 +0,0 @@ -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-drm-lima-support-heap-buffer-creation.patch b/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-drm-lima-support-heap-buffer-creation.patch deleted file mode 100644 index 3f7b0870de..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0004-FROMGIT-drm-lima-support-heap-buffer-creation.patch +++ /dev/null @@ -1,327 +0,0 @@ -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-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 deleted file mode 100644 index f98586abef..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0005-FROMGIT-drm-lima-recover-task-by-enlarging-heap-buff.patch +++ /dev/null @@ -1,247 +0,0 @@ -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-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 deleted file mode 100644 index 9c59af69a7..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0006-FROMGIT-drm-lima-increase-driver-version-to-1.1.patch +++ /dev/null @@ -1,48 +0,0 @@ -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-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 deleted file mode 100644 index e2ffb1a778..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0007-FROMGIT-drm-lima-fix-recovering-from-PLBU-out-of-mem.patch +++ /dev/null @@ -1,38 +0,0 @@ -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-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 deleted file mode 100644 index 3d5f5db0c3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0009-FROMGIT-dt-bindings-clk-meson-add-the-gxl-internal-d.patch +++ /dev/null @@ -1,29 +0,0 @@ -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-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 deleted file mode 100644 index 969355cf56..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0010-FROMGIT-clk-meson-gxbb-add-the-gxl-internal-dac-gate.patch +++ /dev/null @@ -1,60 +0,0 @@ -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 deleted file mode 100644 index 04c2b83f25..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0011-FROMGIT-clk-meson-gxbb-set-audio-output-clock-hierar.patch +++ /dev/null @@ -1,56 +0,0 @@ -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-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 deleted file mode 100644 index 11b2abada0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0012-FROMGIT-ASoC-core-allow-a-dt-node-to-provide-several.patch +++ /dev/null @@ -1,42 +0,0 @@ -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-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 deleted file mode 100644 index 7520bab0f7..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0013-FROMGIT-ASoC-core-ensure-component-names-are-unique.patch +++ /dev/null @@ -1,73 +0,0 @@ -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-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 deleted file mode 100644 index 96244ded28..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0014-FROMGIT-ASoC-meson-g12a-extract-codec-to-codec-utils.patch +++ /dev/null @@ -1,567 +0,0 @@ -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-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 deleted file mode 100644 index 2a82e48ac3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0015-FROMGIT-ASoC-meson-aiu-add-audio-output-dt-bindings.patch +++ /dev/null @@ -1,163 +0,0 @@ -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-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 deleted file mode 100644 index 76171246b7..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0016-FROMGIT-ASoC-meson-aiu-add-i2s-and-spdif-support.patch +++ /dev/null @@ -1,1699 +0,0 @@ -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-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 deleted file mode 100644 index e3f79a62d5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0017-FROMGIT-ASoC-meson-aiu-add-hdmi-codec-control-suppor.patch +++ /dev/null @@ -1,281 +0,0 @@ -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-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 deleted file mode 100644 index c2bea63833..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0018-FROMGIT-ASoC-meson-aiu-add-internal-dac-codec-contro.patch +++ /dev/null @@ -1,279 +0,0 @@ -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-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 deleted file mode 100644 index 4211635323..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0019-FROMGIT-ASoC-meson-axg-extract-sound-card-utils.patch +++ /dev/null @@ -1,1041 +0,0 @@ -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-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 deleted file mode 100644 index 373bdeacd5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0020-FROMGIT-ASoC-meson-gx-add-sound-card-dt-binding-docu.patch +++ /dev/null @@ -1,138 +0,0 @@ -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-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 deleted file mode 100644 index 8954e028f2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0021-FROMGIT-ASoC-meson-gx-add-sound-card-support.patch +++ /dev/null @@ -1,202 +0,0 @@ -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-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 deleted file mode 100644 index 8b8b2f496f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0022-FROMGIT-ASoC-meson-aiu-remove-unused-encoder-structu.patch +++ /dev/null @@ -1,36 +0,0 @@ -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-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 deleted file mode 100644 index 814aa320ff..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0023-FROMGIT-ASoC-meson-aiu-fix-clk-bulk-size-allocation.patch +++ /dev/null @@ -1,31 +0,0 @@ -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-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch b/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch deleted file mode 100644 index 2bc7f3a1e3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0024-FROMGIT-ASoC-meson-aiu-fix-irq-registration.patch +++ /dev/null @@ -1,59 +0,0 @@ -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-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 deleted file mode 100644 index 1b1e0e9714..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0025-FROMGIT-ASoC-meson-aiu-fix-acodec-dai-input-name-ini.patch +++ /dev/null @@ -1,30 +0,0 @@ -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-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 deleted file mode 100644 index f294b71837..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0026-FROMGIT-ASoC-meson-codec-glue-fix-pcm-format-cast-wa.patch +++ /dev/null @@ -1,32 +0,0 @@ -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-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch b/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch deleted file mode 100644 index 9cd72bff5b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0027-FROMGIT-ASoC-meson-aiu-simplify-component-addition.patch +++ /dev/null @@ -1,113 +0,0 @@ -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-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 deleted file mode 100644 index 4e0f1c60ad..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0028-FROMGIT-arm64-dts-meson-sm1-sei610-add-missing-inter.patch +++ /dev/null @@ -1,33 +0,0 @@ -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-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 deleted file mode 100644 index df8effd161..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0029-FROMGIT-firmware-meson_sm-Add-secure-power-domain-su.patch +++ /dev/null @@ -1,46 +0,0 @@ -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-power-add-Amlogic-secure-power-d.patch b/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-power-add-Amlogic-secure-power-d.patch deleted file mode 100644 index 4d4b08939d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0030-FROMGIT-dt-bindings-power-add-Amlogic-secure-power-d.patch +++ /dev/null @@ -1,110 +0,0 @@ -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-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 deleted file mode 100644 index cfe6111199..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0031-FROMGIT-soc-amlogic-Add-support-for-Secure-power-dom.patch +++ /dev/null @@ -1,265 +0,0 @@ -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 deleted file mode 100644 index e9c5bf3144..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0032-FROMGIT-arm64-dts-meson-a1-add-secure-power-domain-c.patch +++ /dev/null @@ -1,35 +0,0 @@ -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-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 deleted file mode 100644 index 70e17e1a0d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0034-FROMLIST-ASoC-meson-add-t9015-internal-codec-binding.patch +++ /dev/null @@ -1,79 +0,0 @@ -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-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 deleted file mode 100644 index 980beeed20..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0035-FROMLIST-ASoC-meson-add-t9015-internal-DAC-driver.patch +++ /dev/null @@ -1,392 +0,0 @@ -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-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch b/packages/linux/patches/amlogic/amlogic-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch deleted file mode 100644 index 72ed3626fa..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0044-FROMLIST-ASoC-meson-g12a-add-tohdmitx-reset.patch +++ /dev/null @@ -1,37 +0,0 @@ -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-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 deleted file mode 100644 index a24427ee5b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0045-FROMLIST-ASoC-meson-add-g12a-toacodec-dt-binding-doc.patch +++ /dev/null @@ -1,92 +0,0 @@ -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-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 deleted file mode 100644 index 26788d6c2c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0046-FROMLIST-ASoC-meson-add-g12-internal-DAC-glue.patch +++ /dev/null @@ -1,301 +0,0 @@ -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-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 deleted file mode 100644 index 8c3d8c611b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0047-FROMLIST-ASoC-meson-axg-card-add-toacodec-support.patch +++ /dev/null @@ -1,27 +0,0 @@ -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-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 deleted file mode 100644 index 8862636bfb..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0048-FROMLIST-arm64-dts-meson-add-pdm-reset-line.patch +++ /dev/null @@ -1,40 +0,0 @@ -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-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 deleted file mode 100644 index 39dbfed359..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0049-FROMLIST-arm64-dts-meson-s400-fix-sound-card-codec-n.patch +++ /dev/null @@ -1,45 +0,0 @@ -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-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 deleted file mode 100644 index 19bed54bd5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0050-FROMLIST-arm64-dts-meson-sei510-fix-sound-card-codec.patch +++ /dev/null @@ -1,35 +0,0 @@ -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-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 deleted file mode 100644 index 82651c9a8d..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0051-WIP-arm64-defconfig-enable-meson-gx-audio-as-module.patch +++ /dev/null @@ -1,26 +0,0 @@ -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-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 deleted file mode 100644 index eb7bbf54a8..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0053-WIP-arm64-dts-meson-g12a-add-internal-DAC-glue.patch +++ /dev/null @@ -1,110 +0,0 @@ -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-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 deleted file mode 100644 index 663afc9e78..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0054-WIP-arm64-dts-meson-u200-add-audio-support.patch +++ /dev/null @@ -1,351 +0,0 @@ -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-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 deleted file mode 100644 index 4410640308..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0055-WIP-arm64-dts-meson-gx-add-playback-audio-devices.patch +++ /dev/null @@ -1,99 +0,0 @@ -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-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 deleted file mode 100644 index 18e322971c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0059-WIP-arm64-dts-meson-add-sound-support-to-the-librete.patch +++ /dev/null @@ -1,127 +0,0 @@ -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-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 deleted file mode 100644 index 3ab47d8c12..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0061-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch +++ /dev/null @@ -1,109 +0,0 @@ -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-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 deleted file mode 100644 index 91e96b916b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0062-WIP-arm64-dts-meson-gxbb-add-playback-audio-devices.patch +++ /dev/null @@ -1,48 +0,0 @@ -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-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 deleted file mode 100644 index e4da8f802a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0065-WIP-arm64-dts-meson-add-audio-playback-to-p20x-dtsi.patch +++ /dev/null @@ -1,90 +0,0 @@ -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-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 deleted file mode 100644 index b3c05e7f30..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0071-HACK-mmc-meson-gx-force-max_segs-max_blk_count-value.patch +++ /dev/null @@ -1,37 +0,0 @@ -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-0075-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 deleted file mode 100644 index 4e5719adb3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0075-FROMLIST-pinctrl-meson-add-missing-tsin-pinctrl-for-.patch +++ /dev/null @@ -1,164 +0,0 @@ -From e78d4dc4e45bbc6cb77c9c16ffb06c25a7bbbe17 Mon Sep 17 00:00:00 2001 -From: Igor Vavro -Date: Sat, 10 Aug 2019 13:55:34 +0000 -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 | 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 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 }; - static const unsigned int hdmi_sda_pins[] = { GPIOH_1 }; - static const unsigned int hdmi_scl_pins[] = { GPIOH_2 }; - -+static const unsigned int tsin_a_d_valid_pins[] = { GPIOY_0 }; -+static const unsigned int tsin_a_sop_pins[] = { GPIOY_1 }; -+static const unsigned int tsin_a_clk_pins[] = { GPIOY_2 }; -+static const unsigned int tsin_a_d0_pins[] = { GPIOY_3 }; -+static const unsigned int tsin_a_dp_pins[] = { -+ GPIOY_4, GPIOY_5, GPIOY_6, GPIOY_7, GPIOY_8, GPIOY_9, GPIOY_10 -+}; -+ -+static const unsigned int tsin_a_fail_pins[] = { GPIOY_11 }; - static const unsigned int i2s_out_ch23_y_pins[] = { GPIOY_8 }; - static const unsigned int i2s_out_ch45_y_pins[] = { GPIOY_9 }; - static const unsigned int i2s_out_ch67_y_pins[] = { GPIOY_10 }; - -+static const unsigned int tsin_b_d_valid_pins[] = { GPIOX_6 }; -+static const unsigned int tsin_b_sop_pins[] = { GPIOX_7 }; -+static const unsigned int tsin_b_clk_pins[] = { GPIOX_8 }; -+static const unsigned int tsin_b_d0_pins[] = { GPIOX_9 }; -+ - static const unsigned int spdif_out_y_pins[] = { GPIOY_12 }; - - static const unsigned int gen_clk_out_pins[] = { GPIOY_15 }; -@@ -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), -+ GROUP(tsin_b_d_valid, 3, 9), -+ GROUP(tsin_b_sop, 3, 8), -+ GROUP(tsin_b_clk, 3, 10), -+ 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_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", - }; - -+static const char * const tsin_a_groups[] = { -+ "tsin_a_clk", "tsin_a_sop", "tsin_a_d_valid", "tsin_a_d0", -+ "tsin_a_dp", "tsin_a_fail", -+}; -+ -+static const char * const tsin_b_groups[] = { -+ "tsin_b_clk", "tsin_b_sop", "tsin_b_d_valid", "tsin_b_d0", -+}; -+ - static const char * const emmc_groups[] = { - "emmc_nand_d07", "emmc_clk", "emmc_cmd", "emmc_ds", - }; -@@ -792,6 +825,8 @@ static struct meson_pmx_func meson_gxbb_periphs_functions[] = { - FUNCTION(i2s_out), - FUNCTION(spdif_out), - FUNCTION(gen_clk_out), -+ FUNCTION(tsin_a), -+ FUNCTION(tsin_b), - }; - - 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 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[] = { - GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7, - }; - -+static const unsigned int tsin_b_clk_pins[] = { GPIOH_6 }; -+static const unsigned int tsin_b_d0_pins[] = { GPIOH_7 }; -+static const unsigned int tsin_b_sop_pins[] = { GPIOH_8 }; -+static const unsigned int tsin_b_d_valid_pins[] = { GPIOH_9 }; -+ -+static const unsigned int tsin_b_fail_z4_pins[] = { GPIOZ_4 }; -+static const unsigned int tsin_b_clk_z3_pins[] = { GPIOZ_3 }; -+static const unsigned int tsin_b_d0_z2_pins[] = { GPIOZ_2 }; -+static const unsigned int tsin_b_sop_z1_pins[] = { GPIOZ_1 }; -+static const unsigned int tsin_b_d_valid_z0_pins[] = { GPIOZ_0 }; -+ - static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = { - MESON_PIN(GPIOAO_0), - MESON_PIN(GPIOAO_1), -@@ -438,6 +449,11 @@ static struct meson_pmx_group meson_gxl_periphs_groups[] = { - GROUP(eth_txd1, 4, 12), - GROUP(eth_txd2, 4, 11), - GROUP(eth_txd3, 4, 10), -+ GROUP(tsin_b_fail_z4, 3, 15), -+ GROUP(tsin_b_clk_z3, 3, 16), -+ GROUP(tsin_b_d0_z2, 3, 17), -+ GROUP(tsin_b_sop_z1, 3, 18), -+ GROUP(tsin_b_d_valid_z0, 3, 19), - GROUP(pwm_c, 3, 20), - GROUP(i2s_out_ch23_z, 3, 26), - GROUP(i2s_out_ch45_z, 3, 25), -@@ -454,6 +470,10 @@ static struct meson_pmx_group meson_gxl_periphs_groups[] = { - GROUP(i2s_out_lr_clk, 6, 24), - GROUP(i2s_out_ch01, 6, 23), - GROUP(spdif_out_h, 6, 28), -+ GROUP(tsin_b_d0, 6, 17), -+ GROUP(tsin_b_sop, 6, 18), -+ GROUP(tsin_b_d_valid, 6, 19), -+ GROUP(tsin_b_clk, 6, 20), - - /* Bank DV */ - GROUP(uart_tx_b, 2, 16), -@@ -689,6 +709,12 @@ static const char * const tsin_a_groups[] = { - "tsin_a_dp", "tsin_a_fail", - }; - -+static const char * const tsin_b_groups[] = { -+ "tsin_b_clk", "tsin_b_sop", "tsin_b_d_valid", "tsin_b_d0", -+ "tsin_b_clk_z3", "tsin_b_sop_z1", "tsin_b_d_valid_z0", "tsin_b_d0_z2", -+ "tsin_b_fail_z4", -+}; -+ - static const char * const gpio_aobus_groups[] = { - "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4", - "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9", -@@ -764,6 +790,7 @@ static struct meson_pmx_func meson_gxl_periphs_functions[] = { - FUNCTION(spdif_out), - FUNCTION(eth_led), - FUNCTION(tsin_a), -+ FUNCTION(tsin_b), - }; - - static struct meson_pmx_func meson_gxl_aobus_functions[] = { --- -2.17.1 - 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 deleted file mode 100644 index 3e0cd713b9..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0076-FROMLIST-doc-dt-bindings-usb-dwc3-Update-entries-for.patch +++ /dev/null @@ -1,34 +0,0 @@ -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-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 deleted file mode 100644 index 29f8e95ebf..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0077-FROMLIST-usb-dwc3-gadget-Add-support-for-disabling-S.patch +++ /dev/null @@ -1,85 +0,0 @@ -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 deleted file mode 100644 index c5e587c1dc..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0078-FROMLIST-arm64-dts-g12-common-add-parkmode_disable_s.patch +++ /dev/null @@ -1,40 +0,0 @@ -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-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 deleted file mode 100644 index 67b9903a7f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0079-FROMLIST-drm-bridge-Add-a-drm_bridge_state-object.patch +++ /dev/null @@ -1,622 +0,0 @@ -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-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 deleted file mode 100644 index ba50973052..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0080-FROMLIST-drm-rcar-du-Plug-atomic-state-hooks-to-the-.patch +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index b4c4ce964a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0081-FROMLIST-drm-bridge-analogix-Plug-atomic-state-hooks.patch +++ /dev/null @@ -1,45 +0,0 @@ -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-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 deleted file mode 100644 index 531f757e33..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0082-FROMLIST-drm-bridge-Patch-atomic-hooks-to-take-a-drm.patch +++ /dev/null @@ -1,333 +0,0 @@ -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-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 deleted file mode 100644 index 5146ec5709..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0083-FROMLIST-drm-bridge-Add-an-atomic_check-hook.patch +++ /dev/null @@ -1,202 +0,0 @@ -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-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 deleted file mode 100644 index 6a20c95bf5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0084-FROMLIST-drm-bridge-Add-the-necessary-bits-to-suppor.patch +++ /dev/null @@ -1,614 +0,0 @@ -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-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 deleted file mode 100644 index fbaa577586..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0085-FROMLIST-drm-imx-pd-Use-bus-format-flags-provided-by.patch +++ /dev/null @@ -1,304 +0,0 @@ -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 deleted file mode 100644 index 7b0ead35e0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0086-FROMLIST-drm-bridge-lvds-codec-Implement-basic-bus-f.patch +++ /dev/null @@ -1,159 +0,0 @@ -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 deleted file mode 100644 index 8ddc4a6239..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0087-FROMLIST-dt-bindings-display-bridge-lvds-codec-Add-n.patch +++ /dev/null @@ -1,53 +0,0 @@ -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 deleted file mode 100644 index 73abaecd32..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0088-FROMLIST-drm-bridge-panel-Propage-bus-format-flags.patch +++ /dev/null @@ -1,52 +0,0 @@ -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-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 deleted file mode 100644 index 599f658537..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0089-FROMLIST-drm-panel-simple-Fix-the-lt089ac29000-bus_f.patch +++ /dev/null @@ -1,40 +0,0 @@ -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-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 deleted file mode 100644 index b511e5a1b0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0090-FROMLIST-ARM-dts-imx-imx51-zii-rdu1-Fix-the-display-.patch +++ /dev/null @@ -1,64 +0,0 @@ -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-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 deleted file mode 100644 index 85f8140acf..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0091-FROMLIST-drm-bridge-dw-hdmi-set-mtmdsclock-for-deep-.patch +++ /dev/null @@ -1,48 +0,0 @@ -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-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 deleted file mode 100644 index 25b5404e77..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0092-FROMLIST-drm-bridge-dw-hdmi-add-max-bpc-connector-pr.patch +++ /dev/null @@ -1,32 +0,0 @@ -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-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 deleted file mode 100644 index 473b29e0ef..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0093-FROMLIST-drm-bridge-dw-hdmi-Plug-atomic-state-hooks-.patch +++ /dev/null @@ -1,28 +0,0 @@ -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-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 deleted file mode 100644 index c957d82855..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0094-FROMLIST-drm-bridge-synopsys-dw-hdmi-add-bus-format-.patch +++ /dev/null @@ -1,332 +0,0 @@ -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-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch b/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch deleted file mode 100644 index c732bfc7b7..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0095-FROMLIST-drm-bridge-synopsys-dw-hdmi-allow-ycbcr420-.patch +++ /dev/null @@ -1,49 +0,0 @@ -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-venc-make-drm_display_mode-const.patch b/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-venc-make-drm_display_mode-const.patch deleted file mode 100644 index 7c24e381b7..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0096-FROMLIST-drm-meson-venc-make-drm_display_mode-const.patch +++ /dev/null @@ -1,44 +0,0 @@ -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 deleted file mode 100644 index cbb2de1bf5..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0097-FROMLIST-drm-meson-meson_dw_hdmi-add-bridge-and-swit.patch +++ /dev/null @@ -1,230 +0,0 @@ -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-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 deleted file mode 100644 index 78569acf07..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0098-FROMLIST-drm-meson-dw-hdmi-stop-enforcing-input_bus_.patch +++ /dev/null @@ -1,30 +0,0 @@ -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-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 deleted file mode 100644 index 4cf0797ed0..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0099-FROMLIST-drm-meson-venc-add-support-for-YUV420-setup.patch +++ /dev/null @@ -1,85 +0,0 @@ -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-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 deleted file mode 100644 index a4f54bdcbf..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0100-FROMLIST-drm-meson-vclk-add-support-for-YUV420-setup.patch +++ /dev/null @@ -1,363 +0,0 @@ -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-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch b/packages/linux/patches/amlogic/amlogic-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch deleted file mode 100644 index ff82e15d0a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0101-FROMLIST-drm-meson-Add-YUV420-output-support.patch +++ /dev/null @@ -1,240 +0,0 @@ -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-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 deleted file mode 100644 index 5083ab3bc2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0102-FROMLIST-drm-bridge-dw-hdmi-fix-AVI-frame-colorimetr.patch +++ /dev/null @@ -1,77 +0,0 @@ -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-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 deleted file mode 100644 index 61538daedc..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0103-FROMLIST-drm-bridge-dw-hdmi-Fix-color-space-conversi.patch +++ /dev/null @@ -1,36 +0,0 @@ -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-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 deleted file mode 100644 index 19089b2a50..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0105-FROMLIST-drm-bridge-dw-hdmi-Add-support-for-RGB-limi.patch +++ /dev/null @@ -1,115 +0,0 @@ -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-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch b/packages/linux/patches/amlogic/amlogic-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch deleted file mode 100644 index c2ca401861..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0106-FROMLIST-media-v4l2-mem2mem-handle-draining-stopped-.patch +++ /dev/null @@ -1,387 +0,0 @@ -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-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 deleted file mode 100644 index 8ef823fcfa..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0107-FROMLIST-media-vicodec-use-v4l2-mem2mem-draining-sto.patch +++ /dev/null @@ -1,304 +0,0 @@ -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-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 deleted file mode 100644 index 7d8c950bfa..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0108-FROMLIST-media-meson-vdec-bring-up-to-compliance.patch +++ /dev/null @@ -1,742 +0,0 @@ -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-0109-FROMLIST-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 deleted file mode 100644 index f645ea078b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0109-FROMLIST-media-meson-vdec-add-H.264-decoding-support.patch +++ /dev/null @@ -1,645 +0,0 @@ -From 7a3c513748adda914edc321d0f5d2b0d54d0aa04 Mon Sep 17 00:00:00 2001 -From: Maxime Jourdan -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 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 | 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 - -diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile -index 6bea129084b7..711d990c760e 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 -+meson-vdec-objs += codec_mpeg12.o codec_h264.o - - 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..4528a6a01c3d ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_h264.c -@@ -0,0 +1,482 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (C) 2019 BayLibre, SAS -+ * Author: Maxime Jourdan -+ */ -+ -+#include -+#include -+ -+#include "vdec_helpers.h" -+#include "dos_regs.h" -+ -+#define SIZE_EXT_FW (20 * SZ_1K) -+#define SIZE_WORKSPACE 0x1ee000 -+#define SIZE_SEI (8 * SZ_1K) -+ -+/* -+ * Offset added by the firmware which must be substracted -+ * from the workspace phyaddr -+ */ -+#define WORKSPACE_BUF_OFFSET 0x1000000 -+ -+/* ISR status */ -+#define CMD_MASK GENMASK(7, 0) -+#define CMD_SRC_CHANGE 1 -+#define CMD_FRAMES_READY 2 -+#define CMD_FATAL_ERROR 6 -+#define CMD_BAD_WIDTH 7 -+#define CMD_BAD_HEIGHT 8 -+ -+#define SEI_DATA_READY BIT(15) -+ -+/* Picture type */ -+#define PIC_TOP_BOT 5 -+#define PIC_BOT_TOP 6 -+ -+/* Size of Motion Vector per macroblock */ -+#define MB_MV_SIZE 96 -+ -+/* Frame status data */ -+#define PIC_STRUCT_BIT 5 -+#define PIC_STRUCT_MASK GENMASK(2, 0) -+#define BUF_IDX_MASK GENMASK(4, 0) -+#define ERROR_FLAG BIT(9) -+#define OFFSET_BIT 16 -+#define OFFSET_MASK GENMASK(15, 0) -+ -+/* Bitstream parsed data */ -+#define MB_TOTAL_BIT 8 -+#define MB_TOTAL_MASK GENMASK(15, 0) -+#define MB_WIDTH_MASK GENMASK(7, 0) -+#define MAX_REF_BIT 24 -+#define MAX_REF_MASK GENMASK(6, 0) -+#define AR_IDC_BIT 16 -+#define AR_IDC_MASK GENMASK(7, 0) -+#define AR_PRESENT_FLAG BIT(0) -+#define AR_EXTEND 0xff -+ -+/* -+ * 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_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, -+ 0x36, 0x37, 0x20, 0x72, 0x31, 0x31, 0x33, 0x30, 0x20, 0x38, 0x34, 0x37, -+ 0x35, 0x39, 0x37, 0x37, 0x20, 0x2d, 0x20, 0x48, 0x2e, 0x32, 0x36, 0x34, -+ 0x2f, 0x4d, 0x50, 0x45, 0x47, 0x2d, 0x34, 0x20, 0x41, 0x56, 0x43, 0x20, -+ 0x63, 0x6f, 0x64, 0x65, 0x63, 0x20, 0x2d, 0x20, 0x43, 0x6f, 0x70, 0x79, -+ 0x6c, 0x65, 0x66, 0x74, 0x20, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x30, -+ 0x30, 0x39, 0x20, 0x2d, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, -+ 0x77, 0x77, 0x77, 0x2e, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6c, 0x61, 0x6e, -+ 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x78, 0x32, 0x36, 0x34, 0x2e, 0x68, 0x74, -+ 0x6d, 0x6c, 0x20, 0x2d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, -+ 0x3a, 0x20, 0x63, 0x61, 0x62, 0x61, 0x63, 0x3d, 0x31, 0x20, 0x72, 0x65, -+ 0x66, 0x3d, 0x31, 0x20, 0x64, 0x65, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x3d, -+ 0x31, 0x3a, 0x30, 0x3a, 0x30, 0x20, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, -+ 0x65, 0x3d, 0x30, 0x78, 0x31, 0x3a, 0x30, 0x78, 0x31, 0x31, 0x31, 0x20, -+ 0x6d, 0x65, 0x3d, 0x68, 0x65, 0x78, 0x20, 0x73, 0x75, 0x62, 0x6d, 0x65, -+ 0x3d, 0x36, 0x20, 0x70, 0x73, 0x79, 0x5f, 0x72, 0x64, 0x3d, 0x31, 0x2e, -+ 0x30, 0x3a, 0x30, 0x2e, 0x30, 0x20, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, -+ 0x72, 0x65, 0x66, 0x3d, 0x30, 0x20, 0x6d, 0x65, 0x5f, 0x72, 0x61, 0x6e, -+ 0x67, 0x65, 0x3d, 0x31, 0x36, 0x20, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x61, -+ 0x5f, 0x6d, 0x65, 0x3d, 0x31, 0x20, 0x74, 0x72, 0x65, 0x6c, 0x6c, 0x69, -+ 0x73, 0x3d, 0x30, 0x20, 0x38, 0x78, 0x38, 0x64, 0x63, 0x74, 0x3d, 0x30, -+ 0x20, 0x63, 0x71, 0x6d, 0x3d, 0x30, 0x20, 0x64, 0x65, 0x61, 0x64, 0x7a, -+ 0x6f, 0x6e, 0x65, 0x3d, 0x32, 0x31, 0x2c, 0x31, 0x31, 0x20, 0x63, 0x68, -+ 0x72, 0x6f, 0x6d, 0x61, 0x5f, 0x71, 0x70, 0x5f, 0x6f, 0x66, 0x66, 0x73, -+ 0x65, 0x74, 0x3d, 0x2d, 0x32, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, -+ 0x73, 0x3d, 0x31, 0x20, 0x6e, 0x72, 0x3d, 0x30, 0x20, 0x64, 0x65, 0x63, -+ 0x69, 0x6d, 0x61, 0x74, 0x65, 0x3d, 0x31, 0x20, 0x6d, 0x62, 0x61, 0x66, -+ 0x66, 0x3d, 0x30, 0x20, 0x62, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x3d, -+ 0x30, 0x20, 0x6b, 0x65, 0x79, 0x69, 0x6e, 0x74, 0x3d, 0x32, 0x35, 0x30, -+ 0x20, 0x6b, 0x65, 0x79, 0x69, 0x6e, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x3d, -+ 0x32, 0x35, 0x20, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x63, 0x75, 0x74, 0x3d, -+ 0x34, 0x30, 0x20, 0x72, 0x63, 0x3d, 0x61, 0x62, 0x72, 0x20, 0x62, 0x69, -+ 0x74, 0x72, 0x61, 0x74, 0x65, 0x3d, 0x31, 0x30, 0x20, 0x72, 0x61, 0x74, -+ 0x65, 0x74, 0x6f, 0x6c, 0x3d, 0x31, 0x2e, 0x30, 0x20, 0x71, 0x63, 0x6f, -+ 0x6d, 0x70, 0x3d, 0x30, 0x2e, 0x36, 0x30, 0x20, 0x71, 0x70, 0x6d, 0x69, -+ 0x6e, 0x3d, 0x31, 0x30, 0x20, 0x71, 0x70, 0x6d, 0x61, 0x78, 0x3d, 0x35, -+ 0x31, 0x20, 0x71, 0x70, 0x73, 0x74, 0x65, 0x70, 0x3d, 0x34, 0x20, 0x69, -+ 0x70, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x3d, 0x31, 0x2e, 0x34, 0x30, -+ 0x20, 0x61, 0x71, 0x3d, 0x31, 0x3a, 0x31, 0x2e, 0x30, 0x30, 0x00, 0x80, -+ 0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x40, 0x0a, 0x9a, 0x74, 0xf4, 0x20, -+ 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x06, 0x51, 0xe2, 0x44, 0xd4, -+ 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x32, 0xc8, 0x00, 0x00, 0x00, 0x01, -+ 0x65, 0x88, 0x80, 0x20, 0x00, 0x08, 0x7f, 0xea, 0x6a, 0xe2, 0x99, 0xb6, -+ 0x57, 0xae, 0x49, 0x30, 0xf5, 0xfe, 0x5e, 0x46, 0x0b, 0x72, 0x44, 0xc4, -+ 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, -+ 0x00, 0x00, 0x01, 0x0ff, -+}; -+ -+static const u8 *codec_h264_eos_sequence(u32 *len) -+{ -+ *len = ARRAY_SIZE(eos_sequence); -+ return eos_sequence; -+} -+ -+struct codec_h264 { -+ /* H.264 decoder requires an extended firmware */ -+ void *ext_fw_vaddr; -+ dma_addr_t ext_fw_paddr; -+ -+ /* Buffer for the H.264 Workspace */ -+ void *workspace_vaddr; -+ dma_addr_t workspace_paddr; -+ -+ /* Buffer for the H.264 references MV */ -+ void *ref_vaddr; -+ dma_addr_t ref_paddr; -+ u32 ref_size; -+ -+ /* Buffer for parsed SEI data */ -+ void *sei_vaddr; -+ dma_addr_t sei_paddr; -+ -+ u32 mb_width; -+ u32 mb_height; -+ u32 max_refs; -+}; -+ -+static int codec_h264_can_recycle(struct amvdec_core *core) -+{ -+ return !amvdec_read_dos(core, AV_SCRATCH_7) || -+ !amvdec_read_dos(core, AV_SCRATCH_8); -+} -+ -+static void codec_h264_recycle(struct amvdec_core *core, u32 buf_idx) -+{ -+ /* -+ * Tell the firmware it can recycle this buffer. -+ * AV_SCRATCH_8 serves the same purpose. -+ */ -+ if (!amvdec_read_dos(core, AV_SCRATCH_7)) -+ amvdec_write_dos(core, AV_SCRATCH_7, buf_idx + 1); -+ else -+ amvdec_write_dos(core, AV_SCRATCH_8, buf_idx + 1); -+} -+ -+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) -+ 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) -+ 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); -+ -+ /* Enable "error correction" */ -+ amvdec_write_dos(core, AV_SCRATCH_F, -+ (amvdec_read_dos(core, AV_SCRATCH_F) & 0xffffffc3) | -+ BIT(4) | BIT(7)); -+ -+ amvdec_write_dos(core, MDEC_PIC_DC_THRESH, 0x404038aa); -+ -+ return 0; -+} -+ -+static int codec_h264_stop(struct amvdec_session *sess) -+{ -+ struct codec_h264 *h264 = sess->priv; -+ struct amvdec_core *core = sess->core; -+ -+ if (h264->ext_fw_vaddr) -+ dma_free_coherent(core->dev, SIZE_EXT_FW, -+ h264->ext_fw_vaddr, h264->ext_fw_paddr); -+ -+ if (h264->workspace_vaddr) -+ dma_free_coherent(core->dev, SIZE_WORKSPACE, -+ h264->workspace_vaddr, h264->workspace_paddr); -+ -+ if (h264->ref_vaddr) -+ dma_free_coherent(core->dev, h264->ref_size, -+ h264->ref_vaddr, h264->ref_paddr); -+ -+ if (h264->sei_vaddr) -+ dma_free_coherent(core->dev, SIZE_SEI, -+ h264->sei_vaddr, h264->sei_paddr); -+ -+ return 0; -+} -+ -+static int codec_h264_load_extended_firmware(struct amvdec_session *sess, -+ const u8 *data, u32 len) -+{ -+ struct codec_h264 *h264; -+ struct amvdec_core *core = sess->core; -+ -+ if (len < SIZE_EXT_FW) -+ return -EINVAL; -+ -+ h264 = kzalloc(sizeof(*h264), GFP_KERNEL); -+ if (!h264) -+ return -ENOMEM; -+ -+ h264->ext_fw_vaddr = dma_alloc_coherent(core->dev, SIZE_EXT_FW, -+ &h264->ext_fw_paddr, GFP_KERNEL); -+ if (!h264->ext_fw_vaddr) { -+ kfree(h264); -+ return -ENOMEM; -+ } -+ -+ memcpy(h264->ext_fw_vaddr, data, SIZE_EXT_FW); -+ sess->priv = h264; -+ -+ return 0; -+} -+ -+static const struct v4l2_fract par_table[] = { -+ { 1, 1 }, { 1, 1 }, { 12, 11 }, { 10, 11 }, -+ { 16, 11 }, { 40, 33 }, { 24, 11 }, { 20, 11 }, -+ { 32, 11 }, { 80, 33 }, { 18, 11 }, { 15, 11 }, -+ { 64, 33 }, { 160, 99 }, { 4, 3 }, { 3, 2 }, -+ { 2, 1 } -+}; -+ -+static void codec_h264_set_par(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ u32 seq_info = amvdec_read_dos(core, AV_SCRATCH_2); -+ u32 ar_idc = (seq_info >> AR_IDC_BIT) & AR_IDC_MASK; -+ -+ if (!(seq_info & AR_PRESENT_FLAG)) -+ return; -+ -+ 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; -+ } -+ -+ if (ar_idc >= ARRAY_SIZE(par_table)) -+ return; -+ -+ sess->pixelaspect = par_table[ar_idc]; -+} -+ -+static void codec_h264_resume(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_h264 *h264 = sess->priv; -+ u32 mb_width, mb_height, mb_total; -+ -+ amvdec_set_canvases(sess, (u32[]){ ANC0_CANVAS_ADDR, 0 }, -+ (u32[]){ 24, 0 }); -+ -+ 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 */ -+ mb_width = ALIGN(h264->mb_width, 4); -+ mb_height = ALIGN(h264->mb_height, 4); -+ mb_total = mb_width * mb_height; -+ -+ h264->ref_size = mb_total * MB_MV_SIZE * h264->max_refs; -+ h264->ref_vaddr = dma_alloc_coherent(core->dev, h264->ref_size, -+ &h264->ref_paddr, GFP_KERNEL); -+ if (!h264->ref_vaddr) { -+ amvdec_abort(sess); -+ return; -+ } -+ -+ /* Address to store the references' MVs */ -+ amvdec_write_dos(core, AV_SCRATCH_1, h264->ref_paddr); -+ /* End of ref MV */ -+ amvdec_write_dos(core, AV_SCRATCH_4, h264->ref_paddr + h264->ref_size); -+ -+ amvdec_write_dos(core, AV_SCRATCH_0, (h264->max_refs << 24) | -+ (sess->num_dst_bufs << 16) | -+ ((h264->max_refs - 1) << 8)); -+} -+ -+/** -+ * Configure the H.264 decoder when the parser detected a parameter set change -+ */ -+static void codec_h264_src_change(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ struct codec_h264 *h264 = sess->priv; -+ u32 parsed_info, mb_total; -+ u32 crop_infor, crop_bottom, crop_right; -+ u32 frame_width, frame_height; -+ -+ sess->keyframe_found = 1; -+ -+ parsed_info = amvdec_read_dos(core, AV_SCRATCH_1); -+ -+ /* Total number of 16x16 macroblocks */ -+ mb_total = (parsed_info >> MB_TOTAL_BIT) & MB_TOTAL_MASK; -+ /* Number of macroblocks per line */ -+ h264->mb_width = parsed_info & MB_WIDTH_MASK; -+ /* Number of macroblock lines */ -+ h264->mb_height = mb_total / h264->mb_width; -+ -+ h264->max_refs = ((parsed_info >> MAX_REF_BIT) & MAX_REF_MASK) + 1; -+ -+ crop_infor = amvdec_read_dos(core, AV_SCRATCH_6); -+ crop_bottom = (crop_infor & 0xff); -+ crop_right = (crop_infor >> 16) & 0xff; -+ -+ frame_width = h264->mb_width * 16 - crop_right; -+ frame_height = h264->mb_height * 16 - 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 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) -+{ -+ int take_msb = frame_num % 2; -+ int reg_offset = (frame_num / 2) * 4; -+ u32 offset_msb = amvdec_read_dos(core, AV_SCRATCH_A + reg_offset); -+ -+ if (take_msb) -+ return offset_msb & 0xffff0000; -+ -+ return (offset_msb & 0x0000ffff) << 16; -+} -+ -+static void codec_h264_frames_ready(struct amvdec_session *sess, u32 status) -+{ -+ struct amvdec_core *core = sess->core; -+ int error_count; -+ int num_frames; -+ int i; -+ -+ error_count = amvdec_read_dos(core, AV_SCRATCH_D); -+ num_frames = (status >> 8) & 0xff; -+ if (error_count) { -+ dev_warn(core->dev, -+ "decoder error(s) happened, count %d\n", error_count); -+ amvdec_write_dos(core, AV_SCRATCH_D, 0); -+ } -+ -+ for (i = 0; i < num_frames; i++) { -+ u32 frame_status = amvdec_read_dos(core, AV_SCRATCH_1 + i * 4); -+ u32 buffer_index = frame_status & BUF_IDX_MASK; -+ u32 pic_struct = (frame_status >> PIC_STRUCT_BIT) & -+ PIC_STRUCT_MASK; -+ u32 offset = (frame_status >> OFFSET_BIT) & OFFSET_MASK; -+ u32 field = V4L2_FIELD_NONE; -+ -+ /* -+ * A buffer decode error means it was decoded, -+ * but part of the picture will have artifacts. -+ * Typical reason is a temporarily corrupted bitstream -+ */ -+ if (frame_status & ERROR_FLAG) -+ dev_dbg(core->dev, "Buffer %d decode error\n", -+ buffer_index); -+ -+ if (pic_struct == PIC_TOP_BOT) -+ field = V4L2_FIELD_INTERLACED_TB; -+ else if (pic_struct == PIC_BOT_TOP) -+ field = V4L2_FIELD_INTERLACED_BT; -+ -+ offset |= get_offset_msb(core, i); -+ amvdec_dst_buf_done_idx(sess, buffer_index, offset, field); -+ } -+} -+ -+static irqreturn_t codec_h264_threaded_isr(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ u32 status; -+ u32 size; -+ u8 cmd; -+ -+ status = amvdec_read_dos(core, AV_SCRATCH_0); -+ cmd = status & CMD_MASK; -+ -+ switch (cmd) { -+ case CMD_SRC_CHANGE: -+ codec_h264_src_change(sess); -+ break; -+ case CMD_FRAMES_READY: -+ codec_h264_frames_ready(sess, status); -+ break; -+ case CMD_FATAL_ERROR: -+ dev_err(core->dev, "H.264 decoder fatal error\n"); -+ goto abort; -+ case CMD_BAD_WIDTH: -+ size = (amvdec_read_dos(core, AV_SCRATCH_1) + 1) * 16; -+ dev_err(core->dev, "Unsupported video width: %u\n", size); -+ goto abort; -+ case CMD_BAD_HEIGHT: -+ size = (amvdec_read_dos(core, AV_SCRATCH_1) + 1) * 16; -+ dev_err(core->dev, "Unsupported video height: %u\n", size); -+ goto abort; -+ case 0: /* Unused but not worth printing for */ -+ case 9: -+ break; -+ default: -+ dev_info(core->dev, "Unexpected H264 ISR: %08X\n", cmd); -+ break; -+ } -+ -+ if (cmd && cmd != CMD_SRC_CHANGE) -+ amvdec_write_dos(core, AV_SCRATCH_0, 0); -+ -+ /* Decoder has some SEI data for us ; ignore */ -+ if (amvdec_read_dos(core, AV_SCRATCH_J) & SEI_DATA_READY) -+ amvdec_write_dos(core, AV_SCRATCH_J, 0); -+ -+ return IRQ_HANDLED; -+abort: -+ amvdec_abort(sess); -+ return IRQ_HANDLED; -+} -+ -+static irqreturn_t codec_h264_isr(struct amvdec_session *sess) -+{ -+ struct amvdec_core *core = sess->core; -+ -+ amvdec_write_dos(core, ASSIST_MBOX1_CLR_REG, 1); -+ -+ return IRQ_WAKE_THREAD; -+} -+ -+struct amvdec_codec_ops codec_h264_ops = { -+ .start = codec_h264_start, -+ .stop = codec_h264_stop, -+ .load_extended_firmware = codec_h264_load_extended_firmware, -+ .isr = codec_h264_isr, -+ .threaded_isr = codec_h264_threaded_isr, -+ .can_recycle = codec_h264_can_recycle, -+ .recycle = codec_h264_recycle, -+ .eos_sequence = codec_h264_eos_sequence, -+ .resume = codec_h264_resume, -+}; -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..7cb4fb86ff36 ---- /dev/null -+++ b/drivers/staging/media/meson/vdec/codec_h264.h -@@ -0,0 +1,14 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (C) 2019 BayLibre, SAS -+ * Author: Maxime Jourdan -+ */ -+ -+#ifndef __MESON_VDEC_CODEC_H264_H_ -+#define __MESON_VDEC_CODEC_H264_H_ -+ -+#include "vdec.h" -+ -+extern struct amvdec_codec_ops codec_h264_ops; -+ -+#endif -diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c -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,22 @@ - - #include "vdec_1.h" - #include "codec_mpeg12.h" -+#include "codec_h264.h" - - static const struct amvdec_format vdec_formats_gxbb[] = { - { -+ .pixfmt = V4L2_PIX_FMT_H264, -+ .min_buffers = 2, -+ .max_buffers = 24, -+ .max_width = 1920, -+ .max_height = 1080, -+ .vdec_ops = &vdec_1_ops, -+ .codec_ops = &codec_h264_ops, -+ .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, -@@ -38,6 +51,18 @@ static const struct amvdec_format vdec_formats_gxbb[] = { - - static const struct amvdec_format vdec_formats_gxl[] = { - { -+ .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/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, -@@ -64,6 +89,18 @@ static const struct amvdec_format vdec_formats_gxl[] = { - - static const struct amvdec_format vdec_formats_gxm[] = { - { -+ .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/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, - .max_buffers = 8, --- -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 deleted file mode 100644 index 93246482bd..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0110-FROMLIST-media-meson-vdec-align-stride-on-32-bytes.patch +++ /dev/null @@ -1,77 +0,0 @@ -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 deleted file mode 100644 index 21f431c470..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0111-FROMLIST-media-meson-vdec-add-helpers-for-lossless-f.patch +++ /dev/null @@ -1,73 +0,0 @@ -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-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 deleted file mode 100644 index c0a11880d3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0112-FROMLIST-media-meson-vdec-add-common-HEVC-decoder-su.patch +++ /dev/null @@ -1,893 +0,0 @@ -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 deleted file mode 100644 index 2c8e6d4c9b..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0113-FROMLIST-media-meson-vdec-add-VP9-input-support.patch +++ /dev/null @@ -1,216 +0,0 @@ -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-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 deleted file mode 100644 index 09291e06ef..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0114-FROMLIST-media-meson-vdec-add-VP9-decoder-support.patch +++ /dev/null @@ -1,2348 +0,0 @@ -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-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 deleted file mode 100644 index 0b2e47a15a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0119-FROMLIST-arm64-dts-meson-gxbb-odroid-c2-add-rc-odroi.patch +++ /dev/null @@ -1,26 +0,0 @@ -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-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 deleted file mode 100644 index aecf9fdf0f..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0120-FROMLIST-arm64-dts-meson-gxbb-vega-s95-fix-missing-b.patch +++ /dev/null @@ -1,45 +0,0 @@ -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-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch b/packages/linux/patches/amlogic/amlogic-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch deleted file mode 100644 index 6722df64ba..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0121-FROMLIST-arm64-dts-meson-gxl-s905x-p212-add-bluetoot.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 6eb6ec4e705628b332b27d20afdf103460e2776c Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Mon, 15 Jul 2019 09:45:17 +0000 -Subject: [PATCH 121/146] FROMLIST: arm64: dts: meson-gxl-s905x-p212: add - bluetooth nodes - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | 9 ++++++++- - 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 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 -@@ -16,7 +16,6 @@ - / { - aliases { - serial0 = &uart_AO; -- serial1 = &uart_A; - ethernet0 = ðmac; - }; - -@@ -250,6 +249,14 @@ - 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 { --- -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 deleted file mode 100644 index e79459aaac..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0122-FROMLIST-arm64-dts-meson-fix-gxm-khadas-vim2-wifi.patch +++ /dev/null @@ -1,45 +0,0 @@ -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-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 deleted file mode 100644 index dfc5c948eb..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0123-FROMLIST-arm64-dts-meson-gxl-s905x-khadas-vim-add-th.patch +++ /dev/null @@ -1,93 +0,0 @@ -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-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 deleted file mode 100644 index e67519bb43..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0124-FROMLIST-arm64-dts-meson-khadas-vim3-move-model-to-g.patch +++ /dev/null @@ -1,46 +0,0 @@ -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-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 deleted file mode 100644 index 56e633381c..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0127-FROMLIST-arm64-dts-meson-add-support-for-the-Smartla.patch +++ /dev/null @@ -1,429 +0,0 @@ -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-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch b/packages/linux/patches/amlogic/amlogic-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch deleted file mode 100644 index a7e4935eda..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0129-FROMLIST-arm64-dts-meson-g12b-gtking-add-initial-dev.patch +++ /dev/null @@ -1,611 +0,0 @@ -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-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 6cf8c4ac0390..ce276044748b 100644 ---- a/arch/arm64/boot/dts/amlogic/Makefile -+++ b/arch/arm64/boot/dts/amlogic/Makefile -@@ -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 -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..cd2ba7ad8ba2 ---- /dev/null -+++ 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 -+ * Author: Neil Armstrong -+ * Copyright (c) 2019 Christian Hewitt -+ */ -+ -+/dts-v1/; -+ -+#include "meson-g12b.dtsi" -+#include "meson-g12b-s922x.dtsi" -+#include -+#include -+#include -+ -+/ { -+ compatible = "azw,gtking", "amlogic,g12b"; -+ model = "Beelink GT-King"; -+ -+ aliases { -+ serial0 = &uart_AO; -+ ethernet0 = ðmac; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x0 0x0 0x0 0x40000000>; -+ }; -+ -+ emmc_pwrseq: emmc-pwrseq { -+ compatible = "mmc-pwrseq-emmc"; -+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; -+ }; -+ -+ sdio_pwrseq: sdio-pwrseq { -+ compatible = "mmc-pwrseq-simple"; -+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; -+ clocks = <&wifi32k>; -+ 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"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_3v3>; -+ regulator-always-on; -+ }; -+ -+ main_12v: regulator-main_12v { -+ compatible = "regulator-fixed"; -+ regulator-name = "12V"; -+ regulator-min-microvolt = <12000000>; -+ regulator-max-microvolt = <12000000>; -+ regulator-always-on; -+ }; -+ -+ vcc_5v: regulator-vcc_5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&main_12v>; -+ -+ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; -+ enable-active-high; -+ }; -+ -+ vcc_1v8: regulator-vcc_1v8 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_3v3>; -+ regulator-always-on; -+ }; -+ -+ vcc_3v3: regulator-vcc_3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vddao_3v3>; -+ regulator-always-on; -+ /* FIXME: actually controlled by VDDCPU_B_EN */ -+ }; -+ -+ vddcpu_a: regulator-vddcpu-a { -+ /* -+ * MP1653 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 { -+ /* -+ * MP1652 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; -+ }; -+ -+ usb1_pow: regulator-usb1-pow { -+ compatible = "regulator-fixed"; -+ regulator-name = "USB1_POW"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc_5v>; -+ -+ /* 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"; -+ -+ port { -+ hdmi_connector_in: endpoint { -+ remote-endpoint = <&hdmi_tx_tmds_out>; -+ }; -+ }; -+ }; -+ -+ sound { -+ compatible = "amlogic,axg-sound-card"; -+ 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", -+ "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_b>; -+ operating-points-v2 = <&cpu_opp_table_0>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vddcpu_b>; -+ operating-points-v2 = <&cpu_opp_table_0>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu100 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu101 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu102 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu103 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cvbs_vdac_port { -+ cvbs_vdac_out: endpoint { -+ remote-endpoint = <&cvbs_connector_in>; -+ }; -+}; -+ -+&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>; -+}; -+ -+&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-khadas"; -+}; -+ -+&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"; -+}; -+ -+&pwm_ef { -+ pinctrl-0 = <&pwm_e_pins>; -+ pinctrl-names = "default"; -+ clocks = <&xtal>; -+ clock-names = "clkin0"; -+ status = "okay"; -+}; -+ -+/* 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 = <50000000>; -+ disable-wp; -+ -+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; -+ vmmc-supply = <&vddao_3v3>; -+ vqmmc-supply = <&vddao_3v3>; -+}; -+ -+/* eMMC */ -+&sd_emmc_c { -+ status = "okay"; -+ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; -+ pinctrl-1 = <&emmc_clk_gate_pins>; -+ pinctrl-names = "default", "clk-gate"; -+ -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ max-frequency = <100000000>; -+ 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"; -+}; -+ -+&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-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 deleted file mode 100644 index 72dd3b1791..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0132-FROMLIST-arm64-dts-meson-g12b-fix-N2-VIM3-audio-card.patch +++ /dev/null @@ -1,43 +0,0 @@ -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-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 deleted file mode 100644 index 9ed615ca51..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0133-WIP-ath10k-add-QCA9377-sdio-hw_param-item.patch +++ /dev/null @@ -1,69 +0,0 @@ -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-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 deleted file mode 100644 index 340d7ecac2..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0134-WIP-arm64-dts-meson-g12b-khadas-vim3-add-the-Etherne.patch +++ /dev/null @@ -1,54 +0,0 @@ -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-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch b/packages/linux/patches/amlogic/amlogic-0135-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch deleted file mode 100644 index 25b4b6d3db..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0135-WIP-arm64-dts-meson-gxbb-odroid-c2-disable-LED-heart.patch +++ /dev/null @@ -1,31 +0,0 @@ -From ccfbfc5b5294e7cc23f49e78097c7433c630119e Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Wed, 24 Apr 2019 03:40:16 +0000 -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 -so remove the heartbeat line. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 3 +-- - 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 b1107d7ff32b..7d18b8814189 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts -@@ -53,8 +53,7 @@ - blue { - label = "c2:blue:alive"; - gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; -- linux,default-trigger = "heartbeat"; -- default-state = "off"; -+ default-state = "on"; - }; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0136-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 deleted file mode 100644 index d1b2f93d8a..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0136-WIP-arm64-dts-meson-g12b-odroid-n2-disable-LED-heart.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 6873f13e5afcc27ba3642227eacf90ea19d68ed4 Mon Sep 17 00:00:00 2001 -From: chewitt -Date: Sun, 11 Aug 2019 09:45:04 +0000 -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 -so remove the heartbeat line. - -Signed-off-by: Christian Hewitt ---- - arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 1 - - 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 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 -@@ -40,7 +40,6 @@ - blue { - label = "n2:blue"; - gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; -- linux,default-trigger = "heartbeat"; - }; - }; - --- -2.17.1 - diff --git a/packages/linux/patches/amlogic/amlogic-0137-WIP-arm64-dts-meson-g12b-odroid-n2-Add-cvbs-output-t.patch b/packages/linux/patches/amlogic/amlogic-0137-WIP-arm64-dts-meson-g12b-odroid-n2-Add-cvbs-output-t.patch deleted file mode 100644 index d092f0cc99..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0137-WIP-arm64-dts-meson-g12b-odroid-n2-Add-cvbs-output-t.patch +++ /dev/null @@ -1,47 +0,0 @@ -From f6587b122728e4726c3e7aa3d8f23718cee32da5 Mon Sep 17 00:00:00 2001 -From: Neil Armstrong -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-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 deleted file mode 100644 index de06dd5126..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0139-WIP-ASoC-meson-add-2-8-channel-constraints.patch +++ /dev/null @@ -1,62 +0,0 @@ -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-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch b/packages/linux/patches/amlogic/amlogic-0140-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch deleted file mode 100644 index 6f4379407e..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0140-WIP-ASoC-hdmi-codec-fix-chmap_idx-and-reorder-channe.patch +++ /dev/null @@ -1,203 +0,0 @@ -From b41df604b4c14a9e46b8660af6551a034014e4b1 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -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 - -ca_id 0x01 with speaker mask FL|FR|LFE gets selected instead of -ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels - -and - -ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of -ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels - -Fix this by reorder the channel allocation list with most specific speaker -mask at the top. - -Signed-off-by: Jonas Karlman ---- - 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 f005751da2cc..66fa9cc3c553 100644 ---- a/sound/soc/codecs/hdmi-codec.c -+++ b/sound/soc/codecs/hdmi-codec.c -@@ -189,84 +189,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { - /* - * hdmi_codec_channel_alloc: speaker configuration available for CEA - * -- * This is an ordered list that must match with hdmi_codec_8ch_chmaps struct -+ * This is an ordered list where ca_id must exist in hdmi_codec_8ch_chmaps - * The preceding ones have better chances to be selected by - * hdmi_codec_get_ch_alloc_table_idx(). - */ - static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { - { .ca_id = 0x00, .n_ch = 2, -- .mask = FL | FR}, -- /* 2.1 */ -- { .ca_id = 0x01, .n_ch = 4, -- .mask = FL | FR | LFE}, -- /* Dolby Surround */ -+ .mask = FL | FR }, -+ { .ca_id = 0x03, .n_ch = 4, -+ .mask = FL | FR | LFE | FC }, - { .ca_id = 0x02, .n_ch = 4, - .mask = FL | FR | FC }, -- /* surround51 */ -+ { .ca_id = 0x01, .n_ch = 4, -+ .mask = FL | FR | LFE }, - { .ca_id = 0x0b, .n_ch = 6, -- .mask = FL | FR | LFE | FC | RL | RR}, -- /* surround40 */ -- { .ca_id = 0x08, .n_ch = 6, -- .mask = FL | FR | RL | RR }, -- /* surround41 */ -- { .ca_id = 0x09, .n_ch = 6, -- .mask = FL | FR | LFE | RL | RR }, -- /* surround50 */ -+ .mask = FL | FR | LFE | FC | RL | RR }, - { .ca_id = 0x0a, .n_ch = 6, - .mask = FL | FR | FC | RL | RR }, -- /* 6.1 */ -- { .ca_id = 0x0f, .n_ch = 8, -- .mask = FL | FR | LFE | FC | RL | RR | RC }, -- /* surround71 */ -+ { .ca_id = 0x09, .n_ch = 6, -+ .mask = FL | FR | LFE | RL | RR }, -+ { .ca_id = 0x08, .n_ch = 6, -+ .mask = FL | FR | RL | RR }, -+ { .ca_id = 0x07, .n_ch = 6, -+ .mask = FL | FR | LFE | FC | RC }, -+ { .ca_id = 0x06, .n_ch = 6, -+ .mask = FL | FR | FC | RC }, -+ { .ca_id = 0x05, .n_ch = 6, -+ .mask = FL | FR | LFE | RC }, -+ { .ca_id = 0x04, .n_ch = 6, -+ .mask = FL | FR | RC }, - { .ca_id = 0x13, .n_ch = 8, - .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC }, -- /* others */ -- { .ca_id = 0x03, .n_ch = 8, -- .mask = FL | FR | LFE | FC }, -- { .ca_id = 0x04, .n_ch = 8, -- .mask = FL | FR | RC}, -- { .ca_id = 0x05, .n_ch = 8, -- .mask = FL | FR | LFE | RC }, -- { .ca_id = 0x06, .n_ch = 8, -- .mask = FL | FR | FC | RC }, -- { .ca_id = 0x07, .n_ch = 8, -- .mask = FL | FR | LFE | FC | RC }, -- { .ca_id = 0x0c, .n_ch = 8, -- .mask = FL | FR | RC | RL | RR }, -- { .ca_id = 0x0d, .n_ch = 8, -- .mask = FL | FR | LFE | RL | RR | RC }, -- { .ca_id = 0x0e, .n_ch = 8, -- .mask = FL | FR | FC | RL | RR | RC }, -- { .ca_id = 0x10, .n_ch = 8, -- .mask = FL | FR | RL | RR | RLC | RRC }, -- { .ca_id = 0x11, .n_ch = 8, -- .mask = FL | FR | LFE | RL | RR | RLC | RRC }, -+ { .ca_id = 0x1f, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, - { .ca_id = 0x12, .n_ch = 8, - .mask = FL | FR | FC | RL | RR | RLC | RRC }, -- { .ca_id = 0x14, .n_ch = 8, -- .mask = FL | FR | FLC | FRC }, -- { .ca_id = 0x15, .n_ch = 8, -- .mask = FL | FR | LFE | FLC | FRC }, -- { .ca_id = 0x16, .n_ch = 8, -- .mask = FL | FR | FC | FLC | FRC }, -- { .ca_id = 0x17, .n_ch = 8, -- .mask = FL | FR | LFE | FC | FLC | FRC }, -- { .ca_id = 0x18, .n_ch = 8, -- .mask = FL | FR | RC | FLC | FRC }, -- { .ca_id = 0x19, .n_ch = 8, -- .mask = FL | FR | LFE | RC | FLC | FRC }, -- { .ca_id = 0x1a, .n_ch = 8, -- .mask = FL | FR | RC | FC | FLC | FRC }, -- { .ca_id = 0x1b, .n_ch = 8, -- .mask = FL | FR | LFE | RC | FC | FLC | FRC }, -- { .ca_id = 0x1c, .n_ch = 8, -- .mask = FL | FR | RL | RR | FLC | FRC }, -- { .ca_id = 0x1d, .n_ch = 8, -- .mask = FL | FR | LFE | RL | RR | FLC | FRC }, - { .ca_id = 0x1e, .n_ch = 8, - .mask = FL | FR | FC | RL | RR | FLC | FRC }, -- { .ca_id = 0x1f, .n_ch = 8, -- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, -+ { .ca_id = 0x11, .n_ch = 8, -+ .mask = FL | FR | LFE | RL | RR | RLC | RRC }, -+ { .ca_id = 0x1d, .n_ch = 8, -+ .mask = FL | FR | LFE | RL | RR | FLC | FRC }, -+ { .ca_id = 0x10, .n_ch = 8, -+ .mask = FL | FR | RL | RR | RLC | RRC }, -+ { .ca_id = 0x1c, .n_ch = 8, -+ .mask = FL | FR | RL | RR | FLC | FRC }, -+ { .ca_id = 0x0f, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | RL | RR | RC }, -+ { .ca_id = 0x1b, .n_ch = 8, -+ .mask = FL | FR | LFE | RC | FC | FLC | FRC }, -+ { .ca_id = 0x0e, .n_ch = 8, -+ .mask = FL | FR | FC | RL | RR | RC }, -+ { .ca_id = 0x1a, .n_ch = 8, -+ .mask = FL | FR | RC | FC | FLC | FRC }, -+ { .ca_id = 0x0d, .n_ch = 8, -+ .mask = FL | FR | LFE | RL | RR | RC }, -+ { .ca_id = 0x19, .n_ch = 8, -+ .mask = FL | FR | LFE | RC | FLC | FRC }, -+ { .ca_id = 0x0c, .n_ch = 8, -+ .mask = FL | FR | RC | RL | RR }, -+ { .ca_id = 0x18, .n_ch = 8, -+ .mask = FL | FR | RC | FLC | FRC }, -+ { .ca_id = 0x17, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | FLC | FRC }, -+ { .ca_id = 0x16, .n_ch = 8, -+ .mask = FL | FR | FC | FLC | FRC }, -+ { .ca_id = 0x15, .n_ch = 8, -+ .mask = FL | FR | LFE | FLC | FRC }, -+ { .ca_id = 0x14, .n_ch = 8, -+ .mask = FL | FR | FLC | FRC }, -+ { .ca_id = 0x0b, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | RL | RR }, -+ { .ca_id = 0x0a, .n_ch = 8, -+ .mask = FL | FR | FC | RL | RR }, -+ { .ca_id = 0x09, .n_ch = 8, -+ .mask = FL | FR | LFE | RL | RR }, -+ { .ca_id = 0x08, .n_ch = 8, -+ .mask = FL | FR | RL | RR }, -+ { .ca_id = 0x07, .n_ch = 8, -+ .mask = FL | FR | LFE | FC | RC }, -+ { .ca_id = 0x06, .n_ch = 8, -+ .mask = FL | FR | FC | RC }, -+ { .ca_id = 0x05, .n_ch = 8, -+ .mask = FL | FR | LFE | RC }, -+ { .ca_id = 0x04, .n_ch = 8, -+ .mask = FL | FR | RC }, -+ { .ca_id = 0x03, .n_ch = 8, -+ .mask = FL | FR | LFE | FC }, -+ { .ca_id = 0x02, .n_ch = 8, -+ .mask = FL | FR | FC }, -+ { .ca_id = 0x01, .n_ch = 8, -+ .mask = FL | FR | LFE }, - }; - - struct hdmi_codec_priv { -@@ -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-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch b/packages/linux/patches/amlogic/amlogic-0141-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch deleted file mode 100644 index 378a30afb3..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0141-WIP-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock-is-e.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 138e1a2d8e529c71950e362dad0850b04f83e552 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 9 Jul 2018 21:25:15 +0200 -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 1103be760fd5..0b46407b2b1e 100644 ---- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -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); -+ -+ if (enable) { -+ hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); -+ hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); -+ } - } - - static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) --- -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 deleted file mode 100644 index 0ce2078f45..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0142-WIP-arm64-dts-meson-khadas-vim3-fix-missing-i2c3-nod.patch +++ /dev/null @@ -1,38 +0,0 @@ -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-WIP-arm64-dts-meson-khadas-vim3-change-LED-behaviour.patch b/packages/linux/patches/amlogic/amlogic-0143-WIP-arm64-dts-meson-khadas-vim3-change-LED-behaviour.patch deleted file mode 100644 index b5d5b90418..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0143-WIP-arm64-dts-meson-khadas-vim3-change-LED-behaviour.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 4f00623fdae001bad03250a7156983ea874dff97 Mon Sep 17 00:00:00 2001 -From: 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-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch b/packages/linux/patches/amlogic/amlogic-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch deleted file mode 100644 index b8a4026bec..0000000000 --- a/packages/linux/patches/amlogic/amlogic-0146-WIP-arm64-dts-meson-g12b-gtking-pro-add-initial-devi.patch +++ /dev/null @@ -1,592 +0,0 @@ -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 Shenzen AZW (Beelink) GT-King Pro 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 -- Analogue audio output -- 1x RS232 port -- 2x USB 2.0 port -- 2x USB 3.0 ports -- IR receiver -- 1x micro SD card slot -- 1x Power on/off button - -The device-tree is largely based on the GT-King and Ugoos AM6 devices. - -Signed-off-by: Christian Hewitt ---- - 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 c1185c932b33..730316c4d36a 100644 ---- a/arch/arm64/boot/dts/amlogic/Makefile -+++ b/arch/arm64/boot/dts/amlogic/Makefile -@@ -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-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 -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..9ce3d693319f ---- /dev/null -+++ 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 -+ * Author: Neil Armstrong -+ * Copyright (c) 2019 Christian Hewitt -+ */ -+ -+/dts-v1/; -+ -+#include "meson-g12b.dtsi" -+#include "meson-g12b-s922x.dtsi" -+#include -+#include -+#include -+ -+/ { -+ compatible = "azw,gtking", "amlogic,g12b"; -+ model = "Beelink GT-King Pro"; -+ -+ aliases { -+ serial0 = &uart_AO; -+ ethernet0 = ðmac; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ memory@0 { -+ device_type = "memory"; -+ reg = <0x0 0x0 0x0 0x40000000>; -+ }; -+ -+ emmc_pwrseq: emmc-pwrseq { -+ compatible = "mmc-pwrseq-emmc"; -+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; -+ }; -+ -+ 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>; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ white { -+ label = "power:white"; -+ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; -+ }; -+ }; -+ -+ 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; -+ }; -+ -+ main_12v: regulator-main_12v { -+ compatible = "regulator-fixed"; -+ regulator-name = "12V"; -+ regulator-min-microvolt = <12000000>; -+ regulator-max-microvolt = <12000000>; -+ regulator-always-on; -+ }; -+ -+ vcc_5v: regulator-vcc_5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&main_12v>; -+ -+ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; -+ enable-active-high; -+ }; -+ -+ vcc_1v8: regulator-vcc_1v8 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_1V8"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_3v3>; -+ regulator-always-on; -+ }; -+ -+ vcc_3v3: regulator-vcc_3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "VCC_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vddao_3v3>; -+ regulator-always-on; -+ /* FIXME: actually controlled by VDDCPU_B_EN */ -+ }; -+ -+ vddcpu_a: regulator-vddcpu-a { -+ /* -+ * MP1653 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 { -+ /* -+ * MP1652 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; -+ }; -+ -+ usb1_pow: regulator-usb1-pow { -+ compatible = "regulator-fixed"; -+ regulator-name = "USB1_POW"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc_5v>; -+ -+ /* 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"; -+ -+ port { -+ hdmi_connector_in: endpoint { -+ remote-endpoint = <&hdmi_tx_tmds_out>; -+ }; -+ }; -+ }; -+ -+ sound { -+ compatible = "amlogic,axg-sound-card"; -+ 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", -+ "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>; -+ }; -+ }; -+ -+ dai-link-4 { -+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; -+ -+ codec { -+ sound-dai = <&hdmi_tx>; -+ }; -+ }; -+ }; -+ -+ wifi32k: wifi32k { -+ compatible = "pwm-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <32768>; -+ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ -+ }; -+}; -+ -+&arb { -+ status = "okay"; -+}; -+ -+&cec_AO { -+ pinctrl-0 = <&cec_ao_a_h_pins>; -+ pinctrl-names = "default"; -+ status = "disabled"; -+ hdmi-phandle = <&hdmi_tx>; -+}; -+ -+&cecb_AO { -+ pinctrl-0 = <&cec_ao_b_h_pins>; -+ pinctrl-names = "default"; -+ status = "okay"; -+ hdmi-phandle = <&hdmi_tx>; -+}; -+ -+&clkc_audio { -+ status = "okay"; -+}; -+ -+&cpu0 { -+ cpu-supply = <&vddcpu_b>; -+ operating-points-v2 = <&cpu_opp_table_0>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vddcpu_b>; -+ operating-points-v2 = <&cpu_opp_table_0>; -+ clocks = <&clkc CLKID_CPU_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu100 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu101 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu102 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cpu103 { -+ cpu-supply = <&vddcpu_a>; -+ operating-points-v2 = <&cpub_opp_table_1>; -+ clocks = <&clkc CLKID_CPUB_CLK>; -+ clock-latency = <50000>; -+}; -+ -+&cvbs_vdac_port { -+ cvbs_vdac_out: endpoint { -+ remote-endpoint = <&cvbs_connector_in>; -+ }; -+}; -+ -+&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>; -+}; -+ -+&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-khadas"; -+}; -+ -+&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"; -+}; -+ -+&pwm_ef { -+ pinctrl-0 = <&pwm_e_pins>; -+ pinctrl-names = "default"; -+ clocks = <&xtal>; -+ clock-names = "clkin0"; -+ status = "okay"; -+}; -+ -+/* 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 = <50000000>; -+ disable-wp; -+ -+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; -+ vmmc-supply = <&vddao_3v3>; -+ vqmmc-supply = <&vddao_3v3>; -+}; -+ -+/* eMMC */ -+&sd_emmc_c { -+ status = "okay"; -+ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; -+ pinctrl-1 = <&emmc_clk_gate_pins>; -+ pinctrl-names = "default", "clk-gate"; -+ -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ max-frequency = <100000000>; -+ disable-wp; -+ -+ mmc-pwrseq = <&emmc_pwrseq>; -+ vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&flash_1v8>; -+}; -+ -+&tdmif_b { -+ status = "okay"; -+}; -+ -+&tdmout_b { -+ status = "okay"; -+}; -+ -+&tohdmitx { -+ status = "okay"; -+}; -+ -+&uart_A { -+ status = "okay"; -+ pinctrl-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/linux-0000-nop-gcc-plugin.patch b/packages/linux/patches/amlogic/linux-0000-nop-gcc-plugin.patch deleted file mode 100644 index 251cbf0cb5..0000000000 --- a/packages/linux/patches/amlogic/linux-0000-nop-gcc-plugin.patch +++ /dev/null @@ -1,23 +0,0 @@ -From a7163ecab9b2a395e809e41255f3567d7a188a5d Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Fri, 14 Feb 2020 00:34:00 +0000 -Subject: [PATCH] gcc-plugin.sh: use CONFIG_PLUGIN_HOSTCC="" on all distros - ---- - scripts/gcc-plugin.sh | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh -index d3caefe..6ba7f13 100755 ---- a/scripts/gcc-plugin.sh -+++ b/scripts/gcc-plugin.sh -@@ -1,5 +1,6 @@ - #!/bin/sh - # SPDX-License-Identifier: GPL-2.0 -+exit 0 - srctree=$(dirname "$0") - - SHOW_ERROR= --- -2.20.1 - diff --git a/projects/Amlogic/linux/linux.aarch64.conf b/projects/Amlogic/linux/linux.aarch64.conf index d9dbb3798e..17cda4bd5f 100644 --- a/projects/Amlogic/linux/linux.aarch64.conf +++ b/projects/Amlogic/linux/linux.aarch64.conf @@ -1,13 +1,14 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.6.0-rc4 Kernel Configuration +# Linux/arm64 5.7.0-rc1 Kernel Configuration # # -# Compiler: aarch64-linux-gnu-gcc.real (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0 +# Compiler: aarch64-none-linux-gnu-gcc.real (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025 # CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=80300 +CONFIG_GCC_VERSION=90201 +CONFIG_LD_VERSION=233010000 CONFIG_CLANG_VERSION=0 CONFIG_CC_CAN_LINK=y CONFIG_CC_HAS_ASM_GOTO=y @@ -58,7 +59,6 @@ CONFIG_SPARSE_IRQ=y # end of IRQ subsystem CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_ARCH_HAS_TICK_BROADCAST=y @@ -87,6 +87,7 @@ CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_SCHED_AVG_IRQ=y +# CONFIG_SCHED_THERMAL_PRESSURE is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_TASKSTATS is not set # CONFIG_PSI is not set @@ -253,13 +254,13 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ZONE_DMA=y CONFIG_ZONE_DMA32=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y CONFIG_SMP=y CONFIG_KERNEL_MODE_NEON=y 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 @@ -401,6 +402,7 @@ CONFIG_SETEND_EMULATION=y # CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_PAN=y +CONFIG_ARM64_LSE_ATOMICS=y CONFIG_ARM64_USE_LSE_ATOMICS=y CONFIG_ARM64_VHE=y # end of ARMv8.1 architectural features @@ -418,8 +420,18 @@ CONFIG_ARM64_CNP=y # ARMv8.3 architectural features # CONFIG_ARM64_PTR_AUTH=y +CONFIG_CC_HAS_BRANCH_PROT_PAC_RET=y +CONFIG_CC_HAS_SIGN_RETURN_ADDRESS=y +CONFIG_AS_HAS_PAC=y +CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y # end of ARMv8.3 architectural features +# +# ARMv8.4 architectural features +# +CONFIG_ARM64_AMU_EXTN=y +# end of ARMv8.4 architectural features + # # ARMv8.5 architectural features # @@ -434,6 +446,8 @@ CONFIG_ARM64_PSEUDO_NMI=y CONFIG_RELOCATABLE=y CONFIG_RANDOMIZE_BASE=y CONFIG_RANDOMIZE_MODULE_REGION_FULL=y +CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_STACKPROTECTOR_PER_TASK=y # end of Kernel Features # @@ -535,6 +549,9 @@ CONFIG_ARM_PSCI_FW=y # CONFIG_GOOGLE_FIRMWARE is not set CONFIG_EFI_EARLYCON=y CONFIG_MESON_SM=y +CONFIG_MFD_KHADAS_MCU=m +CONFIG_KHADAS_MCU_FAN_THERMAL=m +CONFIG_NVMEM_KHADAS_MCU_USER_MEM=m # # Tegra firmware driver @@ -631,6 +648,7 @@ 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_HAVE_ARCH_COMPILER_H=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y CONFIG_ARCH_USE_MEMREMAP_PROT=y # CONFIG_LOCK_EVENT_COUNTS is not set @@ -643,8 +661,11 @@ CONFIG_ARCH_HAS_RELR=y CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y # end of GCOV-based kernel profiling -CONFIG_PLUGIN_HOSTCC="" CONFIG_HAVE_GCC_PLUGINS=y +CONFIG_GCC_PLUGINS=y +# CONFIG_GCC_PLUGIN_CYC_COMPLEXITY is not set +# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set +# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set # end of General architecture-dependent options CONFIG_RT_MUTEXES=y @@ -808,6 +829,7 @@ CONFIG_MEMORY_ISOLATION=y # CONFIG_MEMORY_HOTPLUG is not set CONFIG_SPLIT_PTLOCK_CPUS=4 CONFIG_COMPACTION=y +# CONFIG_PAGE_REPORTING is not set CONFIG_MIGRATION=y CONFIG_CONTIG_ALLOC=y CONFIG_PHYS_ADDR_T_64BIT=y @@ -933,6 +955,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_IPV6_RPL_LWTUNNEL is not set # CONFIG_MPTCP is not set # CONFIG_NETWORK_SECMARK is not set # CONFIG_NETWORK_PHY_TIMESTAMPING is not set @@ -1273,9 +1296,10 @@ CONFIG_BT_HCIUART_H4=y # CONFIG_BT_HCIUART_BCSP is not set # CONFIG_BT_HCIUART_ATH3K is not set # CONFIG_BT_HCIUART_LL is not set -# CONFIG_BT_HCIUART_3WIRE is not set +CONFIG_BT_HCIUART_3WIRE=y # CONFIG_BT_HCIUART_INTEL is not set CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HCIUART_RTL=y CONFIG_BT_HCIUART_QCA=y # CONFIG_BT_HCIUART_AG6XX is not set # CONFIG_BT_HCIUART_MRVL is not set @@ -1391,6 +1415,7 @@ CONFIG_GENERIC_ARCH_TOPOLOGY=y # CONFIG_MOXTET is not set # CONFIG_SIMPLE_PM_BUS is not set # CONFIG_VEXPRESS_CONFIG is not set +# CONFIG_MHI_BUS is not set # end of Bus devices # CONFIG_CONNECTOR is not set @@ -1485,6 +1510,7 @@ CONFIG_EEPROM_93CX6=m # CONFIG_ECHO is not set # CONFIG_MISC_RTSX_USB is not set +# CONFIG_UACCE is not set # end of Misc devices # @@ -1502,7 +1528,6 @@ CONFIG_SCSI_DMA=y CONFIG_BLK_DEV_SD=y # CONFIG_CHR_DEV_ST is not set CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set # CONFIG_CHR_DEV_SG is not set # CONFIG_CHR_DEV_SCH is not set # CONFIG_SCSI_CONSTANTS is not set @@ -1547,6 +1572,7 @@ CONFIG_MACVLAN=m # CONFIG_IPVLAN is not set # CONFIG_VXLAN is not set # CONFIG_GENEVE is not set +# CONFIG_BAREUDP is not set # CONFIG_GTP is not set # CONFIG_MACSEC is not set CONFIG_NETCONSOLE=y @@ -1621,8 +1647,11 @@ CONFIG_MDIO_BUS_MUX_MMIOREG=y CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y # CONFIG_MDIO_GPIO is not set # CONFIG_MDIO_HISI_FEMAC is not set +# CONFIG_MDIO_IPQ8064 is not set # CONFIG_MDIO_MSCC_MIIM is not set +# CONFIG_MDIO_MVUSB is not set # CONFIG_MDIO_OCTEON is not set +CONFIG_MDIO_XPCS=y CONFIG_PHYLINK=y CONFIG_PHYLIB=y CONFIG_SWPHY=y @@ -1689,7 +1718,7 @@ CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_KAWETH is not set # CONFIG_USB_PEGASUS is not set CONFIG_USB_RTL8150=y -CONFIG_USB_RTL8152=m +CONFIG_USB_RTL8152=y CONFIG_USB_LAN78XX=m CONFIG_USB_USBNET=m CONFIG_USB_NET_AX8817X=m @@ -2040,12 +2069,7 @@ CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y # CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -# CONFIG_NULL_TTY is not set CONFIG_LDISC_AUTOLOAD=y -CONFIG_DEVMEM=y # # Serial drivers @@ -2094,24 +2118,31 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_SERIAL_FSL_LPUART is not set # CONFIG_SERIAL_FSL_LINFLEXUART is not set # CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_SPRD is not set # end of Serial drivers CONFIG_SERIAL_MCTRL_GPIO=y +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_NULL_TTY is not set +# CONFIG_TRACE_SINK is not set +# CONFIG_HVC_DCC is not set CONFIG_SERIAL_DEV_BUS=y CONFIG_SERIAL_DEV_CTRL_TTYPORT=y # CONFIG_TTY_PRINTK is not set -# CONFIG_HVC_DCC is not set # CONFIG_IPMI_HANDLER is not set # CONFIG_IPMB_DEVICE_INTERFACE is not set CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_TIMERIOMEM is not set CONFIG_HW_RANDOM_MESON=y CONFIG_HW_RANDOM_OPTEE=m +CONFIG_DEVMEM=y # CONFIG_RAW_DRIVER is not set # CONFIG_TCG_TPM is not set # CONFIG_XILLYBUS is not set # end of Character devices +# CONFIG_RANDOM_TRUST_CPU is not set # CONFIG_RANDOM_TRUST_BOOTLOADER is not set # @@ -2214,6 +2245,11 @@ CONFIG_SPI_PL022=y # CONFIG_SPI_XILINX is not set # CONFIG_SPI_ZYNQMP_GQSPI is not set +# +# SPI Multiplexer support +# +# CONFIG_SPI_MUX is not set + # # SPI Protocol Masters # @@ -2402,6 +2438,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_ADT7475 is not set # CONFIG_SENSORS_AS370 is not set # CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_AXI_FAN_CONTROL is not set CONFIG_SENSORS_ARM_SCPI=y # CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set @@ -2612,6 +2649,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_HI6421_PMIC is not set # CONFIG_HTC_PASIC3 is not set # CONFIG_HTC_I2CPLD is not set +# CONFIG_MFD_IQS62X is not set # CONFIG_MFD_KEMPLD is not set # CONFIG_MFD_88PM800 is not set # CONFIG_MFD_88PM805 is not set @@ -2700,7 +2738,6 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y # CONFIG_REGULATOR_88PG86X is not set # CONFIG_REGULATOR_ACT8865 is not set # CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set # CONFIG_REGULATOR_ARIZONA_LDO1 is not set # CONFIG_REGULATOR_ARIZONA_MICSUPP is not set # CONFIG_REGULATOR_DA9210 is not set @@ -2721,7 +2758,9 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_MAX8952 is not set # CONFIG_REGULATOR_MAX8973 is not set # CONFIG_REGULATOR_MCP16502 is not set +# CONFIG_REGULATOR_MP5416 is not set # CONFIG_REGULATOR_MP8859 is not set +# CONFIG_REGULATOR_MP886X is not set # CONFIG_REGULATOR_MPQ7920 is not set # CONFIG_REGULATOR_MT6311 is not set # CONFIG_REGULATOR_PFUZE100 is not set @@ -2842,7 +2881,6 @@ CONFIG_VIDEO_PVRUSB2_SYSFS=y CONFIG_VIDEO_PVRUSB2_DVB=y # CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set CONFIG_VIDEO_HDPVR=m -CONFIG_VIDEO_USBVISION=m CONFIG_VIDEO_STK1160_COMMON=m CONFIG_VIDEO_STK1160=m # CONFIG_VIDEO_GO7007 is not set @@ -3042,6 +3080,7 @@ CONFIG_VIDEO_CX25840=m # Camera sensor devices # # CONFIG_VIDEO_HI556 is not set +# CONFIG_VIDEO_IMX219 is not set # CONFIG_VIDEO_IMX258 is not set # CONFIG_VIDEO_IMX274 is not set # CONFIG_VIDEO_IMX290 is not set @@ -3350,7 +3389,7 @@ CONFIG_DVB_SP2=m # # Tools to develop new frontends # -# CONFIG_DVB_DUMMY_FE is not set +CONFIG_DVB_DUMMY_FE=m # end of Customise DVB Frontends # @@ -3390,11 +3429,6 @@ CONFIG_DRM_SCHED=m # CONFIG_DRM_KOMEDA is not set # end of ARM devices -# -# ACP (Audio CoProcessor) Configuration -# -# end of ACP (Audio CoProcessor) Configuration - # CONFIG_DRM_VGEM is not set # CONFIG_DRM_VKMS is not set # CONFIG_DRM_UDL is not set @@ -3417,6 +3451,7 @@ CONFIG_DRM_PANEL=y # 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_S6E88A0_AMS452EF01 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 @@ -3434,19 +3469,23 @@ CONFIG_DRM_PANEL_BRIDGE=y # Display Interface Bridges # # CONFIG_DRM_CDNS_DSI is not set -# CONFIG_DRM_DUMB_VGA_DAC is not set +CONFIG_DRM_DISPLAY_CONNECTOR=y # 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 +# CONFIG_DRM_PARADE_PS8640 is not set # CONFIG_DRM_SIL_SII8620 is not set # CONFIG_DRM_SII902X is not set # CONFIG_DRM_SII9234 is not set +# CONFIG_DRM_SIMPLE_BRIDGE is not set # CONFIG_DRM_THINE_THC63LVD1024 is not set # CONFIG_DRM_TOSHIBA_TC358764 is not set # CONFIG_DRM_TOSHIBA_TC358767 is not set +# CONFIG_DRM_TOSHIBA_TC358768 is not set # CONFIG_DRM_TI_TFP410 is not set # CONFIG_DRM_TI_SN65DSI86 is not set +# CONFIG_DRM_TI_TPD12S015 is not set # CONFIG_DRM_ANALOGIX_ANX6345 is not set # CONFIG_DRM_ANALOGIX_ANX78XX is not set # CONFIG_DRM_I2C_ADV7511 is not set @@ -3466,6 +3505,7 @@ CONFIG_DRM_MESON_DW_HDMI=y # CONFIG_TINYDRM_HX8357D is not set # CONFIG_TINYDRM_ILI9225 is not set # CONFIG_TINYDRM_ILI9341 is not set +# CONFIG_TINYDRM_ILI9486 is not set # CONFIG_TINYDRM_MI0283QT is not set # CONFIG_TINYDRM_REPAPER is not set # CONFIG_TINYDRM_ST7586 is not set @@ -3473,6 +3513,7 @@ CONFIG_DRM_MESON_DW_HDMI=y # CONFIG_DRM_PL111 is not set CONFIG_DRM_LIMA=m CONFIG_DRM_PANFROST=m +# CONFIG_DRM_TIDSS is not set # CONFIG_DRM_LEGACY is not set CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y @@ -3527,6 +3568,7 @@ CONFIG_BACKLIGHT_GPIO=y # CONFIG_BACKLIGHT_LV5207LP is not set # CONFIG_BACKLIGHT_BD6107 is not set # CONFIG_BACKLIGHT_ARCXCNN is not set +# CONFIG_BACKLIGHT_LED is not set # end of Backlight & LCD device support CONFIG_VIDEOMODE_HELPERS=y @@ -3595,6 +3637,7 @@ CONFIG_SND_USB_VARIAX=m CONFIG_SND_SOC=y # CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_BCM63XX_I2S_WHISTLER is not set # CONFIG_SND_DESIGNWARE_I2S is not set # @@ -3756,6 +3799,7 @@ CONFIG_SND_SOC_SPDIF=y # CONFIG_SND_SOC_TLV320AIC32X4_I2C is not set # CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set # CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TLV320ADCX140 is not set # CONFIG_SND_SOC_TS3A227E is not set # CONFIG_SND_SOC_TSCS42XX is not set # CONFIG_SND_SOC_TSCS454 is not set @@ -3840,6 +3884,7 @@ CONFIG_DRAGONRISE_FF=y CONFIG_HID_EZKEY=y # CONFIG_HID_GEMBIRD is not set # CONFIG_HID_GFRM is not set +# CONFIG_HID_GLORIOUS is not set # CONFIG_HID_HOLTEK is not set # CONFIG_HID_GT683R is not set # CONFIG_HID_KEYTOUCH is not set @@ -3907,6 +3952,7 @@ CONFIG_HID_XINMO=y CONFIG_HID_ZYDACRON=y # CONFIG_HID_SENSOR_HUB is not set # CONFIG_HID_ALPS is not set +# CONFIG_HID_MCP2221 is not set # end of Special HID drivers # @@ -4001,7 +4047,7 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_STORAGE_KARMA is not set # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set # CONFIG_USB_STORAGE_ENE_UB6250 is not set -CONFIG_USB_UAS=m +CONFIG_USB_UAS=y # # USB Imaging devices @@ -4105,6 +4151,7 @@ CONFIG_USB_SERIAL_PL2303=m # CONFIG_USB_IDMOUSE is not set # CONFIG_USB_FTDI_ELAN is not set # CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_APPLE_MFI_FASTCHARGE is not set # CONFIG_USB_SISUSBVGA is not set # CONFIG_USB_LD is not set # CONFIG_USB_TRANCEVIBRATOR is not set @@ -4151,10 +4198,34 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 # CONFIG_USB_BDC_UDC is not set # CONFIG_USB_NET2272 is not set # CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_MAX3420_UDC is not set # CONFIG_USB_DUMMY_HCD is not set # end of USB Peripheral Controller # CONFIG_USB_CONFIGFS is not set + +# +# USB Gadget precomposed configurations +# +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set +# CONFIG_USB_RAW_GADGET is not set +# end of USB Gadget precomposed configurations + CONFIG_TYPEC=m CONFIG_TYPEC_TCPM=m # CONFIG_TYPEC_TCPCI is not set @@ -4198,6 +4269,7 @@ CONFIG_MMC_SPI=y # CONFIG_MMC_USHC is not set # CONFIG_MMC_USDHI6ROL0 is not set # CONFIG_MMC_CQHCI is not set +# CONFIG_MMC_HSQ is not set # CONFIG_MMC_MTK is not set # CONFIG_MEMSTICK is not set CONFIG_NEW_LEDS=y @@ -4312,7 +4384,7 @@ CONFIG_RTC_DRV_HYM8563=m # CONFIG_RTC_DRV_PCF8523 is not set # CONFIG_RTC_DRV_PCF85063 is not set # CONFIG_RTC_DRV_PCF85363 is not set -# CONFIG_RTC_DRV_PCF8563 is not set +CONFIG_RTC_DRV_PCF8563=m # CONFIG_RTC_DRV_PCF8583 is not set # CONFIG_RTC_DRV_M41T80 is not set # CONFIG_RTC_DRV_BQ32K is not set @@ -4382,7 +4454,6 @@ CONFIG_RTC_DRV_MESON_VRTC=m CONFIG_RTC_DRV_PL031=y # CONFIG_RTC_DRV_CADENCE is not set # CONFIG_RTC_DRV_FTRTC010 is not set -# CONFIG_RTC_DRV_SNVS is not set # CONFIG_RTC_DRV_R7301 is not set # @@ -4395,9 +4466,12 @@ CONFIG_RTC_DRV_PL031=y # CONFIG_SYNC_FILE=y # CONFIG_SW_SYNC is not set -# CONFIG_UDMABUF is not set +CONFIG_UDMABUF=y +# CONFIG_DMABUF_MOVE_NOTIFY is not set # CONFIG_DMABUF_SELFTESTS is not set -# CONFIG_DMABUF_HEAPS is not set +CONFIG_DMABUF_HEAPS=y +CONFIG_DMABUF_HEAPS_SYSTEM=y +CONFIG_DMABUF_HEAPS_CMA=y # end of DMABUF options # CONFIG_AUXDISPLAY is not set @@ -4405,6 +4479,8 @@ CONFIG_SYNC_FILE=y # CONFIG_VFIO is not set # CONFIG_VIRT_DRIVERS is not set # CONFIG_VIRTIO_MENU is not set +# CONFIG_VDPA_MENU is not set +# CONFIG_VHOST_MENU is not set # # Microsoft Hyper-V guest support @@ -4436,7 +4512,6 @@ CONFIG_STAGING=y # 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 @@ -4491,6 +4566,7 @@ CONFIG_VIDEO_MESON_VDEC=m # # soc_camera sensor drivers # +CONFIG_VIDEO_USBVISION=m # # Android @@ -4505,7 +4581,6 @@ CONFIG_VIDEO_MESON_VDEC=m # 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 @@ -4516,9 +4591,6 @@ CONFIG_VIDEO_MESON_VDEC=m # 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_MFD_CROS_EC is not set @@ -4759,6 +4831,7 @@ CONFIG_KXCJK1013=m # # CONFIG_AD7091R5 is not set # CONFIG_AD7124 is not set +# CONFIG_AD7192 is not set # CONFIG_AD7266 is not set # CONFIG_AD7291 is not set # CONFIG_AD7292 is not set @@ -4825,6 +4898,7 @@ CONFIG_MESON_SARADC=y # Amplifiers # # CONFIG_AD8366 is not set +# CONFIG_HMC425 is not set # end of Amplifiers # @@ -4864,19 +4938,20 @@ CONFIG_MESON_SARADC=y # CONFIG_AD5593R is not set # CONFIG_AD5504 is not set # CONFIG_AD5624R_SPI is not set -# CONFIG_LTC1660 is not set -# CONFIG_LTC2632 is not set # CONFIG_AD5686_SPI is not set # CONFIG_AD5696_I2C is not set # CONFIG_AD5755 is not set # CONFIG_AD5758 is not set # CONFIG_AD5761 is not set # CONFIG_AD5764 is not set +# CONFIG_AD5770R is not set # CONFIG_AD5791 is not set # CONFIG_AD7303 is not set # CONFIG_AD8801 is not set # CONFIG_DPOT_DAC is not set # CONFIG_DS4424 is not set +# CONFIG_LTC1660 is not set +# CONFIG_LTC2632 is not set # CONFIG_M62332 is not set # CONFIG_MAX517 is not set # CONFIG_MAX5821 is not set @@ -4974,6 +5049,7 @@ CONFIG_MESON_SARADC=y # # CONFIG_ADJD_S311 is not set # CONFIG_ADUX1020 is not set +# CONFIG_AL3010 is not set # CONFIG_AL3320A is not set # CONFIG_APDS9300 is not set # CONFIG_APDS9960 is not set @@ -4984,6 +5060,7 @@ CONFIG_MESON_SARADC=y # CONFIG_CM3323 is not set # CONFIG_CM3605 is not set # CONFIG_CM36651 is not set +# CONFIG_GP2AP002 is not set # CONFIG_GP2AP020A00F is not set # CONFIG_SENSORS_ISL29018 is not set # CONFIG_SENSORS_ISL29028 is not set @@ -5051,6 +5128,11 @@ CONFIG_MESON_SARADC=y # CONFIG_IIO_SYSFS_TRIGGER is not set # end of Triggers - standalone +# +# Linear and angular position sensors +# +# end of Linear and angular position sensors + # # Digital potentiometers # @@ -5080,6 +5162,7 @@ CONFIG_MESON_SARADC=y # CONFIG_DLHL60D is not set # CONFIG_DPS310 is not set # CONFIG_HP03 is not set +# CONFIG_ICP10100 is not set # CONFIG_MPL115_I2C is not set # CONFIG_MPL115_SPI is not set # CONFIG_MPL3115 is not set @@ -5134,6 +5217,7 @@ CONFIG_MESON_SARADC=y CONFIG_PWM=y CONFIG_PWM_SYSFS=y +# CONFIG_PWM_DEBUG is not set # CONFIG_PWM_FSL_FTM is not set CONFIG_PWM_MESON=y # CONFIG_PWM_PCA9685 is not set @@ -5169,8 +5253,10 @@ CONFIG_PHY_MESON_GXL_USB2=y CONFIG_PHY_MESON_GXL_USB3=y CONFIG_PHY_MESON_G12A_USB2=y CONFIG_PHY_MESON_G12A_USB3_PCIE=y +CONFIG_PHY_MESON_AXG_PCIE=y +CONFIG_PHY_MESON_AXG_MIPI_PCIE_ANALOG=y # CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_PHY_CADENCE_DP is not set +# CONFIG_PHY_CADENCE_TORRENT is not set # CONFIG_PHY_CADENCE_DPHY is not set # CONFIG_PHY_CADENCE_SIERRA is not set # CONFIG_PHY_FSL_IMX8MQ_USB is not set @@ -5247,6 +5333,7 @@ CONFIG_PM_OPP=y # CONFIG_SLIMBUS is not set # CONFIG_INTERCONNECT is not set # CONFIG_COUNTER is not set +# CONFIG_MOST is not set # end of Device Drivers # @@ -5343,7 +5430,7 @@ CONFIG_UDF_FS=m # end of CD-ROM/DVD Filesystems # -# DOS/FAT/NT Filesystems +# DOS/FAT/EXFAT/NT Filesystems # CONFIG_FAT_FS=y # CONFIG_MSDOS_FS is not set @@ -5351,8 +5438,9 @@ CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="ascii" # CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_EXFAT_FS is not set # CONFIG_NTFS_FS is not set -# end of DOS/FAT/NT Filesystems +# end of DOS/FAT/EXFAT/NT Filesystems # # Pseudo filesystems @@ -5535,6 +5623,10 @@ CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor" # Memory initialization # CONFIG_INIT_STACK_NONE=y +# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set +# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set +# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set +# CONFIG_GCC_PLUGIN_STACKLEAK is not set # CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization @@ -5814,7 +5906,7 @@ CONFIG_DMA_CMA=y # # Default contiguous memory area size: # -CONFIG_CMA_SIZE_MBYTES=256 +CONFIG_CMA_SIZE_MBYTES=128 CONFIG_CMA_SIZE_SEL_MBYTES=y # CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set # CONFIG_CMA_SIZE_SEL_MIN is not set @@ -5870,7 +5962,6 @@ CONFIG_FRAME_WARN=2048 CONFIG_STRIP_ASM_SYMS=y # CONFIG_READABLE_ASM is not set # CONFIG_HEADERS_INSTALL 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 @@ -5884,12 +5975,12 @@ CONFIG_FRAME_POINTER=y CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" 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 @@ -5938,6 +6029,7 @@ 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 +# CONFIG_TEST_LOCKUP is not set # end of Debug Oops, Lockups and Hangs # @@ -6017,7 +6109,6 @@ CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # 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 diff --git a/packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch b/projects/Amlogic/patches/linux/amlogic-0001-HACK-set-meson-gx-cma-pool-to-768MB.patch similarity index 68% rename from packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch rename to projects/Amlogic/patches/linux/amlogic-0001-HACK-set-meson-gx-cma-pool-to-768MB.patch index 4d1b2b6c44..6a218f25eb 100644 --- a/packages/linux/patches/amlogic/amlogic-0073-HACK-set-meson-gx-cma-pool-to-896MB.patch +++ b/projects/Amlogic/patches/linux/amlogic-0001-HACK-set-meson-gx-cma-pool-to-768MB.patch @@ -1,9 +1,9 @@ -From e78756bc70272b72ef1c02d8b7dec66ad5db8eb6 Mon Sep 17 00:00:00 2001 +From 35808d659a3d8d50fcefbd640c327efe43e47a3a Mon Sep 17 00:00:00 2001 From: chewitt Date: Sat, 13 Apr 2019 05:41:51 +0000 -Subject: [PATCH 073/146] HACK: set meson-gx cma pool to 896MB +Subject: [PATCH 001/156] HACK: set meson-gx cma pool to 768MB -This change sets the CMA pool to a larger 896MB! value for (WIP) vdec use +This change sets the CMA pool to a larger 768MB! value for vdec use Signed-off-by: Christian Hewitt --- @@ -11,15 +11,15 @@ 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 3f55ef2ae021..807db6e73a49 100644 +index e2bb68ec8502..b9b16f48cb1e 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -50,7 +50,7 @@ +@@ -45,7 +45,7 @@ linux,cma { compatible = "shared-dma-pool"; reusable; - size = <0x0 0x10000000>; -+ size = <0x0 0x38000000>; ++ size = <0x0 0x30000000>; alignment = <0x0 0x400000>; linux,cma-default; }; diff --git a/packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch b/projects/Amlogic/patches/linux/amlogic-0002-HACK-set-meson-g12-cma-pool-to-768MB.patch similarity index 71% rename from packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch rename to projects/Amlogic/patches/linux/amlogic-0002-HACK-set-meson-g12-cma-pool-to-768MB.patch index 7ad6af16e2..a8a7ec503a 100644 --- a/packages/linux/patches/amlogic/amlogic-0074-HACK-set-meson-g12-cma-pool-to-896MB.patch +++ b/projects/Amlogic/patches/linux/amlogic-0002-HACK-set-meson-g12-cma-pool-to-768MB.patch @@ -1,9 +1,9 @@ -From 6f2a3ca26bc7cfb7a06da5241f6e9432bea9197a Mon Sep 17 00:00:00 2001 +From 93dd716407924c12783a795708314952387b3f83 Mon Sep 17 00:00:00 2001 From: chewitt Date: Wed, 14 Aug 2019 19:58:14 +0000 -Subject: [PATCH 074/146] HACK: set meson-g12 cma pool to 896MB +Subject: [PATCH 002/156] HACK: set meson-g12 cma pool to 768MB -This change sets the CMA pool to a larger 896MB! value for (WIP) vdec use +This change sets the CMA pool to a larger 768MB! value for vdec use Signed-off-by: Christian Hewitt --- @@ -11,7 +11,7 @@ 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 4625bdd08c07..3deace05d345 100644 +index c0aef7d69117..0a625ad14712 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -71,7 +71,7 @@ @@ -19,7 +19,7 @@ index 4625bdd08c07..3deace05d345 100644 compatible = "shared-dma-pool"; reusable; - size = <0x0 0x10000000>; -+ size = <0x0 0x38000000>; ++ size = <0x0 0x30000000>; alignment = <0x0 0x400000>; linux,cma-default; }; diff --git a/packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch b/projects/Amlogic/patches/linux/amlogic-0003-HACK-arm64-fix-Kodi-sysinfo-CPU-information.patch similarity index 83% rename from packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch rename to projects/Amlogic/patches/linux/amlogic-0003-HACK-arm64-fix-Kodi-sysinfo-CPU-information.patch index e0470690e6..7d8a352518 100644 --- a/packages/linux/patches/amlogic/amlogic-0068-HACK-fix-Kodi-sysinfo-CPU-information.patch +++ b/projects/Amlogic/patches/linux/amlogic-0003-HACK-arm64-fix-Kodi-sysinfo-CPU-information.patch @@ -1,11 +1,11 @@ -From 549431bd739f0516860784bbd3e96b901acd3f9d Mon Sep 17 00:00:00 2001 +From 4a35e44d38d156e292f0b9c9c4166fe98ebc847d Mon Sep 17 00:00:00 2001 From: chewitt Date: Sat, 13 Apr 2019 05:45:18 +0000 -Subject: [PATCH 068/146] HACK: fix Kodi sysinfo CPU information +Subject: [PATCH 003/156] HACK: arm64: fix Kodi sysinfo CPU information This allows the CPU information to show in the Kodi sysinfo screen, e.g. -"ARMv8 Processor rev 4 (v81)" on S905* devices +"ARMv8 Processor rev 4 (v81)" on Amlogic devices Signed-off-by: Christian Hewitt --- diff --git a/packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch b/projects/Amlogic/patches/linux/amlogic-0004-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch similarity index 84% rename from packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch rename to projects/Amlogic/patches/linux/amlogic-0004-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch index b1d65b487e..7fa6c57cb8 100644 --- a/packages/linux/patches/amlogic/amlogic-0072-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch +++ b/projects/Amlogic/patches/linux/amlogic-0004-HACK-arm64-dts-meson-gx-add-ATF-BL32-reserved-memory.patch @@ -1,7 +1,7 @@ -From 6cd56ed16246f8022a963438975c669dd9540206 Mon Sep 17 00:00:00 2001 +From 5b92e88cc625b65870b246103dd6ed2d2967ee07 Mon Sep 17 00:00:00 2001 From: kszaq Date: Sat, 6 Jul 2019 07:54:44 +0000 -Subject: [PATCH 072/146] HACK: arm64: dts: meson-gx: add ATF BL32 reserved +Subject: [PATCH 004/156] HACK: arm64: dts: meson-gx: add ATF BL32 reserved memory region Vendor firmware/uboot has an additional reserved region for BL32 trusted @@ -16,10 +16,10 @@ 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 962a56e0e8b4..3f55ef2ae021 100644 +index b9b16f48cb1e..ea4dac8506bc 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi -@@ -41,6 +41,12 @@ +@@ -42,6 +42,12 @@ no-map; }; diff --git a/packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch b/projects/Amlogic/patches/linux/amlogic-0005-HACK-media-cec-silence-CEC-timeout-message.patch similarity index 89% rename from packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch rename to projects/Amlogic/patches/linux/amlogic-0005-HACK-media-cec-silence-CEC-timeout-message.patch index 3c0c3a8051..fbe15c8bc8 100644 --- a/packages/linux/patches/amlogic/amlogic-0069-HACK-media-cec-silence-CEC-timeout-message.patch +++ b/projects/Amlogic/patches/linux/amlogic-0005-HACK-media-cec-silence-CEC-timeout-message.patch @@ -1,7 +1,7 @@ -From d0ecb91fbd0224d36fb4a76ba9d373bdb398e642 Mon Sep 17 00:00:00 2001 +From d7ba0960e3bc51f8368ef9d3b98ce33be91e3570 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 +Subject: [PATCH 005/156] 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 @@ -19,7 +19,7 @@ Signed-off-by: Christian Hewitt 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 +index 6a04d19a96b2..fcb29dba8de1 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) diff --git a/packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch b/projects/Amlogic/patches/linux/amlogic-0006-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch similarity index 91% rename from packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch rename to projects/Amlogic/patches/linux/amlogic-0006-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch index 002d5802a2..f71e78491a 100644 --- a/packages/linux/patches/amlogic/amlogic-0070-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch +++ b/projects/Amlogic/patches/linux/amlogic-0006-HACK-revert-mm-emit-tracepoint-when-RSS-changes.patch @@ -1,7 +1,7 @@ -From 0ad39c62080a471c6f94ab64feb832728be37eda Mon Sep 17 00:00:00 2001 +From 776e38d46393b542029e4fcd908c344fa83342dd 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 +Subject: [PATCH 006/156] HACK: revert mm: emit tracepoint when RSS changes --- include/linux/mm.h | 14 +++----------- @@ -10,10 +10,10 @@ Subject: [PATCH 070/146] HACK: revert mm: emit tracepoint when RSS changes 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h -index 52269e56c514..e9d7fdacb676 100644 +index 465e8ad671f8..474bbd14b065 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) +@@ -1848,27 +1848,19 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) return (unsigned long)val; } @@ -84,7 +84,7 @@ index f65b1f6db22d..788e049f899c 100644 /* This part must be outside protection */ diff --git a/mm/memory.c b/mm/memory.c -index 0bccc622e482..958d68e8fa9e 100644 +index f703fe8c8346..796c5a62e173 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -72,8 +72,6 @@ diff --git a/projects/Amlogic/patches/linux/amlogic-0007-HACK-mmc-core-always-re-init-sdcards-to-set-default-.patch b/projects/Amlogic/patches/linux/amlogic-0007-HACK-mmc-core-always-re-init-sdcards-to-set-default-.patch new file mode 100644 index 0000000000..00053a0061 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0007-HACK-mmc-core-always-re-init-sdcards-to-set-default-.patch @@ -0,0 +1,58 @@ +From 14f9943b4aef5e3ef444c0cc131ebaaef2b1c3d3 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 16 Apr 2020 08:31:55 +0000 +Subject: [PATCH 007/156] HACK: mmc: core: always re-init sdcards to set + default 3.3v regulator ios + +sd-uhs-** in device-tree changes the voltage to 1.8v, so we need to ensure +the card is reset to 3.3v before rebooting else on reboot there is no card +to boot from. + +Signed-off-by: Neil Armstrong +--- + drivers/mmc/core/sd.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c +index 76c7add367d5..5b974fbda160 100644 +--- a/drivers/mmc/core/sd.c ++++ b/drivers/mmc/core/sd.c +@@ -1191,6 +1191,26 @@ static int mmc_sd_suspend(struct mmc_host *host) + return err; + } + ++/* ++ * Callback for shutdown ++ */ ++static int mmc_sd_shutdown(struct mmc_host *host) ++{ ++ mmc_claim_host(host); ++ ++ if (mmc_card_suspended(host->card)) ++ goto out; ++ ++ mmc_power_off(host); ++ mmc_card_set_suspended(host->card); ++ ++ pm_runtime_disable(&host->card->dev); ++ pm_runtime_set_suspended(&host->card->dev); ++ ++out: ++ return 0; ++} ++ + /* + * This function tries to determine if the same card is still present + * and, if so, restore all state to it. +@@ -1269,7 +1289,7 @@ static const struct mmc_bus_ops mmc_sd_ops = { + .suspend = mmc_sd_suspend, + .resume = mmc_sd_resume, + .alive = mmc_sd_alive, +- .shutdown = mmc_sd_suspend, ++ .shutdown = mmc_sd_shutdown, + .hw_reset = mmc_sd_hw_reset, + }; + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0008-FROMGIT-dt-bindings-net-bluetooth-Add-device-tree-bi.patch b/projects/Amlogic/patches/linux/amlogic-0008-FROMGIT-dt-bindings-net-bluetooth-Add-device-tree-bi.patch new file mode 100644 index 0000000000..19d838dec4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0008-FROMGIT-dt-bindings-net-bluetooth-Add-device-tree-bi.patch @@ -0,0 +1,39 @@ +From ae11001b43297957b54d1ffbf05be1b1f616f065 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 21 Apr 2020 06:21:10 +0000 +Subject: [PATCH 008/156] FROMGIT: dt-bindings: net: bluetooth: Add device tree + bindings for QCA9377 + +QCA9377 is a QCA ROME device frequently found in Android TV boxes. + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +index d2202791c1d4..2fec6912e160 100644 +--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt ++++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +@@ -10,6 +10,7 @@ device the slave device is attached to. + Required properties: + - compatible: should contain one of the following: + * "qcom,qca6174-bt" ++ * "qcom,qca9377-bt" + * "qcom,wcn3990-bt" + * "qcom,wcn3991-bt" + * "qcom,wcn3998-bt" +@@ -20,6 +21,10 @@ Optional properties for compatible string qcom,qca6174-bt: + - clocks: clock provided to the controller (SUSCLK_32KHZ) + - firmware-name: specify the name of nvm firmware to load + ++Optional properties for compatible string qcom,qca9377-bt: ++ ++ - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml ++ + Required properties for compatible string qcom,wcn399x-bt: + + - vddio-supply: VDD_IO supply regulator handle. +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0009-FROMGIT-Bluetooth-hci_qca-add-compatible-for-QCA9377.patch b/projects/Amlogic/patches/linux/amlogic-0009-FROMGIT-Bluetooth-hci_qca-add-compatible-for-QCA9377.patch new file mode 100644 index 0000000000..6240651eb1 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0009-FROMGIT-Bluetooth-hci_qca-add-compatible-for-QCA9377.patch @@ -0,0 +1,28 @@ +From 763a8b759e9a394acdae62ecb99d10d202c4062d Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 5 Mar 2020 04:19:18 +0000 +Subject: [PATCH 009/156] FROMGIT: Bluetooth: hci_qca: add compatible for + QCA9377 + +Add a compatible so QCA9377 devices can be defined in device-tree. + +Signed-off-by: Christian Hewitt +--- + drivers/bluetooth/hci_qca.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c +index 0b1036e5e963..27c24af739a0 100644 +--- a/drivers/bluetooth/hci_qca.c ++++ b/drivers/bluetooth/hci_qca.c +@@ -2048,6 +2048,7 @@ static SIMPLE_DEV_PM_OPS(qca_pm_ops, qca_suspend, qca_resume); + + static const struct of_device_id qca_bluetooth_of_match[] = { + { .compatible = "qcom,qca6174-bt" }, ++ { .compatible = "qcom,qca9377-bt" }, + { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990}, + { .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991}, + { .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998}, +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0010-FROMGIT-Bluetooth-hci_qca-allow-max-speed-to-be-set-.patch b/projects/Amlogic/patches/linux/amlogic-0010-FROMGIT-Bluetooth-hci_qca-allow-max-speed-to-be-set-.patch new file mode 100644 index 0000000000..c21ad715a8 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0010-FROMGIT-Bluetooth-hci_qca-allow-max-speed-to-be-set-.patch @@ -0,0 +1,61 @@ +From e2d049bb10b4a35ba06259ee89ff366f23fbc69e Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 21 Apr 2020 01:00:14 +0000 +Subject: [PATCH 010/156] FROMGIT: Bluetooth: hci_qca: allow max-speed to be + set for QCA9377 devices + +Move the read of max-speed from device-tree out of the qca_is_wcn399x +if block so oper_speed can be set for QCA9377 devices as well. + +Suggested-by: Abhishek Pandit-Subedi +Signed-off-by: Christian Hewitt +--- + drivers/bluetooth/hci_qca.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c +index 27c24af739a0..3b47635bdf66 100644 +--- a/drivers/bluetooth/hci_qca.c ++++ b/drivers/bluetooth/hci_qca.c +@@ -596,10 +596,12 @@ static int qca_open(struct hci_uart *hu) + + if (hu->serdev) { + qcadev = serdev_device_get_drvdata(hu->serdev); +- if (qca_is_wcn399x(qcadev->btsoc_type)) { ++ ++ if (qca_is_wcn399x(qcadev->btsoc_type)) + hu->init_speed = qcadev->init_speed; ++ ++ if (qcadev->oper_speed) + hu->oper_speed = qcadev->oper_speed; +- } + } + + timer_setup(&qca->wake_retrans_timer, hci_ibs_wake_retrans_timeout, 0); +@@ -1865,6 +1867,11 @@ static int qca_serdev_probe(struct serdev_device *serdev) + serdev_device_set_drvdata(serdev, qcadev); + device_property_read_string(&serdev->dev, "firmware-name", + &qcadev->firmware_name); ++ device_property_read_u32(&serdev->dev, "max-speed", ++ &qcadev->oper_speed); ++ if (!qcadev->oper_speed) ++ BT_DBG("UART will pick default operating speed"); ++ + if (data && qca_is_wcn399x(data->soc_type)) { + qcadev->btsoc_type = data->soc_type; + qcadev->bt_power = devm_kzalloc(&serdev->dev, +@@ -1889,11 +1896,6 @@ static int qca_serdev_probe(struct serdev_device *serdev) + return PTR_ERR(qcadev->susclk); + } + +- device_property_read_u32(&serdev->dev, "max-speed", +- &qcadev->oper_speed); +- if (!qcadev->oper_speed) +- BT_DBG("UART will pick default operating speed"); +- + err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto); + if (err) { + BT_ERR("wcn3990 serdev registration failed"); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0011-FROMGIT-arm64-dts-meson-S922X-extend-cpu-opp-points.patch b/projects/Amlogic/patches/linux/amlogic-0011-FROMGIT-arm64-dts-meson-S922X-extend-cpu-opp-points.patch new file mode 100644 index 0000000000..e59521b0bc --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0011-FROMGIT-arm64-dts-meson-S922X-extend-cpu-opp-points.patch @@ -0,0 +1,57 @@ +From 8444d8f5d9133e1061b62fc15962522b8190b11a Mon Sep 17 00:00:00 2001 +From: Tim Lewis +Date: Sun, 26 Apr 2020 12:21:19 -0400 +Subject: [PATCH 011/156] FROMGIT: arm64: dts: meson: S922X: extend cpu + opp-points + +Add extra cpu pop points to allow mild overclock on S922X. The opp +points are found in Hardkernel N2 sources [1] and testing shows no +obvious issues on other S922X devices. Thermal throttling should +keep things in-check if needed. + +[1] https://github.com/hardkernel/linux/commit/f86cd9487c7483b2a05f448b9ebacf6bd5a2ad2f + +Signed-off-by: Tim Lewis +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20200426162119.GA23268@imac +--- + arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi +index 046cc332d07f..1e5d0ee5d541 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi +@@ -65,6 +65,11 @@ + opp-hz = /bits/ 64 <1896000000>; + opp-microvolt = <981000>; + }; ++ ++ opp-1992000000 { ++ opp-hz = /bits/ 64 <1992000000>; ++ opp-microvolt = <1001000>; ++ }; + }; + + cpub_opp_table_1: opp-table-1 { +@@ -120,5 +125,15 @@ + opp-hz = /bits/ 64 <1704000000>; + opp-microvolt = <891000>; + }; ++ ++ opp-1800000000 { ++ opp-hz = /bits/ 64 <1800000000>; ++ opp-microvolt = <981000>; ++ }; ++ ++ opp-1908000000 { ++ opp-hz = /bits/ 64 <1908000000>; ++ opp-microvolt = <1022000>; ++ }; + }; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0012-FROMGIT-arm64-dts-meson-kvim3-move-hdmi-to-tdm-a.patch b/projects/Amlogic/patches/linux/amlogic-0012-FROMGIT-arm64-dts-meson-kvim3-move-hdmi-to-tdm-a.patch new file mode 100644 index 0000000000..bcc7e2472b --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0012-FROMGIT-arm64-dts-meson-kvim3-move-hdmi-to-tdm-a.patch @@ -0,0 +1,76 @@ +From 68b4683a553a622e585715061327b82939b0792b Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 21 Apr 2020 16:18:14 +0200 +Subject: [PATCH 012/156] FROMGIT: arm64: dts: meson: kvim3: move hdmi to tdm a + +The tdmout b is physically routed to the 40 pin header and the tdmout c +is routed to the m2 connector. It makes these interfaces poor +candidates to handle the HDMI 8ch i2s link (2ch i2s * 4 lanes) as it would +force the same link format on the related connectors. + +Instead use the TDM A interface. This one is not routed to the outside +world on the vim3, so it can only be used for HDMI. + +Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Link: https://lore.kernel.org/r/20200421141814.639480-1-jbrunet@baylibre.com +--- + .../dts/amlogic/meson-g12b-khadas-vim3.dtsi | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 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 c6c8caed8327..224c890d32d3 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +@@ -51,11 +51,11 @@ + sound { + compatible = "amlogic,axg-sound-card"; + 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", +- "TDMOUT_B IN 2", "FRDDR_C OUT 1", +- "TDM_B Playback", "TDMOUT_B OUT"; ++ audio-aux-devs = <&tdmout_a>; ++ 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"; + + assigned-clocks = <&clkc CLKID_MPLL2>, + <&clkc CLKID_MPLL0>, +@@ -80,7 +80,7 @@ + + /* 8ch hdmi interface */ + dai-link-3 { +- sound-dai = <&tdmif_b>; ++ sound-dai = <&tdmif_a>; + dai-format = "i2s"; + dai-tdm-slot-tx-mask-0 = <1 1>; + dai-tdm-slot-tx-mask-1 = <1 1>; +@@ -89,7 +89,7 @@ + mclk-fs = <256>; + + codec { +- sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>; + }; + }; + +@@ -182,11 +182,11 @@ + status = "okay"; + }; + +-&tdmif_b { ++&tdmif_a { + status = "okay"; + }; + +-&tdmout_b { ++&tdmout_a { + status = "okay"; + }; + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0013-FROMGIT-dt-bindings-sram-Add-Amlogic-SCP-SRAM-compat.patch b/projects/Amlogic/patches/linux/amlogic-0013-FROMGIT-dt-bindings-sram-Add-Amlogic-SCP-SRAM-compat.patch new file mode 100644 index 0000000000..7dbd18d70a --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0013-FROMGIT-dt-bindings-sram-Add-Amlogic-SCP-SRAM-compat.patch @@ -0,0 +1,29 @@ +From b03284d1862da4875003a0662081eea91ec47f3c Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 26 Mar 2020 17:46:45 +0100 +Subject: [PATCH 013/156] FROMGIT: dt-bindings: sram: Add Amlogic SCP SRAM + compatibles + +Add compatibles for the Amlogic SCP SRAM memory zones. + +Signed-off-by: Neil Armstrong +--- + Documentation/devicetree/bindings/sram/sram.yaml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/sram/sram.yaml b/Documentation/devicetree/bindings/sram/sram.yaml +index 7b83cc6c9bfa..0aea3d239a48 100644 +--- a/Documentation/devicetree/bindings/sram/sram.yaml ++++ b/Documentation/devicetree/bindings/sram/sram.yaml +@@ -73,6 +73,8 @@ patternProperties: + - allwinner,sun50i-a64-sram-c + - amlogic,meson8-smp-sram + - amlogic,meson8b-smp-sram ++ - amlogic,meson-gxbb-scp-shmem ++ - amlogic,meson-axg-scp-shmem + - renesas,smp-sram + - rockchip,rk3066-smp-sram + - samsung,exynos4210-sysram +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0014-FROMGIT-arm64-defconfig-enable-meson-gx-audio-as-mod.patch b/projects/Amlogic/patches/linux/amlogic-0014-FROMGIT-arm64-defconfig-enable-meson-gx-audio-as-mod.patch new file mode 100644 index 0000000000..b7f72bf525 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0014-FROMGIT-arm64-defconfig-enable-meson-gx-audio-as-mod.patch @@ -0,0 +1,44 @@ +From aadd713ceaf3b515f04a4e8e03251b3fa11b5848 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 21 Apr 2020 18:39:30 +0200 +Subject: [PATCH 014/156] FROMGIT: arm64: defconfig: enable meson gx audio as + module + +Enable the module config for the Amlogic GX audio card. +This module will imply the internal components usually associated +with it to make a functional sound card on these platforms. + +Also enable the simple amplifier module which often used on the +output stage of those cards. + +Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Link: https://lore.kernel.org/r/20200421163935.775935-2-jbrunet@baylibre.com +--- + arch/arm64/configs/defconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig +index 03d0189f7d68..ceb60ee9c340 100644 +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -644,6 +644,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_SDM845=m + CONFIG_SND_SOC_ROCKCHIP=m + CONFIG_SND_SOC_ROCKCHIP_SPDIF=m +@@ -656,6 +657,7 @@ CONFIG_SND_SOC_AK4613=m + CONFIG_SND_SOC_ES7134=m + CONFIG_SND_SOC_ES7241=m + CONFIG_SND_SOC_PCM3168A_I2C=m ++CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m + CONFIG_SND_SOC_TAS571X=m + CONFIG_SND_SOC_WCD934X=m + CONFIG_SND_SOC_WSA881X=m +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0015-FROMGIT-arm64-dts-meson-gx-add-aiu-support.patch b/projects/Amlogic/patches/linux/amlogic-0015-FROMGIT-arm64-dts-meson-gx-add-aiu-support.patch new file mode 100644 index 0000000000..28fbccd35f --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0015-FROMGIT-arm64-dts-meson-gx-add-aiu-support.patch @@ -0,0 +1,121 @@ +From 4ce33650c52b51f1893841641e6cd8c254bb33d9 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 21 Apr 2020 18:39:31 +0200 +Subject: [PATCH 015/156] FROMGIT: arm64: dts: meson-gx: add aiu support + +Add the AIU audio device to the Amlogic GX SoC family DT. +ATM, this device provides the i2s and spdif output stages and also +the hdmi and internal codec glues. + +Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Link: https://lore.kernel.org/r/20200421163935.775935-3-jbrunet@baylibre.com +--- + arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 13 ++++++++++++ + arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 23 +++++++++++++++++++++ + arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 23 +++++++++++++++++++++ + 3 files changed, 59 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +index ea4dac8506bc..4045f51ac572 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +@@ -284,6 +284,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>; +@@ -632,6 +643,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-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +index 0cb40326b0d3..234490d3ee68 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +@@ -60,6 +60,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>; ++}; ++ + &aobus { + pinctrl_aobus: pinctrl@14 { + compatible = "amlogic,meson-gxbb-aobus-pinctrl"; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +index 259d86399390..d9f00c5a9a5c 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +@@ -49,6 +49,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-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch b/projects/Amlogic/patches/linux/amlogic-0016-FROMGIT-arm64-dts-meson-p230-q200-add-initial-audio-.patch similarity index 58% rename from packages/linux/patches/amlogic/amlogic-0056-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch rename to projects/Amlogic/patches/linux/amlogic-0016-FROMGIT-arm64-dts-meson-p230-q200-add-initial-audio-.patch index b6417a9061..4e0833bae0 100644 --- a/packages/linux/patches/amlogic/amlogic-0056-WIP-arm64-dts-meson-enable-audio-playback-on-p230-q2.patch +++ b/projects/Amlogic/patches/linux/amlogic-0016-FROMGIT-arm64-dts-meson-p230-q200-add-initial-audio-.patch @@ -1,19 +1,25 @@ -From 64aac584dd1297321a2068586e026a2ef268ed11 Mon Sep 17 00:00:00 2001 +From 9132d7f6d3753eceecd18d7e660fcffb12da9ffe 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 +Date: Tue, 21 Apr 2020 18:39:32 +0200 +Subject: [PATCH 016/156] FROMGIT: arm64: dts: meson: p230-q200: add initial + audio playback support + +Add basic audio support on the p230/q200 reference design. +This initial support is limited to HDMI i2s and SPDIF (LPCM). Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Link: https://lore.kernel.org/r/20200421163935.775935-4-jbrunet@baylibre.com --- - .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 95 +++++++++++++++++++ - 1 file changed, 95 insertions(+) + .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 63 +++++++++++++++++++ + 1 file changed, 63 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 +index 12d5e333e5f2..99c1f7f9d37e 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 @@ +@@ -8,12 +8,21 @@ * the pin-compatible S912 (GXM) or S905D (GXL) SoCs. */ @@ -25,13 +31,6 @@ index 12d5e333e5f2..f294430d6b19 100644 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"; @@ -42,7 +41,7 @@ index 12d5e333e5f2..f294430d6b19 100644 chosen { stdout-path = "serial0:115200n8"; }; -@@ -102,6 +118,85 @@ +@@ -102,6 +111,60 @@ }; }; }; @@ -50,17 +49,9 @@ index 12d5e333e5f2..f294430d6b19 100644 + 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-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -83,10 +74,6 @@ index 12d5e333e5f2..f294430d6b19 100644 + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; -+ -+ codec-1 { -+ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; -+ }; + }; + + dai-link-3 { @@ -104,22 +91,9 @@ index 12d5e333e5f2..f294430d6b19 100644 + 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>; diff --git a/packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch b/projects/Amlogic/patches/linux/amlogic-0017-FROMGIT-arm64-dts-meson-libretech-cc-add-initial-aud.patch similarity index 50% rename from packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch rename to projects/Amlogic/patches/linux/amlogic-0017-FROMGIT-arm64-dts-meson-libretech-cc-add-initial-aud.patch index a2263811cb..29f56fee99 100644 --- a/packages/linux/patches/amlogic/amlogic-0057-WIP-arm64-dts-meson-add-libretech-cc-s905x-audio-pla.patch +++ b/projects/Amlogic/patches/linux/amlogic-0017-FROMGIT-arm64-dts-meson-libretech-cc-add-initial-aud.patch @@ -1,16 +1,21 @@ -From ac340ffa549b6b52fd3d942bd9815e80ba8e0c12 Mon Sep 17 00:00:00 2001 +From 40f98dae93d648fd915d5f1c57a3f8fbe8ed708f 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 +Date: Tue, 21 Apr 2020 18:39:33 +0200 +Subject: [PATCH 017/156] FROMGIT: arm64: dts: meson: libretech-cc: add initial + audio playback support + +Add initial audio support limited to HDMI i2s. Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Link: https://lore.kernel.org/r/20200421163935.775935-5-jbrunet@baylibre.com --- - .../amlogic/meson-gxl-s905x-libretech-cc.dts | 70 +++++++++++++++++++ - 1 file changed, 70 insertions(+) + .../amlogic/meson-gxl-s905x-libretech-cc.dts | 40 +++++++++++++++++++ + 1 file changed, 40 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 +index a4a71c13891b..2b821c501065 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 @@ @@ -21,21 +26,7 @@ index e8348b2728db..7184bf509e82 100644 #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 @@ +@@ -124,6 +125,45 @@ regulator-max-microvolt = <1800000>; vin-supply = <&vcc_3v3>; }; @@ -43,15 +34,9 @@ index e8348b2728db..7184bf509e82 100644 + 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-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -65,15 +50,11 @@ index e8348b2728db..7184bf509e82 100644 + dai-link-1 { + sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; + dai-format = "i2s"; -+ mclk-fs = <512>; ++ mclk-fs = <256>; + + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; -+ -+ codec-1 { -+ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; -+ }; + }; + + dai-link-2 { @@ -83,22 +64,9 @@ index e8348b2728db..7184bf509e82 100644 + 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"; }; diff --git a/packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch b/projects/Amlogic/patches/linux/amlogic-0018-FROMGIT-arm64-dts-meson-libretech-ac-add-initial-aud.patch similarity index 50% rename from packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch rename to projects/Amlogic/patches/linux/amlogic-0018-FROMGIT-arm64-dts-meson-libretech-ac-add-initial-aud.patch index 0045a88b8c..76b9258af9 100644 --- a/packages/linux/patches/amlogic/amlogic-0058-WIP-arm64-dts-meson-add-libretech-ac-s805x-audio-pla.patch +++ b/projects/Amlogic/patches/linux/amlogic-0018-FROMGIT-arm64-dts-meson-libretech-ac-add-initial-aud.patch @@ -1,16 +1,21 @@ -From 382ebdffe4fe718f903578f875884f4112264186 Mon Sep 17 00:00:00 2001 +From 5af6823fc49037004221dd7c34128fd09824f939 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 +Date: Tue, 21 Apr 2020 18:39:34 +0200 +Subject: [PATCH 018/156] FROMGIT: arm64: dts: meson: libretech-ac: add initial + audio playback support + +Add initial audio support limited to HDMI i2s. Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Link: https://lore.kernel.org/r/20200421163935.775935-6-jbrunet@baylibre.com --- - .../amlogic/meson-gxl-s805x-libretech-ac.dts | 70 +++++++++++++++++++ - 1 file changed, 70 insertions(+) + .../amlogic/meson-gxl-s805x-libretech-ac.dts | 40 +++++++++++++++++++ + 1 file changed, 40 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 +index 4d5949496596..3f35331c1652 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 @@ @@ -21,23 +26,7 @@ index 4d5949496596..fa333fe4d968 100644 #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 @@ +@@ -105,6 +106,45 @@ vin-supply = <&vcc_3v3>; regulator-always-on; }; @@ -45,13 +34,9 @@ index 4d5949496596..fa333fe4d968 100644 + 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-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -70,10 +55,6 @@ index 4d5949496596..fa333fe4d968 100644 + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; -+ -+ codec-1 { -+ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; -+ }; + }; + + dai-link-2 { @@ -83,22 +64,9 @@ index 4d5949496596..fa333fe4d968 100644 + 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"; }; diff --git a/projects/Amlogic/patches/linux/amlogic-0019-FROMGIT-arm64-dts-meson-libretech-pc-add-initial-aud.patch b/projects/Amlogic/patches/linux/amlogic-0019-FROMGIT-arm64-dts-meson-libretech-pc-add-initial-aud.patch new file mode 100644 index 0000000000..4f1204c8e8 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0019-FROMGIT-arm64-dts-meson-libretech-pc-add-initial-aud.patch @@ -0,0 +1,77 @@ +From 45baf9b9d199f17bf4e5eb3ad0da6968e30bde9e Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Tue, 21 Apr 2020 18:39:35 +0200 +Subject: [PATCH 019/156] FROMGIT: arm64: dts: meson: libretech-pc: add initial + audio playback support + +Add initial audio support limited to HDMI i2s. + +Signed-off-by: Jerome Brunet +Signed-off-by: Kevin Hilman +Tested-by: Christian Hewitt +Link: https://lore.kernel.org/r/20200421163935.775935-7-jbrunet@baylibre.com +--- + .../dts/amlogic/meson-gx-libretech-pc.dtsi | 40 +++++++++++++++++++ + 1 file changed, 40 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 b1da36fdeac6..4cc5f3df5677 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 { +@@ -175,6 +176,45 @@ + regulator-settling-time-up-us = <200>; + regulator-settling-time-down-us = <50000>; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXL-LIBRETECH-S9XX-PC"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ 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/projects/Amlogic/patches/linux/amlogic-0020-FROMGIT-drm-bridge-dw-hdmi-Add-support-for-RGB-limit.patch b/projects/Amlogic/patches/linux/amlogic-0020-FROMGIT-drm-bridge-dw-hdmi-Add-support-for-RGB-limit.patch new file mode 100644 index 0000000000..c609c1c351 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0020-FROMGIT-drm-bridge-dw-hdmi-Add-support-for-RGB-limit.patch @@ -0,0 +1,134 @@ +From 274f0a22be97107589d444a3bbb6bcf53ceec2eb Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Thu, 14 May 2020 11:32:27 +0000 +Subject: [PATCH 020/156] FROMGIT: drm/bridge: dw-hdmi: Add support for RGB + limited range + +CEA 861 standard requestis that RGB quantization range is "limited" for +CEA modes. Support that by adding CSC matrix which downscales values. + +This allows 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. + +Reviewed-by: Laurent Pinchart +Signed-off-by: Jernej Skrabec +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 63 +++++++++++++++++------ + 1 file changed, 46 insertions(+), 17 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 383b1073d7de..b8f6ecd4fbeb 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_full_to_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 { +@@ -956,7 +963,11 @@ 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->hdmi_data.enc_in_bus_format != ++ hdmi->hdmi_data.enc_out_bus_format) || ++ (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) +@@ -986,25 +997,27 @@ static int is_color_space_interpolation(struct dw_hdmi *hdmi) + static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi) + { + const u16 (*csc_coeff)[3][4] = &csc_coeff_default; ++ bool is_input_rgb, is_output_rgb; + unsigned i; + u32 csc_scale = 1; + +- if (is_color_space_conversion(hdmi)) { +- if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { +- if (hdmi->hdmi_data.enc_out_encoding == +- V4L2_YCBCR_ENC_601) +- csc_coeff = &csc_coeff_rgb_out_eitu601; +- else +- csc_coeff = &csc_coeff_rgb_out_eitu709; +- } else if (hdmi_bus_fmt_is_rgb( +- hdmi->hdmi_data.enc_in_bus_format)) { +- if (hdmi->hdmi_data.enc_out_encoding == +- V4L2_YCBCR_ENC_601) +- csc_coeff = &csc_coeff_rgb_in_eitu601; +- else +- csc_coeff = &csc_coeff_rgb_in_eitu709; +- csc_scale = 0; +- } ++ is_input_rgb = hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_in_bus_format); ++ is_output_rgb = hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format); ++ ++ if (!is_input_rgb && is_output_rgb) { ++ if (hdmi->hdmi_data.enc_out_encoding == V4L2_YCBCR_ENC_601) ++ csc_coeff = &csc_coeff_rgb_out_eitu601; ++ else ++ csc_coeff = &csc_coeff_rgb_out_eitu709; ++ } else if (is_input_rgb && !is_output_rgb) { ++ if (hdmi->hdmi_data.enc_out_encoding == V4L2_YCBCR_ENC_601) ++ csc_coeff = &csc_coeff_rgb_in_eitu601; ++ else ++ csc_coeff = &csc_coeff_rgb_in_eitu709; ++ csc_scale = 0; ++ } else if (is_input_rgb && is_output_rgb && ++ hdmi->hdmi_data.rgb_limited_range) { ++ csc_coeff = &csc_coeff_rgb_full_to_rgb_limited; + } + + /* The CSC registers are sequential, alternating MSB then LSB */ +@@ -1614,6 +1627,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)) +@@ -2119,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/projects/Amlogic/patches/linux/amlogic-0021-FROMGIT-drm-bridge-dw-hdmi-rework-csc-related-functi.patch b/projects/Amlogic/patches/linux/amlogic-0021-FROMGIT-drm-bridge-dw-hdmi-rework-csc-related-functi.patch new file mode 100644 index 0000000000..3ed63b6340 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0021-FROMGIT-drm-bridge-dw-hdmi-rework-csc-related-functi.patch @@ -0,0 +1,89 @@ +From ace2c05e270e103e3e026169a987ee7a6a0730b1 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Thu, 14 May 2020 11:33:19 +0000 +Subject: [PATCH 021/156] FROMGIT: drm/bridge: dw-hdmi: rework csc related + functions + +is_color_space_conversion() is a misnomer. It checks not only if color +space conversion is needed, but also if format conversion is needed. +This is actually desired behaviour because result of this function +determines if CSC block should be enabled or not (CSC block can also do +format conversion). + +In order to clear misunderstandings, let's rework +is_color_space_conversion() to do exactly what is supposed to do and add +another function which will determine if CSC block must be enabled or +not. + +Reviewed-by: Laurent Pinchart +Signed-off-by: Jernej Skrabec +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 31 +++++++++++++++-------- + 1 file changed, 21 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index b8f6ecd4fbeb..512398dbeb76 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -963,11 +963,14 @@ 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) || +- (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); ++ struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; ++ bool is_input_rgb, is_output_rgb; ++ ++ is_input_rgb = hdmi_bus_fmt_is_rgb(hdmi_data->enc_in_bus_format); ++ is_output_rgb = hdmi_bus_fmt_is_rgb(hdmi_data->enc_out_bus_format); ++ ++ return (is_input_rgb != is_output_rgb) || ++ (is_input_rgb && is_output_rgb && hdmi_data->rgb_limited_range); + } + + static int is_color_space_decimation(struct dw_hdmi *hdmi) +@@ -994,6 +997,13 @@ static int is_color_space_interpolation(struct dw_hdmi *hdmi) + return 0; + } + ++static bool is_csc_needed(struct dw_hdmi *hdmi) ++{ ++ return is_color_space_conversion(hdmi) || ++ is_color_space_decimation(hdmi) || ++ is_color_space_interpolation(hdmi); ++} ++ + static void dw_hdmi_update_csc_coeffs(struct dw_hdmi *hdmi) + { + const u16 (*csc_coeff)[3][4] = &csc_coeff_default; +@@ -2035,18 +2045,19 @@ 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_csc_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)) + hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_IN_PATH, + HDMI_MC_FLOWCTRL); +- else ++ } else { ++ hdmi->mc_clkdis |= HDMI_MC_CLKDIS_CSCCLK_DISABLE; ++ hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); ++ + hdmi_writeb(hdmi, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_BYPASS, + HDMI_MC_FLOWCTRL); ++ } + } + + /* Workaround to clear the overflow condition */ +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0022-FROMGIT-dt-bindings-arm-amlogic-add-odroid-c4-bindin.patch b/projects/Amlogic/patches/linux/amlogic-0022-FROMGIT-dt-bindings-arm-amlogic-add-odroid-c4-bindin.patch new file mode 100644 index 0000000000..daa4a79305 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0022-FROMGIT-dt-bindings-arm-amlogic-add-odroid-c4-bindin.patch @@ -0,0 +1,28 @@ +From e31983aff5f3e77ac4ef9c67df06b0327a941ff9 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 04:02:47 +0000 +Subject: [PATCH 022/156] FROMGIT: dt-bindings: arm: amlogic: add odroid-c4 + bindings + +Add the board bindings for the Hardkernel Odroid-C4 single board computer. + +Signed-off-by: Neil Armstrong +--- + 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..11908b151e0a 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -159,6 +159,7 @@ properties: + - enum: + - seirobotics,sei610 + - khadas,vim3l ++ - hardkernel,odroid-c4 + - const: amlogic,sm1 + + - description: Boards with the Amlogic Meson A1 A113L SoC +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0023-FROMGIT-arm64-dts-meson-sm1-add-support-for-Hardkern.patch b/projects/Amlogic/patches/linux/amlogic-0023-FROMGIT-arm64-dts-meson-sm1-add-support-for-Hardkern.patch new file mode 100644 index 0000000000..d836f18a86 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0023-FROMGIT-arm64-dts-meson-sm1-add-support-for-Hardkern.patch @@ -0,0 +1,440 @@ +From 6055acd420bf7e12b70ea56a79c7a7f9dfef7b07 Mon Sep 17 00:00:00 2001 +From: Dongjin Kim +Date: Wed, 13 May 2020 04:04:11 +0000 +Subject: [PATCH 023/156] FROMGIT: arm64: dts: meson-sm1: add support for + Hardkernel ODROID-C4 + +Add the board support for the Hardkernel Odroid-C4 single board computer. + +The Odroid-C4 is the Odroid-C2 successor with same form factor, but using +a modern Amlogic S905X3 (SM1) SoC and 4x USB3 ports. + +Signed-off-by: Dongjin Kim +Signed-off-by: Neil Armstrong +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 402 ++++++++++++++++++ + 2 files changed, 403 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index eef0045320f2..5daab72f5639 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -40,4 +40,5 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-s912-libretech-pc.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +new file mode 100644 +index 000000000000..00d90b30f8b4 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +@@ -0,0 +1,402 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2020 Dongjin Kim ++ */ ++ ++/dts-v1/; ++ ++#include "meson-sm1.dtsi" ++#include ++#include ++ ++/ { ++ compatible = "hardkernel,odroid-c4", "amlogic,sm1"; ++ model = "Hardkernel ODROID-C4"; ++ ++ aliases { ++ serial0 = &uart_AO; ++ ethernet0 = ðmac; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++ ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-blue { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ panic-indicator; ++ }; ++ }; ++ ++ tflash_vdd: regulator-tflash_vdd { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "TFLASH_VDD"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ gpio = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ regulator-always-on; ++ }; ++ ++ tf_io: gpio-regulator-tf_io { ++ compatible = "regulator-gpio"; ++ ++ regulator-name = "TF_IO"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ ++ gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; ++ gpios-states = <0>; ++ ++ states = <3300000 0>, ++ <1800000 1>; ++ }; ++ ++ flash_1v8: regulator-flash_1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "FLASH_1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_3v3>; ++ regulator-always-on; ++ }; ++ ++ main_12v: regulator-main_12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "12V"; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ regulator-always-on; ++ }; ++ ++ vcc_5v: regulator-vcc_5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ vin-supply = <&main_12v>; ++ }; ++ ++ vcc_1v8: regulator-vcc_1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_3v3>; ++ regulator-always-on; ++ }; ++ ++ vcc_3v3: regulator-vcc_3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vddao_3v3>; ++ regulator-always-on; ++ /* FIXME: actually controlled by VDDCPU_B_EN */ ++ }; ++ ++ vddcpu: 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; ++ }; ++ ++ hub_5v: regulator-hub_5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "HUB_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_5v>; ++ ++ /* Connected to the Hub CHIPENABLE, LOW sets low power state */ ++ gpio = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ }; ++ ++ usb_pwr_en: regulator-usb_pwr_en { ++ compatible = "regulator-fixed"; ++ regulator-name = "USB_PWR_EN"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_5v>; ++ ++ /* Connected to the microUSB port power enable */ ++ gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ }; ++ ++ vddao_1v8: regulator-vddao_1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDAO_1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vddao_3v3>; ++ regulator-always-on; ++ }; ++ ++ vddao_3v3: regulator-vddao_3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDAO_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&main_12v>; ++ regulator-always-on; ++ }; ++ ++ hdmi-connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++}; ++ ++&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>; ++}; ++ ++&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>; ++}; ++ ++&gpio { ++ gpio-line-names = ++ /* GPIOZ */ ++ "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", "", "", ++ /* GPIOH */ ++ "", "", "", "", "", ++ "PIN_36", /* GPIOH_5 */ ++ "PIN_26", /* GPIOH_6 */ ++ "PIN_32", /* GPIOH_7 */ ++ "", ++ /* BOOT */ ++ "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", "", "", ++ /* GPIOC */ ++ "", "", "", "", "", "", "", "", ++ /* GPIOA */ ++ "", "", "", "", "", "", "", "", ++ "", "", "", "", "", "", ++ "PIN_27", /* GPIOA_14 */ ++ "PIN_28", /* GPIOA_15 */ ++ /* GPIOX */ ++ "PIN_16", /* GPIOX_0 */ ++ "PIN_18", /* GPIOX_1 */ ++ "PIN_22", /* GPIOX_2 */ ++ "PIN_11", /* GPIOX_3 */ ++ "PIN_13", /* GPIOX_4 */ ++ "PIN_7", /* GPIOX_5 */ ++ "PIN_33", /* GPIOX_6 */ ++ "PIN_15", /* GPIOX_7 */ ++ "PIN_19", /* GPIOX_8 */ ++ "PIN_21", /* GPIOX_9 */ ++ "PIN_24", /* GPIOX_10 */ ++ "PIN_23", /* GPIOX_11 */ ++ "PIN_8", /* GPIOX_12 */ ++ "PIN_10", /* GPIOX_13 */ ++ "PIN_29", /* GPIOX_14 */ ++ "PIN_31", /* GPIOX_15 */ ++ "PIN_12", /* GPIOX_16 */ ++ "PIN_3", /* GPIOX_17 */ ++ "PIN_5", /* GPIOX_18 */ ++ "PIN_35"; /* GPIOX_19 */ ++ ++ /* ++ * WARNING: The USB Hub on the Odroid-C4 needs a reset signal ++ * to be turned high in order to be detected by the USB Controller ++ * This signal should be handled by a USB specific power sequence ++ * in order to reset the Hub when USB bus is powered down. ++ */ ++ usb-hub { ++ gpio-hog; ++ gpios = ; ++ output-high; ++ line-name = "usb-hub-reset"; ++ }; ++}; ++ ++&gpio_ao { ++ gpio-line-names = ++ /* GPIOAO */ ++ "", "", "", "", ++ "PIN_47", /* GPIOAO_4 */ ++ "", "", ++ "PIN_45", /* GPIOAO_7 */ ++ "PIN_46", /* GPIOAO_8 */ ++ "PIN_44", /* GPIOAO_9 */ ++ "PIN_42", /* GPIOAO_10 */ ++ "", ++ /* GPIOE */ ++ "", "", ""; ++}; ++ ++&hdmi_tx { ++ status = "okay"; ++ pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; ++ pinctrl-names = "default"; ++ hdmi-supply = <&vcc_5v>; ++}; ++ ++&hdmi_tx_tmds_port { ++ hdmi_tx_tmds_out: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&ir { ++ status = "okay"; ++ pinctrl-0 = <&remote_input_ao_pins>; ++ pinctrl-names = "default"; ++ linux,rc-map-name = "rc-odroid"; ++}; ++ ++&pwm_AO_cd { ++ pinctrl-0 = <&pwm_ao_d_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin1"; ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++/* SD card */ ++&sd_emmc_b { ++ status = "okay"; ++ pinctrl-0 = <&sdcard_c_pins>; ++ pinctrl-1 = <&sdcard_clk_gate_c_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <4>; ++ cap-sd-highspeed; ++ max-frequency = <200000000>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ disable-wp; ++ ++ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; ++ vmmc-supply = <&tflash_vdd>; ++ vqmmc-supply = <&tf_io>; ++}; ++ ++/* eMMC */ ++&sd_emmc_c { ++ status = "okay"; ++ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; ++ pinctrl-1 = <&emmc_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-ddr-1_8v; ++ mmc-hs200-1_8v; ++ max-frequency = <200000000>; ++ disable-wp; ++ ++ mmc-pwrseq = <&emmc_pwrseq>; ++ vmmc-supply = <&vcc_3v3>; ++ vqmmc-supply = <&flash_1v8>; ++}; ++ ++&uart_AO { ++ status = "okay"; ++ pinctrl-0 = <&uart_ao_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&usb { ++ status = "okay"; ++ vbus-supply = <&usb_pwr_en>; ++}; ++ ++&usb2_phy0 { ++ phy-supply = <&vcc_5v>; ++}; ++ ++&usb2_phy1 { ++ /* Enable the hub which is connected to this port */ ++ phy-supply = <&hub_5v>; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0024-FROMGIT-arm64-dts-meson-g12b-move-G12B-thermal-nodes.patch b/projects/Amlogic/patches/linux/amlogic-0024-FROMGIT-arm64-dts-meson-g12b-move-G12B-thermal-nodes.patch new file mode 100644 index 0000000000..fb96048f39 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0024-FROMGIT-arm64-dts-meson-g12b-move-G12B-thermal-nodes.patch @@ -0,0 +1,82 @@ +From 7c1c1d86645c337d0f3d32e90abe557bfde9b093 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 06:53:19 +0000 +Subject: [PATCH 024/156] FROMGIT: arm64: dts: meson-g12b: move G12B thermal + nodes to meson-g12b.dtsi + +The G12B thermal nodes should be in the meson-g12b.dtsi file. + +Fixes: 195f140318a9 ("arm64: dts: meson: g12b: add cooling properties") +Signed-off-by: Neil Armstrong +--- + arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 23 --------------------- + arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 22 ++++++++++++++++++++ + 2 files changed, 22 insertions(+), 23 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +index 55d39020ec72..f5a4bc819247 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +@@ -354,29 +354,6 @@ + }; + }; + +-&cpu_thermal { +- cooling-maps { +- map0 { +- trip = <&cpu_passive>; +- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; +- }; +- map1 { +- trip = <&cpu_hot>; +- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; +- }; +- }; +-}; +- + ðmac { + power-domains = <&pwrc PWRC_G12A_ETH_ID>; + }; +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi +index 6dbc3968045b..9b8548e5f6e5 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi +@@ -113,3 +113,25 @@ + compatible = "amlogic,g12b-clkc"; + }; + ++&cpu_thermal { ++ cooling-maps { ++ map0 { ++ trip = <&cpu_passive>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; ++ map1 { ++ trip = <&cpu_hot>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; ++ }; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0025-FROMGIT-arm64-dts-meson-sm1-add-cpu-thermal-nodes.patch b/projects/Amlogic/patches/linux/amlogic-0025-FROMGIT-arm64-dts-meson-sm1-add-cpu-thermal-nodes.patch new file mode 100644 index 0000000000..b1918dd5a3 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0025-FROMGIT-arm64-dts-meson-sm1-add-cpu-thermal-nodes.patch @@ -0,0 +1,79 @@ +From c1f1a4675a0b6d121c952eea2edbe9b34081fbe6 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 06:54:09 +0000 +Subject: [PATCH 025/156] FROMGIT: arm64: dts: meson-sm1: add cpu thermal nodes + +Add thermal nodes for the Amlogic SM1 SoCs based on the G12A and G12B +thermal nodes. + +Signed-off-by: Neil Armstrong +--- + arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 24 ++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +index d4ec735fb1a5..71317f5aada1 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +@@ -56,6 +56,7 @@ + reg = <0x0 0x0>; + enable-method = "psci"; + next-level-cache = <&l2>; ++ #cooling-cells = <2>; + }; + + cpu1: cpu@1 { +@@ -64,6 +65,7 @@ + reg = <0x0 0x1>; + enable-method = "psci"; + next-level-cache = <&l2>; ++ #cooling-cells = <2>; + }; + + cpu2: cpu@2 { +@@ -72,6 +74,7 @@ + reg = <0x0 0x2>; + enable-method = "psci"; + next-level-cache = <&l2>; ++ #cooling-cells = <2>; + }; + + cpu3: cpu@3 { +@@ -80,6 +83,7 @@ + reg = <0x0 0x3>; + enable-method = "psci"; + next-level-cache = <&l2>; ++ #cooling-cells = <2>; + }; + + l2: l2-cache0 { +@@ -466,6 +470,26 @@ + compatible = "amlogic,sm1-clkc"; + }; + ++&cpu_thermal { ++ cooling-maps { ++ map0 { ++ trip = <&cpu_passive>; ++ 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>; ++ }; ++ ++ map1 { ++ trip = <&cpu_hot>; ++ 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>; ++ }; ++ }; ++}; ++ + ðmac { + power-domains = <&pwrc PWRC_SM1_ETH_ID>; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0026-FROMGIT-arm64-dts-meson-gxl-add-acodec-support.patch b/projects/Amlogic/patches/linux/amlogic-0026-FROMGIT-arm64-dts-meson-gxl-add-acodec-support.patch new file mode 100644 index 0000000000..22ccefb1c0 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0026-FROMGIT-arm64-dts-meson-gxl-add-acodec-support.patch @@ -0,0 +1,37 @@ +From 358f6d732c3032cc33991d39c3d9c69723ae9383 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 13 May 2020 07:17:31 +0000 +Subject: [PATCH 026/156] FROMGIT: arm64: dts: meson: gxl: add acodec support + +Add the internal audio DAC to the gxl SoC DT + +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +index d9f00c5a9a5c..4e0d8ef97f99 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +@@ -37,6 +37,17 @@ + }; + }; + ++ 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"; ++ }; ++ + crypto: crypto@c883e000 { + compatible = "amlogic,gxl-crypto"; + reg = <0x0 0xc883e000 0x0 0x36>; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0027-FROMGIT-arm64-dts-meson-p230-q200-add-internal-DAC-s.patch b/projects/Amlogic/patches/linux/amlogic-0027-FROMGIT-arm64-dts-meson-p230-q200-add-internal-DAC-s.patch new file mode 100644 index 0000000000..6cd3b0e84a --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0027-FROMGIT-arm64-dts-meson-p230-q200-add-internal-DAC-s.patch @@ -0,0 +1,85 @@ +From 268e19c0f927b6dc83b549f0458b3e2f0d6127f4 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 13 May 2020 07:18:27 +0000 +Subject: [PATCH 027/156] FROMGIT: arm64: dts: meson: p230-q200: add internal + DAC support + +Add the necessary bits to support the internal audio DAC the p230/q200 +reference design derivated boards. The output of this DAC is provided +on the 3.5mm jack connector + +Signed-off-by: Jerome Brunet +--- + .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 32 +++++++++++++++++++ + 1 file changed, 32 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 99c1f7f9d37e..358728f1ee93 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +@@ -16,6 +16,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>; ++ }; ++ + spdif_dit: audio-codec-0 { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; +@@ -115,6 +122,14 @@ + 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_MPLL0>, + <&clkc CLKID_MPLL1>, + <&clkc CLKID_MPLL2>; +@@ -140,6 +155,10 @@ + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; + }; + + dai-link-3 { +@@ -157,9 +176,22 @@ + 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>; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0028-FROMGIT-arm64-dts-meson-libretech-cc-add-internal-DA.patch b/projects/Amlogic/patches/linux/amlogic-0028-FROMGIT-arm64-dts-meson-libretech-cc-add-internal-DA.patch new file mode 100644 index 0000000000..7891d657fd --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0028-FROMGIT-arm64-dts-meson-libretech-cc-add-internal-DA.patch @@ -0,0 +1,82 @@ +From bc8d9a3ec6b9e18fbc8829f2a409f430e8800338 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 13 May 2020 07:19:24 +0000 +Subject: [PATCH 028/156] FROMGIT: arm64: dts: meson: libretech-cc: add + internal DAC support + +Add the internal DAC support on the libretech CC. The output of this +DAC is provided on the 3.5mm jack connector. + +Signed-off-by: Jerome Brunet +--- + .../amlogic/meson-gxl-s905x-libretech-cc.dts | 30 +++++++++++++++++++ + 1 file changed, 30 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 2b821c501065..785c72319551 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 +@@ -22,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"; + }; +@@ -129,6 +136,12 @@ + 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_MPLL0>, + <&clkc CLKID_MPLL1>, + <&clkc CLKID_MPLL2>; +@@ -150,6 +163,10 @@ + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; + }; + + dai-link-2 { +@@ -159,9 +176,22 @@ + 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"; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0029-FROMGIT-arm64-dts-meson-libretech-ac-add-internal-DA.patch b/projects/Amlogic/patches/linux/amlogic-0029-FROMGIT-arm64-dts-meson-libretech-ac-add-internal-DA.patch new file mode 100644 index 0000000000..0ad1b97040 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0029-FROMGIT-arm64-dts-meson-libretech-ac-add-internal-DA.patch @@ -0,0 +1,82 @@ +From 930dcfee8439e97981e6d05a79f39aa768532a8e Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 13 May 2020 07:20:23 +0000 +Subject: [PATCH 029/156] FROMGIT: arm64: dts: meson: libretech-ac: add + internal DAC support + +Add the internal DAC support on the libretech CC. The output of this +DAC is provided on the 9J5 connector. + +Signed-off-by: Jerome Brunet +--- + .../amlogic/meson-gxl-s805x-libretech-ac.dts | 30 +++++++++++++++++++ + 1 file changed, 30 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 3f35331c1652..63bdc0407eea 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 +@@ -98,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"; +@@ -110,6 +119,10 @@ + 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_MPLL0>, + <&clkc CLKID_MPLL1>, + <&clkc CLKID_MPLL2>; +@@ -131,6 +144,10 @@ + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; + }; + + dai-link-2 { +@@ -140,9 +157,22 @@ + 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"; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0030-FROMGIT-arm64-dts-meson-libretech-pc-add-internal-DA.patch b/projects/Amlogic/patches/linux/amlogic-0030-FROMGIT-arm64-dts-meson-libretech-pc-add-internal-DA.patch new file mode 100644 index 0000000000..c229ea3a06 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0030-FROMGIT-arm64-dts-meson-libretech-pc-add-internal-DA.patch @@ -0,0 +1,83 @@ +From fc4b8fed5cc950d9ef07a4b4894a9d60a7393510 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 13 May 2020 07:21:28 +0000 +Subject: [PATCH 030/156] FROMGIT: arm64: dts: meson: libretech-pc: add + internal DAC support + +Add the internal DAC support on the libretech CC. The output of this +DAC is provided on the 9J4 connector. + +Signed-off-by: Jerome Brunet +--- + .../dts/amlogic/meson-gx-libretech-pc.dtsi | 31 +++++++++++++++++++ + 1 file changed, 31 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 4cc5f3df5677..0967d1f4820e 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi +@@ -30,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"; + }; +@@ -180,6 +187,13 @@ + 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_MPLL0>, + <&clkc CLKID_MPLL1>, + <&clkc CLKID_MPLL2>; +@@ -201,6 +215,10 @@ + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; ++ ++ codec-1 { ++ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; ++ }; + }; + + dai-link-2 { +@@ -210,9 +228,22 @@ + 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"; + }; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch b/projects/Amlogic/patches/linux/amlogic-0031-FROMGIT-arm64-dts-meson-g12-add-internal-DAC.patch similarity index 76% rename from packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch rename to projects/Amlogic/patches/linux/amlogic-0031-FROMGIT-arm64-dts-meson-g12-add-internal-DAC.patch index 6c09bd6338..8ee17c21fb 100644 --- a/packages/linux/patches/amlogic/amlogic-0052-WIP-arm64-dts-meson-g12a-add-internal-DAC.patch +++ b/projects/Amlogic/patches/linux/amlogic-0031-FROMGIT-arm64-dts-meson-g12-add-internal-DAC.patch @@ -1,7 +1,9 @@ -From b4d80dcfea159d373f068a0aa74d93183b2aecc0 Mon Sep 17 00:00:00 2001 +From 27b512b569ec9ed7a2912e079b241cc622b48401 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 +Date: Wed, 13 May 2020 07:22:26 +0000 +Subject: [PATCH 031/156] FROMGIT: arm64: dts: meson: g12: add internal DAC + +Add internal audio DAC support on the g12 and sm1 SoC family Signed-off-by: Jerome Brunet --- @@ -9,7 +11,7 @@ Signed-off-by: Jerome Brunet 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 +index 0a625ad14712..9eaa452ce07a 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 @@ diff --git a/projects/Amlogic/patches/linux/amlogic-0032-FROMGIT-arm64-dts-meson-g12-add-internal-DAC-glue.patch b/projects/Amlogic/patches/linux/amlogic-0032-FROMGIT-arm64-dts-meson-g12-add-internal-DAC-glue.patch new file mode 100644 index 0000000000..b0803560d4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0032-FROMGIT-arm64-dts-meson-g12-add-internal-DAC-glue.patch @@ -0,0 +1,38 @@ +From fd12e659a2fbebe5c6bd7c9ff64de7bbb59964b7 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 13 May 2020 07:23:20 +0000 +Subject: [PATCH 032/156] FROMGIT: arm64: dts: meson: g12: add internal DAC + glue + +Add the internal DAC glue support on the g12 and sm1 family +This glue connects the different TDM interfaces of the SoC to +the internal audio DAC codec. + +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +index f5a4bc819247..6a1f4dcf6488 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>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch b/projects/Amlogic/patches/linux/amlogic-0033-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch similarity index 74% rename from packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch rename to projects/Amlogic/patches/linux/amlogic-0033-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch index 9af3e028e2..5b4189aa3c 100644 --- a/packages/linux/patches/amlogic/amlogic-0008-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch +++ b/projects/Amlogic/patches/linux/amlogic-0033-FROMGIT-dt-bindings-reset-meson-add-gxl-internal-dac.patch @@ -1,14 +1,12 @@ -From bfbcca83970e75e1231347f1693e0884b17bec98 Mon Sep 17 00:00:00 2001 +From 9b4ac4cdf9f313e4d1000dc64ef9437d9fedc381 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 +Date: Wed, 13 May 2020 07:24:51 +0000 +Subject: [PATCH 033/156] 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/packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch b/projects/Amlogic/patches/linux/amlogic-0034-FROMGIT-dt-bindings-add-vendor-prefix-for-Smartlabs-.patch similarity index 79% rename from packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch rename to projects/Amlogic/patches/linux/amlogic-0034-FROMGIT-dt-bindings-add-vendor-prefix-for-Smartlabs-.patch index 6465d5127e..f87c971a39 100644 --- a/packages/linux/patches/amlogic/amlogic-0125-FROMLIST-dt-bindings-add-vendor-prefix-for-Smartlabs.patch +++ b/projects/Amlogic/patches/linux/amlogic-0034-FROMGIT-dt-bindings-add-vendor-prefix-for-Smartlabs-.patch @@ -1,8 +1,8 @@ -From a2e2208abbb5cc9b65432626c57d593e92f5ffd9 Mon Sep 17 00:00:00 2001 +From 7a909e686b3697106302dffaf6298ca4a35de447 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 +Subject: [PATCH 034/156] FROMGIT: dt-bindings: add vendor prefix for Smartlabs + LLC Smartlabs LLC are a professional integrator of Interactive TV solutions and IPTV/VOD devices [1]. @@ -15,10 +15,10 @@ Signed-off-by: Christian Hewitt 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 +index d3891386d671..a0adda624fc4 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml -@@ -901,6 +901,8 @@ patternProperties: +@@ -936,6 +936,8 @@ patternProperties: description: Sitronix Technology Corporation "^skyworks,.*": description: Skyworks Solutions, Inc. diff --git a/packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch b/projects/Amlogic/patches/linux/amlogic-0035-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch similarity index 87% rename from packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch rename to projects/Amlogic/patches/linux/amlogic-0035-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch index d6b92432d6..121927d690 100644 --- a/packages/linux/patches/amlogic/amlogic-0126-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch +++ b/projects/Amlogic/patches/linux/amlogic-0035-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch @@ -1,7 +1,7 @@ -From 9ec6b55b58f139de946d00bac39e0b650da1f476 Mon Sep 17 00:00:00 2001 +From a66c639c8a4503663b43f0275b67e79624ae9ddf 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 +Subject: [PATCH 035/156] FROMGIT: 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 @@ -27,7 +27,7 @@ Signed-off-by: Christian Hewitt 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 +index 11908b151e0a..47badda69ef5 100644 --- a/Documentation/devicetree/bindings/arm/amlogic.yaml +++ b/Documentation/devicetree/bindings/arm/amlogic.yaml @@ -107,6 +107,7 @@ properties: diff --git a/projects/Amlogic/patches/linux/amlogic-0036-FROMGIT-arm64-dts-meson-add-support-for-the-Smartlab.patch b/projects/Amlogic/patches/linux/amlogic-0036-FROMGIT-arm64-dts-meson-add-support-for-the-Smartlab.patch new file mode 100644 index 0000000000..a35b165b2c --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0036-FROMGIT-arm64-dts-meson-add-support-for-the-Smartlab.patch @@ -0,0 +1,122 @@ +From 90ae363f4e28aa8ebb8eadd8edf21854080bd3f5 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 28 Feb 2020 19:16:35 +0000 +Subject: [PATCH 036/156] FROMGIT: arm64: dts: meson: add support for the + Smartlabs SML-5442TW + +The Smartlabs SML-5442TW is based on the Amlogic 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 +- QCA9377 instead of the usual Ampak/Broadcom module + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../dts/amlogic/meson-gxl-s905d-sml5442tw.dts | 80 +++++++++++++++++++ + 2 files changed, 81 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 5daab72f5639..af883e0bfb9c 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..8509f615a604 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts +@@ -0,0 +1,80 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) Christian Hewitt ++ */ ++ ++/dts-v1/; ++ ++#include "meson-gxl-s905d.dtsi" ++#include "meson-gx-p23x-q20x.dtsi" ++#include ++ ++/ { ++ compatible = "smartlabs,sml5442tw", "amlogic,s905d", "amlogic,meson-gxl"; ++ model = "SmartLabs SML-5442TW"; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ yellow { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ ++ blue { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ ++ green { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ ++ red { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; ++ default-state = "off"; ++ }; ++ }; ++}; ++ ++ðmac { ++ status = "okay"; ++ phy-mode = "rmii"; ++ phy-handle = <&internal_phy>; ++}; ++ ++&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"; ++}; ++ ++/* 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; ++ ++ bluetooth { ++ compatible = "qcom,qca9377-bt"; ++ enable-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-0138-WIP-arm64-dts-meson-wetek-fix-ethmac-node-probing.patch b/projects/Amlogic/patches/linux/amlogic-0037-FROMGIT-arm64-dts-meson-add-ethernet-interrupt-to-we.patch similarity index 70% rename from packages/linux/patches/amlogic/amlogic-0138-WIP-arm64-dts-meson-wetek-fix-ethmac-node-probing.patch rename to projects/Amlogic/patches/linux/amlogic-0037-FROMGIT-arm64-dts-meson-add-ethernet-interrupt-to-we.patch index 6b4b3ffe0b..b88512f555 100644 --- a/packages/linux/patches/amlogic/amlogic-0138-WIP-arm64-dts-meson-wetek-fix-ethmac-node-probing.patch +++ b/projects/Amlogic/patches/linux/amlogic-0037-FROMGIT-arm64-dts-meson-add-ethernet-interrupt-to-we.patch @@ -1,11 +1,11 @@ -From ce776476866587792517f6f51ec71ef41aede64b Mon Sep 17 00:00:00 2001 +From a09cbc00673c29b8f69573b012573ef0e45adcf0 Mon Sep 17 00:00:00 2001 From: Christian Hewitt Date: Tue, 7 Jan 2020 04:37:57 +0000 -Subject: [PATCH 138/146] WIP: arm64: dts: meson: wetek: fix ethmac node - probing +Subject: [PATCH 037/156] FROMGIT: arm64: dts: meson: add ethernet interrupt to + wetek dtsi -Mainline u-boot fails to probe Ethernet on WeTek Play2 so add interrupt -details to correct this (cribed from NanoPi K2). +Add Ethernet interrupt details to the WeTek Hub/Play2 dtsi to resolve +an issue with Ethernet probing in mainline u-boot. Signed-off-by: Christian Hewitt --- @@ -13,7 +13,7 @@ Signed-off-by: Christian Hewitt 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 +index d6133af09d64..ad812854a107 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 @@ diff --git a/projects/Amlogic/patches/linux/amlogic-0038-FROMGIT-arm64-dts-meson-convert-ugoos-am6-to-common-.patch b/projects/Amlogic/patches/linux/amlogic-0038-FROMGIT-arm64-dts-meson-convert-ugoos-am6-to-common-.patch new file mode 100644 index 0000000000..a1a91e923d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0038-FROMGIT-arm64-dts-meson-convert-ugoos-am6-to-common-.patch @@ -0,0 +1,915 @@ +From ce220c323922e69c562f82a727fd6a3d03a18258 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 17 Apr 2020 03:59:13 +0000 +Subject: [PATCH 038/156] FROMGIT: arm64: dts: meson: convert ugoos-am6 to + common w400 dtsi + +Convert the Ugoos AM6 dts into meson-g12b-w400.dtsi, and then create +a new AM6 dts that references it. This is in preparation for several +new G12B devices that will share the common w400 dtsi. + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 410 +---------------- + .../boot/dts/amlogic/meson-g12b-w400.dtsi | 423 ++++++++++++++++++ + 2 files changed, 424 insertions(+), 409 deletions(-) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi + +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 fdaacfd96b97..73637de80c21 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts +@@ -7,42 +7,13 @@ + + /dts-v1/; + +-#include "meson-g12b.dtsi" +-#include "meson-g12b-s922x.dtsi" +-#include +-#include ++#include "meson-g12b-w400.dtsi" + #include + + / { + compatible = "ugoos,am6", "amlogic,s922x", "amlogic,g12b"; + model = "Ugoos AM6"; + +- aliases { +- serial0 = &uart_AO; +- ethernet0 = ðmac; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- }; +- +- memory@0 { +- device_type = "memory"; +- reg = <0x0 0x0 0x0 0x40000000>; +- }; +- +- emmc_pwrseq: emmc-pwrseq { +- compatible = "mmc-pwrseq-emmc"; +- reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; +- }; +- +- sdio_pwrseq: sdio-pwrseq { +- compatible = "mmc-pwrseq-simple"; +- reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; +- clocks = <&wifi32k>; +- clock-names = "ext_clock"; +- }; +- + spdif_dit: audio-codec-1 { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; +@@ -50,154 +21,6 @@ + sound-name-prefix = "DIT"; + }; + +- flash_1v8: regulator-flash_1v8 { +- compatible = "regulator-fixed"; +- regulator-name = "FLASH_1V8"; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; +- vin-supply = <&vcc_3v3>; +- regulator-always-on; +- }; +- +- main_12v: regulator-main_12v { +- compatible = "regulator-fixed"; +- regulator-name = "12V"; +- regulator-min-microvolt = <12000000>; +- regulator-max-microvolt = <12000000>; +- regulator-always-on; +- }; +- +- vcc_5v: regulator-vcc_5v { +- compatible = "regulator-fixed"; +- regulator-name = "VCC_5V"; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; +- vin-supply = <&main_12v>; +- +- gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; +- enable-active-high; +- }; +- +- vcc_1v8: regulator-vcc_1v8 { +- compatible = "regulator-fixed"; +- regulator-name = "VCC_1V8"; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; +- vin-supply = <&vcc_3v3>; +- regulator-always-on; +- }; +- +- vcc_3v3: regulator-vcc_3v3 { +- compatible = "regulator-fixed"; +- regulator-name = "VCC_3V3"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; +- vin-supply = <&vddao_3v3>; +- regulator-always-on; +- /* FIXME: actually controlled by VDDCPU_B_EN */ +- }; +- +- vddcpu_a: regulator-vddcpu-a { +- /* +- * MP1653 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 { +- /* +- * MP1652 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; +- }; +- +- usb1_pow: regulator-usb1-pow { +- compatible = "regulator-fixed"; +- regulator-name = "USB1_POW"; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; +- vin-supply = <&vcc_5v>; +- +- /* 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"; +- +- port { +- hdmi_connector_in: endpoint { +- remote-endpoint = <&hdmi_tx_tmds_out>; +- }; +- }; +- }; +- + sound { + compatible = "amlogic,axg-sound-card"; + model = "G12B-UGOOS-AM6"; +@@ -277,110 +100,16 @@ + }; + }; + }; +- +- wifi32k: wifi32k { +- compatible = "pwm-clock"; +- #clock-cells = <0>; +- clock-frequency = <32768>; +- pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ +- }; + }; + + &arb { + status = "okay"; + }; + +-&cec_AO { +- pinctrl-0 = <&cec_ao_a_h_pins>; +- pinctrl-names = "default"; +- status = "disabled"; +- hdmi-phandle = <&hdmi_tx>; +-}; +- +-&cecb_AO { +- pinctrl-0 = <&cec_ao_b_h_pins>; +- pinctrl-names = "default"; +- status = "okay"; +- hdmi-phandle = <&hdmi_tx>; +-}; +- + &clkc_audio { + status = "okay"; + }; + +-&cpu0 { +- cpu-supply = <&vddcpu_b>; +- operating-points-v2 = <&cpu_opp_table_0>; +- clocks = <&clkc CLKID_CPU_CLK>; +- clock-latency = <50000>; +-}; +- +-&cpu1 { +- cpu-supply = <&vddcpu_b>; +- operating-points-v2 = <&cpu_opp_table_0>; +- clocks = <&clkc CLKID_CPU_CLK>; +- clock-latency = <50000>; +-}; +- +-&cpu100 { +- cpu-supply = <&vddcpu_a>; +- operating-points-v2 = <&cpub_opp_table_1>; +- clocks = <&clkc CLKID_CPUB_CLK>; +- clock-latency = <50000>; +-}; +- +-&cpu101 { +- cpu-supply = <&vddcpu_a>; +- operating-points-v2 = <&cpub_opp_table_1>; +- clocks = <&clkc CLKID_CPUB_CLK>; +- clock-latency = <50000>; +-}; +- +-&cpu102 { +- cpu-supply = <&vddcpu_a>; +- operating-points-v2 = <&cpub_opp_table_1>; +- clocks = <&clkc CLKID_CPUB_CLK>; +- clock-latency = <50000>; +-}; +- +-&cpu103 { +- cpu-supply = <&vddcpu_a>; +- operating-points-v2 = <&cpub_opp_table_1>; +- clocks = <&clkc CLKID_CPUB_CLK>; +- clock-latency = <50000>; +-}; +- +-&cvbs_vdac_port { +- cvbs_vdac_out: endpoint { +- remote-endpoint = <&cvbs_connector_in>; +- }; +-}; +- +-&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>; +-}; +- + &frddr_a { + status = "okay"; + }; +@@ -393,112 +122,10 @@ + 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-khadas"; + }; + +-&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"; +-}; +- +-&pwm_ef { +- pinctrl-0 = <&pwm_e_pins>; +- pinctrl-names = "default"; +- clocks = <&xtal>; +- clock-names = "clkin0"; +- status = "okay"; +-}; +- +-/* 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; +- +- mmc-pwrseq = <&sdio_pwrseq>; +- +- vmmc-supply = <&vddao_3v3>; +- vqmmc-supply = <&vddao_1v8>; +- +- brcmf: wifi@1 { +- reg = <1>; +- compatible = "brcm,bcm4329-fmac"; +- }; +-}; +- +-/* SD card */ +-&sd_emmc_b { +- status = "okay"; +- pinctrl-0 = <&sdcard_c_pins>; +- pinctrl-1 = <&sdcard_clk_gate_c_pins>; +- pinctrl-names = "default", "clk-gate"; +- +- bus-width = <4>; +- cap-sd-highspeed; +- max-frequency = <50000000>; +- disable-wp; +- +- cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; +- vmmc-supply = <&vddao_3v3>; +- vqmmc-supply = <&vddao_3v3>; +-}; +- +-/* eMMC */ +-&sd_emmc_c { +- status = "okay"; +- pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; +- pinctrl-1 = <&emmc_clk_gate_pins>; +- pinctrl-names = "default", "clk-gate"; +- +- bus-width = <8>; +- cap-mmc-highspeed; +- max-frequency = <100000000>; +- disable-wp; +- +- mmc-pwrseq = <&emmc_pwrseq>; +- vmmc-supply = <&vcc_3v3>; +- vqmmc-supply = <&flash_1v8>; +-}; +- + &spdifout { + pinctrl-0 = <&spdif_out_h_pins>; + pinctrl-names = "default"; +@@ -520,38 +147,3 @@ + &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-supply = <&usb_pwr_en>; +-}; +- +-&usb2_phy0 { +- phy-supply = <&usb1_pow>; +-}; +- +-&usb2_phy1 { +- phy-supply = <&usb1_pow>; +-}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +new file mode 100644 +index 000000000000..98b70d216a6f +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +@@ -0,0 +1,423 @@ ++// 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.dtsi" ++#include "meson-g12b-s922x.dtsi" ++#include ++#include ++ ++/ { ++ aliases { ++ serial0 = &uart_AO; ++ ethernet0 = ðmac; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++ ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ 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; ++ }; ++ ++ main_12v: regulator-main_12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "12V"; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ regulator-always-on; ++ }; ++ ++ vcc_5v: regulator-vcc_5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&main_12v>; ++ ++ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; ++ enable-active-high; ++ }; ++ ++ vcc_1v8: regulator-vcc_1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_3v3>; ++ regulator-always-on; ++ }; ++ ++ vcc_3v3: regulator-vcc_3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VCC_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vddao_3v3>; ++ regulator-always-on; ++ /* FIXME: actually controlled by VDDCPU_B_EN */ ++ }; ++ ++ vddcpu_a: regulator-vddcpu-a { ++ /* ++ * MP1653 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 { ++ /* ++ * MP1652 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; ++ }; ++ ++ usb1_pow: regulator-usb1-pow { ++ compatible = "regulator-fixed"; ++ regulator-name = "USB1_POW"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_5v>; ++ ++ /* 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"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++ ++ wifi32k: wifi32k { ++ compatible = "pwm-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ ++ }; ++}; ++ ++&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>; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vddcpu_b>; ++ operating-points-v2 = <&cpu_opp_table_0>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vddcpu_b>; ++ operating-points-v2 = <&cpu_opp_table_0>; ++ clocks = <&clkc CLKID_CPU_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu100 { ++ cpu-supply = <&vddcpu_a>; ++ operating-points-v2 = <&cpub_opp_table_1>; ++ clocks = <&clkc CLKID_CPUB_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu101 { ++ cpu-supply = <&vddcpu_a>; ++ operating-points-v2 = <&cpub_opp_table_1>; ++ clocks = <&clkc CLKID_CPUB_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu102 { ++ cpu-supply = <&vddcpu_a>; ++ operating-points-v2 = <&cpub_opp_table_1>; ++ clocks = <&clkc CLKID_CPUB_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cpu103 { ++ cpu-supply = <&vddcpu_a>; ++ operating-points-v2 = <&cpub_opp_table_1>; ++ clocks = <&clkc CLKID_CPUB_CLK>; ++ clock-latency = <50000>; ++}; ++ ++&cvbs_vdac_port { ++ cvbs_vdac_out: endpoint { ++ remote-endpoint = <&cvbs_connector_in>; ++ }; ++}; ++ ++&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>; ++}; ++ ++&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"; ++}; ++ ++&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"; ++}; ++ ++&pwm_ef { ++ pinctrl-0 = <&pwm_e_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin0"; ++ status = "okay"; ++}; ++ ++/* 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; ++ ++ mmc-pwrseq = <&sdio_pwrseq>; ++ ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_1v8>; ++ ++ brcmf: wifi@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ }; ++}; ++ ++/* SD card */ ++&sd_emmc_b { ++ status = "okay"; ++ pinctrl-0 = <&sdcard_c_pins>; ++ pinctrl-1 = <&sdcard_clk_gate_c_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <4>; ++ cap-sd-highspeed; ++ max-frequency = <50000000>; ++ disable-wp; ++ ++ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_3v3>; ++}; ++ ++/* eMMC */ ++&sd_emmc_c { ++ status = "okay"; ++ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; ++ pinctrl-1 = <&emmc_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ max-frequency = <100000000>; ++ disable-wp; ++ ++ mmc-pwrseq = <&emmc_pwrseq>; ++ vmmc-supply = <&vcc_3v3>; ++ vqmmc-supply = <&flash_1v8>; ++}; ++ ++&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-supply = <&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-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch b/projects/Amlogic/patches/linux/amlogic-0039-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch similarity index 79% rename from packages/linux/patches/amlogic/amlogic-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch rename to projects/Amlogic/patches/linux/amlogic-0039-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch index b0a75b4f97..84526ecc2a 100644 --- a/packages/linux/patches/amlogic/amlogic-0128-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch +++ b/projects/Amlogic/patches/linux/amlogic-0039-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch @@ -1,19 +1,20 @@ -From 12d275ed409e3225861d66ee89e415c304cff14e Mon Sep 17 00:00:00 2001 +From c3257c27d8ef835466a79695c46f9697b7d5800e 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 +Subject: [PATCH 039/156] FROMGIT: 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. +Acked-by: Rob Herring 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 +index 47badda69ef5..cd7a081a4f17 100644 --- a/Documentation/devicetree/bindings/arm/amlogic.yaml +++ b/Documentation/devicetree/bindings/arm/amlogic.yaml @@ -149,6 +149,7 @@ properties: diff --git a/projects/Amlogic/patches/linux/amlogic-0040-FROMGIT-arm64-dts-meson-g12b-gtking-add-initial-devi.patch b/projects/Amlogic/patches/linux/amlogic-0040-FROMGIT-arm64-dts-meson-g12b-gtking-add-initial-devi.patch new file mode 100644 index 0000000000..1b912c39f1 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0040-FROMGIT-arm64-dts-meson-g12b-gtking-add-initial-devi.patch @@ -0,0 +1,194 @@ +From 2be156eb10cb6f180d1dc3b5eb0fb46b0c9f5d58 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 11 Oct 2019 09:24:44 +0000 +Subject: [PATCH 040/156] FROMGIT: 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 + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../boot/dts/amlogic/meson-g12b-gtking.dts | 145 ++++++++++++++++++ + 2 files changed, 146 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 af883e0bfb9c..8c9e9dfa5da3 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -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 +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..eeb7bc5539ef +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts +@@ -0,0 +1,145 @@ ++// 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-w400.dtsi" ++#include ++ ++/ { ++ compatible = "azw,gtking", "amlogic,g12b"; ++ model = "Beelink GT-King"; ++ ++ spdif_dit: audio-codec-1 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "G12B-GTKING"; ++ 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"; ++}; ++ ++&clkc_audio { ++ status = "okay"; ++}; ++ ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ ++&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-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch b/projects/Amlogic/patches/linux/amlogic-0041-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch similarity index 69% rename from packages/linux/patches/amlogic/amlogic-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch rename to projects/Amlogic/patches/linux/amlogic-0041-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch index 5fdf283874..0b1bc898a1 100644 --- a/packages/linux/patches/amlogic/amlogic-0145-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch +++ b/projects/Amlogic/patches/linux/amlogic-0041-FROMGIT-dt-bindings-arm-amlogic-add-support-for-the-.patch @@ -1,22 +1,23 @@ -From b743a40e6716d1fbfd2112711450fa80d14ad916 Mon Sep 17 00:00:00 2001 -From: chewitt +From 0ad9ee94642b54d1e4b0e35ff4f2749fd2dc056c Mon Sep 17 00:00:00 2001 +From: Christian Hewitt 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 +Subject: [PATCH 041/156] FROMGIT: 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. +Acked-by: Rob Herring 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 +index cd7a081a4f17..db35e0d0134c 100644 --- a/Documentation/devicetree/bindings/arm/amlogic.yaml +++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -151,6 +151,7 @@ properties: +@@ -150,6 +150,7 @@ properties: items: - enum: - azw,gtking diff --git a/projects/Amlogic/patches/linux/amlogic-0042-FROMGIT-arm64-dts-meson-g12b-gtking-pro-add-initial-.patch b/projects/Amlogic/patches/linux/amlogic-0042-FROMGIT-arm64-dts-meson-g12b-gtking-pro-add-initial-.patch new file mode 100644 index 0000000000..1004354bae --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0042-FROMGIT-arm64-dts-meson-g12b-gtking-pro-add-initial-.patch @@ -0,0 +1,175 @@ +From 1bf06c1222c6de12bc80462b1df332e8d375cf27 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sun, 1 Mar 2020 05:43:00 +0000 +Subject: [PATCH 042/156] FROMGIT: arm64: dts: meson-g12b-gtking-pro: add + initial device-tree + +The Shenzen AZW (Beelink) GT-King Pro 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 +- Analogue audio output +- 1x RS232 port +- 2x USB 2.0 port +- 2x USB 3.0 ports +- IR receiver +- 1x micro SD card slot +- 1x Power on/off button + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../dts/amlogic/meson-g12b-gtking-pro.dts | 125 ++++++++++++++++++ + 2 files changed, 126 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 8c9e9dfa5da3..5cac4d1d487d 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -4,6 +4,7 @@ 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-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 +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..f0c56a16af3d +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts +@@ -0,0 +1,125 @@ ++// 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-w400.dtsi" ++#include ++ ++/ { ++ compatible = "azw,gtking", "amlogic,g12b"; ++ model = "Beelink GT-King Pro"; ++ ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ poll-interval = <100>; ++ ++ power-button { ++ label = "power"; ++ linux,code = ; ++ gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ white { ++ label = "power:white"; ++ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ 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", ++ "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>; ++ }; ++ }; ++ ++ dai-link-4 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; ++ ++ codec { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&arb { ++ status = "okay"; ++}; ++ ++&clkc_audio { ++ status = "okay"; ++}; ++ ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ ++&tdmif_b { ++ status = "okay"; ++}; ++ ++&tdmout_b { ++ status = "okay"; ++}; ++ ++&tohdmitx { ++ status = "okay"; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0043-FROMGIT-MAINTAINERS-update-the-Amlogic-VDEC-driver-m.patch b/projects/Amlogic/patches/linux/amlogic-0043-FROMGIT-MAINTAINERS-update-the-Amlogic-VDEC-driver-m.patch new file mode 100644 index 0000000000..89f9f8810e --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0043-FROMGIT-MAINTAINERS-update-the-Amlogic-VDEC-driver-m.patch @@ -0,0 +1,34 @@ +From 6dba3484b6a8c467ccc3982879d0a02484b52bbe Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Sat, 2 May 2020 21:17:45 +0000 +Subject: [PATCH 043/156] FROMGIT: MAINTAINERS: update the Amlogic VDEC driver + maintainer entry + +Add myself as co-maintainer of the Amlogic VDEC driver, and add the +missing vdec DT yaml bindings. + +Signed-off-by: Neil Armstrong +--- + MAINTAINERS | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/MAINTAINERS b/MAINTAINERS +index 50659d76976b..091b74ff830a 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -11016,10 +11016,12 @@ F: drivers/mtd/nand/raw/meson_* + + MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS + M: Maxime Jourdan ++M: Neil Armstrong + L: linux-media@vger.kernel.org + L: linux-amlogic@lists.infradead.org + S: Supported + T: git git://linuxtv.org/media_tree.git ++F: Documentation/devicetree/bindings/media/amlogic,gx-vdec.yaml + F: drivers/staging/media/meson/vdec/ + + METHODE UDPU SUPPORT +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0044-FROMGIT-media-meson-vdec-enable-mcrcc-for-VP9.patch b/projects/Amlogic/patches/linux/amlogic-0044-FROMGIT-media-meson-vdec-enable-mcrcc-for-VP9.patch new file mode 100644 index 0000000000..a1a474c78a --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0044-FROMGIT-media-meson-vdec-enable-mcrcc-for-VP9.patch @@ -0,0 +1,67 @@ +From cd4532a161555ae66ec62cc274b988f9c356f496 Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Sat, 2 May 2020 21:15:13 +0000 +Subject: [PATCH 044/156] FROMGIT: media: meson: vdec: enable mcrcc for VP9 + +The motion compensation reference cache controller allows caching +parts of reference frames for faster decoding. + +Fixes: 00c43088aa68 ("media: meson: vdec: add VP9 decoder support") +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/codec_vp9.c | 31 ++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +index 60e4fc0052b3..897f5d7a6aad 100644 +--- a/drivers/staging/media/meson/vdec/codec_vp9.c ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -854,6 +854,36 @@ static int codec_vp9_stop(struct amvdec_session *sess) + return 0; + } + ++/* ++ * Program LAST & GOLDEN frames into the motion compensation reference cache ++ * controller ++ */ ++static void codec_vp9_set_mcrcc(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_vp9 *vp9 = sess->priv; ++ u32 val; ++ ++ /* Reset mcrcc */ ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0x2); ++ /* Disable on I-frame */ ++ if (vp9->cur_frame->type == KEY_FRAME || vp9->cur_frame->intra_only) { ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0x0); ++ return; ++ } ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, BIT(1)); ++ val = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR) & 0xffff; ++ val |= (val << 16); ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL2, val); ++ val = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR) & 0xffff; ++ val |= (val << 16); ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); ++ ++ /* Enable mcrcc progressive-mode */ ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0xff0); ++} ++ + static void codec_vp9_set_sao(struct amvdec_session *sess, + struct vb2_buffer *vb) + { +@@ -1267,6 +1297,7 @@ static void codec_vp9_process_frame(struct amvdec_session *sess) + + amvdec_write_dos(core, HEVC_PARSER_PICTURE_SIZE, + (vp9->height << 16) | vp9->width); ++ codec_vp9_set_mcrcc(sess); + codec_vp9_set_sao(sess, &vp9->cur_frame->vbuf->vb2_buf); + + vp9_loop_filter_frame_init(core, &vp9->seg_4lf, +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0045-FROMGIT-dt-bindings-net-meson-dwmac-Add-the-amlogic-.patch b/projects/Amlogic/patches/linux/amlogic-0045-FROMGIT-dt-bindings-net-meson-dwmac-Add-the-amlogic-.patch new file mode 100644 index 0000000000..7ea23439cd --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0045-FROMGIT-dt-bindings-net-meson-dwmac-Add-the-amlogic-.patch @@ -0,0 +1,43 @@ +From 83b54115d89c0668d97c30e843b93de001530d0c Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 08:56:41 +0000 +Subject: [PATCH 045/156] FROMGIT: dt-bindings: net: meson-dwmac: Add the + amlogic, rx-delay-ns property + +The PRG_ETHERNET registers on Meson8b and newer SoCs can add an RX +delay. Add a property with the known supported values so it can be +configured according to the board layout. + +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + .../bindings/net/amlogic,meson-dwmac.yaml | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +index ae91aa9d8616..66074314e57a 100644 +--- a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml ++++ b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +@@ -67,6 +67,19 @@ allOf: + PHY and MAC are adding a delay). + Any configuration is ignored when the phy-mode is set to "rmii". + ++ amlogic,rx-delay-ns: ++ enum: ++ - 0 ++ - 2 ++ default: 0 ++ description: ++ The internal RGMII RX clock delay (provided by this IP block) in ++ nanoseconds. When phy-mode is set to "rgmii" then the RX delay ++ should be explicitly configured. When the phy-mode is set to ++ either "rgmii-id" or "rgmii-rxid" the RX clock delay is already ++ provided by the PHY. Any configuration is ignored when the ++ phy-mode is set to "rmii". ++ + properties: + compatible: + additionalItems: true +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0046-FROMGIT-dt-bindings-net-dwmac-meson-Document-the-tim.patch b/projects/Amlogic/patches/linux/amlogic-0046-FROMGIT-dt-bindings-net-dwmac-meson-Document-the-tim.patch new file mode 100644 index 0000000000..421e750742 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0046-FROMGIT-dt-bindings-net-dwmac-meson-Document-the-tim.patch @@ -0,0 +1,58 @@ +From 6aade93a6dccc6d345495cd1f3b9457c3bc8c0a4 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 08:57:48 +0000 +Subject: [PATCH 046/156] FROMGIT: dt-bindings: net: dwmac-meson: Document the + "timing-adjustment" clock + +The PRG_ETHERNET registers can add an RX delay in RGMII mode. This +requires an internal re-timing circuit whose input clock is called +"timing adjustment clock". Document this clock input so the clock can be +enabled as needed. + +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + .../devicetree/bindings/net/amlogic,meson-dwmac.yaml | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +index 66074314e57a..64c20c92c07d 100644 +--- a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml ++++ b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +@@ -40,18 +40,22 @@ allOf: + then: + properties: + clocks: ++ minItems: 3 ++ maxItems: 4 + items: + - description: GMAC main clock + - description: First parent clock of the internal mux + - description: Second parent clock of the internal mux ++ - description: The clock which drives the timing adjustment logic + + clock-names: + minItems: 3 +- maxItems: 3 ++ maxItems: 4 + items: + - const: stmmaceth + - const: clkin0 + - const: clkin1 ++ - const: timing-adjustment + + amlogic,tx-delay-ns: + $ref: /schemas/types.yaml#definitions/uint32 +@@ -120,7 +124,7 @@ examples: + reg = <0xc9410000 0x10000>, <0xc8834540 0x8>; + interrupts = <8>; + interrupt-names = "macirq"; +- clocks = <&clk_eth>, <&clkc_fclk_div2>, <&clk_mpll2>; +- clock-names = "stmmaceth", "clkin0", "clkin1"; ++ clocks = <&clk_eth>, <&clk_fclk_div2>, <&clk_mpll2>, <&clk_fclk_div2>; ++ clock-names = "stmmaceth", "clkin0", "clkin1", "timing-adjustment"; + phy-mode = "rgmii"; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0047-FROMGIT-net-stmmac-dwmac-meson8b-use-FIELD_PREP-inst.patch b/projects/Amlogic/patches/linux/amlogic-0047-FROMGIT-net-stmmac-dwmac-meson8b-use-FIELD_PREP-inst.patch new file mode 100644 index 0000000000..d7e4818eff --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0047-FROMGIT-net-stmmac-dwmac-meson8b-use-FIELD_PREP-inst.patch @@ -0,0 +1,49 @@ +From a2278fbac0d217cb4d3ffa332d50d292f2b1c449 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 08:58:55 +0000 +Subject: [PATCH 047/156] FROMGIT: net: stmmac: dwmac-meson8b: use FIELD_PREP + instead of open-coding it + +Use FIELD_PREP() to shift a value to the correct offset based on a +bitmask instead of open-coding the logic. +No functional changes. + +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index a3934ca6a043..c9ec0cb68082 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -5,6 +5,7 @@ + * Copyright (C) 2016 Martin Blumenstingl + */ + ++#include + #include + #include + #include +@@ -32,7 +33,6 @@ + #define PRG_ETH0_CLK_M250_SEL_SHIFT 4 + #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4) + +-#define PRG_ETH0_TXDLY_SHIFT 5 + #define PRG_ETH0_TXDLY_MASK GENMASK(6, 5) + + /* divider for the result of m250_sel */ +@@ -262,7 +262,8 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) + PRG_ETH0_INVERTED_RMII_CLK, 0); + + meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK, +- tx_dly_val << PRG_ETH0_TXDLY_SHIFT); ++ FIELD_PREP(PRG_ETH0_TXDLY_MASK, ++ tx_dly_val)); + + /* Configure the 125MHz RGMII TX clock, the IP block changes + * the output automatically (= without us having to configure +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0048-FROMGIT-net-stmmac-dwmac-meson8b-Move-the-documentat.patch b/projects/Amlogic/patches/linux/amlogic-0048-FROMGIT-net-stmmac-dwmac-meson8b-Move-the-documentat.patch new file mode 100644 index 0000000000..7451d29424 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0048-FROMGIT-net-stmmac-dwmac-meson8b-Move-the-documentat.patch @@ -0,0 +1,46 @@ +From e3c7eb63ec72c9bf036cdcd32f976a4eaa0c173b Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 08:59:38 +0000 +Subject: [PATCH 048/156] FROMGIT: net: stmmac: dwmac-meson8b: Move the + documentation for the TX delay + +Move the documentation for the TX delay above the PRG_ETH0_TXDLY_MASK +definition. Future commits will add more registers also with +documentation above their register bit definitions. Move the existing +comment so it will be consistent with the upcoming changes. + +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index c9ec0cb68082..1d7526ee09dd 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -33,6 +33,10 @@ + #define PRG_ETH0_CLK_M250_SEL_SHIFT 4 + #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4) + ++/* TX clock delay in ns = "8ns / 4 * tx_dly_val" (where 8ns are exactly one ++ * cycle of the 125MHz RGMII TX clock): ++ * 0ns = 0x0, 2ns = 0x1, 4ns = 0x2, 6ns = 0x3 ++ */ + #define PRG_ETH0_TXDLY_MASK GENMASK(6, 5) + + /* divider for the result of m250_sel */ +@@ -248,10 +252,6 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) + switch (dwmac->phy_mode) { + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_RXID: +- /* TX clock delay in ns = "8ns / 4 * tx_dly_val" (where +- * 8ns are exactly one cycle of the 125MHz RGMII TX clock): +- * 0ns = 0x0, 2ns = 0x1, 4ns = 0x2, 6ns = 0x3 +- */ + tx_dly_val = dwmac->tx_delay_ns >> 1; + /* fall through */ + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0049-FROMGIT-net-stmmac-dwmac-meson8b-Add-the-PRG_ETH0_AD.patch b/projects/Amlogic/patches/linux/amlogic-0049-FROMGIT-net-stmmac-dwmac-meson8b-Add-the-PRG_ETH0_AD.patch new file mode 100644 index 0000000000..a3001fb380 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0049-FROMGIT-net-stmmac-dwmac-meson8b-Add-the-PRG_ETH0_AD.patch @@ -0,0 +1,54 @@ +From 6e6362ce945ff5e7b262caa9395be0b1a0351464 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:00:36 +0000 +Subject: [PATCH 049/156] FROMGIT: net: stmmac: dwmac-meson8b: Add the + PRG_ETH0_ADJ_* bits + +The PRG_ETH0_ADJ_* are used for applying the RGMII RX delay. The public +datasheets only have very limited description for these registers, but +Jianxin Pan provided more detailed documentation from an (unnamed) +Amlogic engineer. Add the PRG_ETH0_ADJ_* bits along with the improved +description. + +Suggested-by: Jianxin Pan +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 21 +++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index 1d7526ee09dd..70075628c58e 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -48,6 +48,27 @@ + #define PRG_ETH0_INVERTED_RMII_CLK BIT(11) + #define PRG_ETH0_TX_AND_PHY_REF_CLK BIT(12) + ++/* Bypass (= 0, the signal from the GPIO input directly connects to the ++ * internal sampling) or enable (= 1) the internal logic for RXEN and RXD[3:0] ++ * timing tuning. ++ */ ++#define PRG_ETH0_ADJ_ENABLE BIT(13) ++/* Controls whether the RXEN and RXD[3:0] signals should be aligned with the ++ * input RX rising/falling edge and sent to the Ethernet internals. This sets ++ * the automatically delay and skew automatically (internally). ++ */ ++#define PRG_ETH0_ADJ_SETUP BIT(14) ++/* An internal counter based on the "timing-adjustment" clock. The counter is ++ * cleared on both, the falling and rising edge of the RX_CLK. This selects the ++ * delay (= the counter value) when to start sampling RXEN and RXD[3:0]. ++ */ ++#define PRG_ETH0_ADJ_DELAY GENMASK(19, 15) ++/* Adjusts the skew between each bit of RXEN and RXD[3:0]. If a signal has a ++ * large input delay, the bit for that signal (RXEN = bit 0, RXD[3] = bit 1, ++ * ...) can be configured to be 1 to compensate for a delay of about 1ns. ++ */ ++#define PRG_ETH0_ADJ_SKEW GENMASK(24, 20) ++ + #define MUX_CLK_NUM_PARENTS 2 + + struct meson8b_dwmac; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0050-FROMGIT-net-stmmac-dwmac-meson8b-Fetch-the-timing-ad.patch b/projects/Amlogic/patches/linux/amlogic-0050-FROMGIT-net-stmmac-dwmac-meson8b-Fetch-the-timing-ad.patch new file mode 100644 index 0000000000..47e5dd0fc7 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0050-FROMGIT-net-stmmac-dwmac-meson8b-Fetch-the-timing-ad.patch @@ -0,0 +1,47 @@ +From 34bcda9f7dec6e7c54e486479e50e1455fe6f7ac Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:01:24 +0000 +Subject: [PATCH 050/156] FROMGIT: net: stmmac: dwmac-meson8b: Fetch the + "timing-adjustment" clock + +The PRG_ETHERNET registers have a built-in timing adjustment circuit +which can provide the RX delay in RGMII mode. This is driven by an +external (to this IP, but internal to the SoC) clock input. Fetch this +clock as optional (even though it's there on all supported SoCs) since +we just learned about it and existing .dtbs don't specify it. + +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index 70075628c58e..41f3ef6bea66 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -85,6 +85,7 @@ struct meson8b_dwmac { + phy_interface_t phy_mode; + struct clk *rgmii_tx_clk; + u32 tx_delay_ns; ++ struct clk *timing_adj_clk; + }; + + struct meson8b_dwmac_clk_configs { +@@ -380,6 +381,13 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) + &dwmac->tx_delay_ns)) + dwmac->tx_delay_ns = 2; + ++ dwmac->timing_adj_clk = devm_clk_get_optional(dwmac->dev, ++ "timing-adjustment"); ++ if (IS_ERR(dwmac->timing_adj_clk)) { ++ ret = PTR_ERR(dwmac->timing_adj_clk); ++ goto err_remove_config_dt; ++ } ++ + ret = meson8b_init_rgmii_tx_clk(dwmac); + if (ret) + goto err_remove_config_dt; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0051-FROMGIT-net-stmmac-dwmac-meson8b-Make-the-clock-enab.patch b/projects/Amlogic/patches/linux/amlogic-0051-FROMGIT-net-stmmac-dwmac-meson8b-Make-the-clock-enab.patch new file mode 100644 index 0000000000..b3b5316ba4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0051-FROMGIT-net-stmmac-dwmac-meson8b-Make-the-clock-enab.patch @@ -0,0 +1,66 @@ +From 51838b40f55661f08fe154abb1e15d08bded2321 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:02:19 +0000 +Subject: [PATCH 051/156] FROMGIT: net: stmmac: dwmac-meson8b: Make the clock + enabling code re-usable + +The timing adjustment clock will need similar logic as the RGMII clock: +It has to be enabled in the driver conditionally and when the driver is +unloaded it should be disabled again. Extract the existing code for the +RGMII clock into a new function so it can be re-used. + +Reviewed-by: Andrew Lunn +Signed-off-by: Martin Blumenstingl +--- + .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 23 +++++++++++++++---- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index 41f3ef6bea66..d31f79c455de 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -266,6 +266,22 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac) + return 0; + } + ++static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac, ++ struct clk *clk) ++{ ++ int ret; ++ ++ ret = clk_prepare_enable(clk); ++ if (ret) ++ return ret; ++ ++ devm_add_action_or_reset(dwmac->dev, ++ (void(*)(void *))clk_disable_unprepare, ++ dwmac->rgmii_tx_clk); ++ ++ return 0; ++} ++ + static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) + { + int ret; +@@ -299,16 +315,13 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) + return ret; + } + +- ret = clk_prepare_enable(dwmac->rgmii_tx_clk); ++ ret = meson8b_devm_clk_prepare_enable(dwmac, ++ dwmac->rgmii_tx_clk); + if (ret) { + dev_err(dwmac->dev, + "failed to enable the RGMII TX clock\n"); + return ret; + } +- +- devm_add_action_or_reset(dwmac->dev, +- (void(*)(void *))clk_disable_unprepare, +- dwmac->rgmii_tx_clk); + break; + + case PHY_INTERFACE_MODE_RMII: +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0052-FROMGIT-net-stmmac-dwmac-meson8b-add-support-for-the.patch b/projects/Amlogic/patches/linux/amlogic-0052-FROMGIT-net-stmmac-dwmac-meson8b-add-support-for-the.patch new file mode 100644 index 0000000000..3d1a706ae4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0052-FROMGIT-net-stmmac-dwmac-meson8b-add-support-for-the.patch @@ -0,0 +1,172 @@ +From b47c43c29c9b052e541b94afcbf1925c87d1a3a6 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:03:26 +0000 +Subject: [PATCH 052/156] FROMGIT: net: stmmac: dwmac-meson8b: add support for + the RX delay configuration + +Configure the PRG_ETH0_ADJ_* bits to enable or disable the RX delay +based on the various RGMII PHY modes. For now the only supported RX +delay settings are: +- disabled, use for example for phy-mode "rgmii-id" +- 0ns - this is treated identical to "disabled", used for example on + boards where the PHY provides 2ns TX delay and the PCB trace length + already adds 2ns RX delay +- 2ns - for whenever the PHY cannot add the RX delay and the traces on + the PCB don't add any RX delay + +Disabling the RX delay (in case u-boot enables it, which is the case +for example on Meson8b Odroid-C1) simply means that PRG_ETH0_ADJ_ENABLE, +PRG_ETH0_ADJ_SETUP, PRG_ETH0_ADJ_DELAY and PRG_ETH0_ADJ_SKEW should be +disabled (just disabling PRG_ETH0_ADJ_ENABLE may be enough, since that +disables the whole re-timing logic - but I find it makes more sense to +clear the other bits as well since they depend on that setting). + +u-boot on Odroid-C1 uses the following steps to enable a 2ns RX delay: +- enabling enabling the timing adjustment clock +- enabling the timing adjustment logic by setting PRG_ETH0_ADJ_ENABLE +- setting the PRG_ETH0_ADJ_SETUP bit + +The documentation for the PRG_ETH0_ADJ_DELAY and PRG_ETH0_ADJ_SKEW +registers indicates that we can even set different RX delays. However, +I could not find out how this works exactly, so for now we only support +a 2ns RX delay using the exact same way that Odroid-C1's u-boot does. + +Signed-off-by: Martin Blumenstingl +--- + .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 85 ++++++++++++++----- + 1 file changed, 62 insertions(+), 23 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index d31f79c455de..234e8b6816ce 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -85,6 +85,7 @@ struct meson8b_dwmac { + phy_interface_t phy_mode; + struct clk *rgmii_tx_clk; + u32 tx_delay_ns; ++ u32 rx_delay_ns; + struct clk *timing_adj_clk; + }; + +@@ -284,25 +285,64 @@ static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac, + + static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) + { ++ u32 tx_dly_config, rx_dly_config, delay_config; + int ret; +- u8 tx_dly_val = 0; ++ ++ tx_dly_config = FIELD_PREP(PRG_ETH0_TXDLY_MASK, ++ dwmac->tx_delay_ns >> 1); ++ ++ if (dwmac->rx_delay_ns == 2) ++ rx_dly_config = PRG_ETH0_ADJ_ENABLE | PRG_ETH0_ADJ_SETUP; ++ else ++ rx_dly_config = 0; + + switch (dwmac->phy_mode) { + case PHY_INTERFACE_MODE_RGMII: ++ delay_config = tx_dly_config | rx_dly_config; ++ break; + case PHY_INTERFACE_MODE_RGMII_RXID: +- tx_dly_val = dwmac->tx_delay_ns >> 1; +- /* fall through */ +- +- case PHY_INTERFACE_MODE_RGMII_ID: ++ delay_config = tx_dly_config; ++ break; + case PHY_INTERFACE_MODE_RGMII_TXID: ++ delay_config = rx_dly_config; ++ break; ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RMII: ++ delay_config = 0; ++ break; ++ default: ++ dev_err(dwmac->dev, "unsupported phy-mode %s\n", ++ phy_modes(dwmac->phy_mode)); ++ return -EINVAL; ++ }; ++ ++ if (rx_dly_config & PRG_ETH0_ADJ_ENABLE) { ++ if (!dwmac->timing_adj_clk) { ++ dev_err(dwmac->dev, ++ "The timing-adjustment clock is mandatory for the RX delay re-timing\n"); ++ return -EINVAL; ++ } ++ ++ /* The timing adjustment logic is driven by a separate clock */ ++ ret = meson8b_devm_clk_prepare_enable(dwmac, ++ dwmac->timing_adj_clk); ++ if (ret) { ++ dev_err(dwmac->dev, ++ "Failed to enable the timing-adjustment clock\n"); ++ return ret; ++ } ++ } ++ ++ meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK | ++ PRG_ETH0_ADJ_ENABLE | PRG_ETH0_ADJ_SETUP | ++ PRG_ETH0_ADJ_DELAY | PRG_ETH0_ADJ_SKEW, ++ delay_config); ++ ++ if (phy_interface_mode_is_rgmii(dwmac->phy_mode)) { + /* only relevant for RMII mode -> disable in RGMII mode */ + meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, + PRG_ETH0_INVERTED_RMII_CLK, 0); + +- meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK, +- FIELD_PREP(PRG_ETH0_TXDLY_MASK, +- tx_dly_val)); +- + /* Configure the 125MHz RGMII TX clock, the IP block changes + * the output automatically (= without us having to configure + * a register) based on the line-speed (125MHz for Gbit speeds, +@@ -322,24 +362,11 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) + "failed to enable the RGMII TX clock\n"); + return ret; + } +- break; +- +- case PHY_INTERFACE_MODE_RMII: ++ } else { + /* invert internal clk_rmii_i to generate 25/2.5 tx_rx_clk */ + meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, + PRG_ETH0_INVERTED_RMII_CLK, + PRG_ETH0_INVERTED_RMII_CLK); +- +- /* TX clock delay cannot be configured in RMII mode */ +- meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK, +- 0); +- +- break; +- +- default: +- dev_err(dwmac->dev, "unsupported phy-mode %s\n", +- phy_modes(dwmac->phy_mode)); +- return -EINVAL; + } + + /* enable TX_CLK and PHY_REF_CLK generator */ +@@ -394,6 +421,18 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) + &dwmac->tx_delay_ns)) + dwmac->tx_delay_ns = 2; + ++ /* use 0ns as fallback since this is what most boards actually use */ ++ if (of_property_read_u32(pdev->dev.of_node, "amlogic,rx-delay-ns", ++ &dwmac->rx_delay_ns)) ++ dwmac->rx_delay_ns = 0; ++ ++ if (dwmac->rx_delay_ns != 0 && dwmac->rx_delay_ns != 2) { ++ dev_err(&pdev->dev, ++ "The only allowed RX delays values are: 0ns, 2ns"); ++ ret = -EINVAL; ++ goto err_remove_config_dt; ++ } ++ + dwmac->timing_adj_clk = devm_clk_get_optional(dwmac->dev, + "timing-adjustment"); + if (IS_ERR(dwmac->timing_adj_clk)) { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0053-FROMGIT-dt-bindings-phy-meson8b-usb2-Convert-to-json.patch b/projects/Amlogic/patches/linux/amlogic-0053-FROMGIT-dt-bindings-phy-meson8b-usb2-Convert-to-json.patch new file mode 100644 index 0000000000..8197f06cae --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0053-FROMGIT-dt-bindings-phy-meson8b-usb2-Convert-to-json.patch @@ -0,0 +1,129 @@ +From 72fb59a5719f18b2268b4f9c1071817415079088 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:06:05 +0000 +Subject: [PATCH 053/156] FROMGIT: dt-bindings: phy: meson8b-usb2: Convert to + json-schema + +Now that we have the DT validation in place, let's convert the device +tree bindings for the Amlogic Meson8, Meson8b, Meson8m2 and GXBB USB2 +PHY over to a YAML schema. + +While here, also add the fallback compatible string +"amlogic,meson-gxbb-usb2-phy" which is already used in +arch/arm/boot/dts/meson{,8,8b}.dtsi. + +Tested-by: Thomas Graichen +Signed-off-by: Martin Blumenstingl +--- + .../phy/amlogic,meson8b-usb2-phy.yaml | 63 +++++++++++++++++++ + .../bindings/phy/meson8b-usb2-phy.txt | 28 --------- + 2 files changed, 63 insertions(+), 28 deletions(-) + create mode 100644 Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml + delete mode 100644 Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt + +diff --git a/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml +new file mode 100644 +index 000000000000..0bd4ce39525a +--- /dev/null ++++ b/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml +@@ -0,0 +1,63 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: "http://devicetree.org/schemas/phy/amlogic,meson8b-usb2-phy.yaml#" ++$schema: "http://devicetree.org/meta-schemas/core.yaml#" ++ ++title: Amlogic Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY ++ ++maintainers: ++ - Martin Blumenstingl ++ ++properties: ++ compatible: ++ oneOf: ++ - items: ++ - enum: ++ - amlogic,meson8-usb2-phy ++ - amlogic,meson8b-usb2-phy ++ - const: amlogic,meson-mx-usb2-phy ++ - const: amlogic,meson-gxbb-usb2-phy ++ ++ reg: ++ maxItems: 1 ++ ++ clocks: ++ minItems: 2 ++ ++ clock-names: ++ items: ++ - const: usb_general ++ - const: usb ++ ++ resets: ++ minItems: 1 ++ ++ "#phy-cells": ++ const: 0 ++ ++ phy-supply: ++ description: ++ Phandle to a regulator that provides power to the PHY. This ++ regulator will be managed during the PHY power on/off sequence. ++ ++required: ++ - compatible ++ - reg ++ - clocks ++ - clock-names ++ - "#phy-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ usb-phy@c0000000 { ++ compatible = "amlogic,meson-gxbb-usb2-phy"; ++ reg = <0xc0000000 0x20>; ++ resets = <&reset_usb_phy>; ++ clocks = <&clk_usb_general>, <&reset_usb>; ++ clock-names = "usb_general", "usb"; ++ phy-supply = <&usb_vbus>; ++ #phy-cells = <0>; ++ }; +diff --git a/Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt b/Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt +deleted file mode 100644 +index d81d73aea608..000000000000 +--- a/Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt ++++ /dev/null +@@ -1,28 +0,0 @@ +-* Amlogic Meson8, Meson8b and GXBB USB2 PHY +- +-Required properties: +-- compatible: Depending on the platform this should be one of: +- "amlogic,meson8-usb2-phy" +- "amlogic,meson8b-usb2-phy" +- "amlogic,meson-gxbb-usb2-phy" +-- reg: The base address and length of the registers +-- #phys-cells: should be 0 (see phy-bindings.txt in this directory) +-- clocks: phandle and clock identifier for the phy clocks +-- clock-names: "usb_general" and "usb" +- +-Optional properties: +-- resets: reference to the reset controller +-- phy-supply: see phy-bindings.txt in this directory +- +- +-Example: +- +-usb0_phy: usb-phy@c0000000 { +- compatible = "amlogic,meson-gxbb-usb2-phy"; +- #phy-cells = <0>; +- reg = <0x0 0xc0000000 0x0 0x20>; +- resets = <&reset RESET_USB_OTG>; +- clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>; +- clock-names = "usb_general", "usb"; +- phy-supply = <&usb_vbus>; +-}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0054-FROMGIT-dt-bindings-phy-meson8b-usb2-Add-compatible-.patch b/projects/Amlogic/patches/linux/amlogic-0054-FROMGIT-dt-bindings-phy-meson8b-usb2-Add-compatible-.patch new file mode 100644 index 0000000000..4bdacb2f82 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0054-FROMGIT-dt-bindings-phy-meson8b-usb2-Add-compatible-.patch @@ -0,0 +1,34 @@ +From dde5ce6f404c10465b3f91e9ad1ba8e341839df9 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:06:52 +0000 +Subject: [PATCH 054/156] FROMGIT: dt-bindings: phy: meson8b-usb2: Add + compatible string for Meson8m2 + +The USB2 PHY on Meson8m2 is identical to the one on Meson8b but +different to the one on Meson8. The only known difference is that Meson8 +does not set the ACA_ENABLE bit while Meson8b and Meson8m2 do. +Add an explicit compatible string for Meson8m2 so those differences can +be taken care of. + +Tested-by: Thomas Graichen +Acked-by: Rob Herring +Signed-off-by: Martin Blumenstingl +--- + .../devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml +index 0bd4ce39525a..03c4809dbe8d 100644 +--- a/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml ++++ b/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml +@@ -16,6 +16,7 @@ properties: + - enum: + - amlogic,meson8-usb2-phy + - amlogic,meson8b-usb2-phy ++ - amlogic,meson8m2-usb2-phy + - const: amlogic,meson-mx-usb2-phy + - const: amlogic,meson-gxbb-usb2-phy + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0055-FROMGIT-phy-amlogic-meson8b-usb2-Use-a-MMIO-regmap.patch b/projects/Amlogic/patches/linux/amlogic-0055-FROMGIT-phy-amlogic-meson8b-usb2-Use-a-MMIO-regmap.patch new file mode 100644 index 0000000000..e786b1c217 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0055-FROMGIT-phy-amlogic-meson8b-usb2-Use-a-MMIO-regmap.patch @@ -0,0 +1,166 @@ +From d099c11d730117bad1feff51663c53c8449cf39e Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:07:48 +0000 +Subject: [PATCH 055/156] FROMGIT: phy: amlogic: meson8b-usb2: Use a MMIO + regmap + +Using a MMIO regmap and switch to regmap_update_bits() to simplify the +code in the driver. Also switch to devm_platform_ioremap_resource() +instead of open-coding it. No functional changes intended. + +Tested-by: Thomas Graichen +Signed-off-by: Martin Blumenstingl +--- + drivers/phy/amlogic/Kconfig | 1 + + drivers/phy/amlogic/phy-meson8b-usb2.c | 73 ++++++++++++-------------- + 2 files changed, 35 insertions(+), 39 deletions(-) + +diff --git a/drivers/phy/amlogic/Kconfig b/drivers/phy/amlogic/Kconfig +index 71801e30d601..3495b23af797 100644 +--- a/drivers/phy/amlogic/Kconfig ++++ b/drivers/phy/amlogic/Kconfig +@@ -9,6 +9,7 @@ config PHY_MESON8B_USB2 + depends on USB_SUPPORT + select USB_COMMON + select GENERIC_PHY ++ select REGMAP_MMIO + help + Enable this to support the Meson USB2 PHYs found in Meson8, + Meson8b and GXBB SoCs. +diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c +index bd66bd723e4a..86824cc21f11 100644 +--- a/drivers/phy/amlogic/phy-meson8b-usb2.c ++++ b/drivers/phy/amlogic/phy-meson8b-usb2.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -105,34 +106,24 @@ + #define ACA_ENABLE_COMPLETE_TIME 50 + + struct phy_meson8b_usb2_priv { +- void __iomem *regs; ++ struct regmap *regmap; + enum usb_dr_mode dr_mode; + struct clk *clk_usb_general; + struct clk *clk_usb; + struct reset_control *reset; + }; + +-static u32 phy_meson8b_usb2_read(struct phy_meson8b_usb2_priv *phy_priv, +- u32 reg) +-{ +- return readl(phy_priv->regs + reg); +-} +- +-static void phy_meson8b_usb2_mask_bits(struct phy_meson8b_usb2_priv *phy_priv, +- u32 reg, u32 mask, u32 value) +-{ +- u32 data; +- +- data = phy_meson8b_usb2_read(phy_priv, reg); +- data &= ~mask; +- data |= (value & mask); +- +- writel(data, phy_priv->regs + reg); +-} ++static const struct regmap_config phy_meson8b_usb2_regmap_conf = { ++ .reg_bits = 8, ++ .val_bits = 32, ++ .reg_stride = 4, ++ .max_register = REG_TUNE, ++}; + + static int phy_meson8b_usb2_power_on(struct phy *phy) + { + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); ++ u32 reg; + int ret; + + if (!IS_ERR_OR_NULL(priv->reset)) { +@@ -156,34 +147,34 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) + return ret; + } + +- phy_meson8b_usb2_mask_bits(priv, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, +- REG_CONFIG_CLK_32k_ALTSEL); ++ regmap_update_bits(priv->regmap, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, ++ REG_CONFIG_CLK_32k_ALTSEL); + +- phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_REF_CLK_SEL_MASK, +- 0x2 << REG_CTRL_REF_CLK_SEL_SHIFT); ++ regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_REF_CLK_SEL_MASK, ++ 0x2 << REG_CTRL_REF_CLK_SEL_SHIFT); + +- phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_FSEL_MASK, +- 0x5 << REG_CTRL_FSEL_SHIFT); ++ regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_FSEL_MASK, ++ 0x5 << REG_CTRL_FSEL_SHIFT); + + /* reset the PHY */ +- phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_POWER_ON_RESET, +- REG_CTRL_POWER_ON_RESET); ++ regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, ++ REG_CTRL_POWER_ON_RESET); + udelay(RESET_COMPLETE_TIME); +- phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_POWER_ON_RESET, 0); ++ regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, 0); + udelay(RESET_COMPLETE_TIME); + +- phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, +- REG_CTRL_SOF_TOGGLE_OUT); ++ regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, ++ REG_CTRL_SOF_TOGGLE_OUT); + + if (priv->dr_mode == USB_DR_MODE_HOST) { +- phy_meson8b_usb2_mask_bits(priv, REG_ADP_BC, +- REG_ADP_BC_ACA_ENABLE, +- REG_ADP_BC_ACA_ENABLE); ++ regmap_update_bits(priv->regmap, REG_ADP_BC, ++ REG_ADP_BC_ACA_ENABLE, ++ REG_ADP_BC_ACA_ENABLE); + + udelay(ACA_ENABLE_COMPLETE_TIME); + +- if (phy_meson8b_usb2_read(priv, REG_ADP_BC) & +- REG_ADP_BC_ACA_PIN_FLOAT) { ++ regmap_read(priv->regmap, REG_ADP_BC, ®); ++ if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { + dev_warn(&phy->dev, "USB ID detect failed!\n"); + clk_disable_unprepare(priv->clk_usb); + clk_disable_unprepare(priv->clk_usb_general); +@@ -213,18 +204,22 @@ static const struct phy_ops phy_meson8b_usb2_ops = { + static int phy_meson8b_usb2_probe(struct platform_device *pdev) + { + struct phy_meson8b_usb2_priv *priv; +- struct resource *res; + struct phy *phy; + struct phy_provider *phy_provider; ++ void __iomem *base; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->regs = devm_ioremap_resource(&pdev->dev, res); +- if (IS_ERR(priv->regs)) +- return PTR_ERR(priv->regs); ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, ++ &phy_meson8b_usb2_regmap_conf); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); + + priv->clk_usb_general = devm_clk_get(&pdev->dev, "usb_general"); + if (IS_ERR(priv->clk_usb_general)) +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0056-FROMGIT-phy-amlogic-meson8b-usb2-Don-t-set-REG_ADP_B.patch b/projects/Amlogic/patches/linux/amlogic-0056-FROMGIT-phy-amlogic-meson8b-usb2-Don-t-set-REG_ADP_B.patch new file mode 100644 index 0000000000..4a5327272d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0056-FROMGIT-phy-amlogic-meson8b-usb2-Don-t-set-REG_ADP_B.patch @@ -0,0 +1,112 @@ +From 0396c7d56b4c590bf1d2dada6ff4828d504c0ccb Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:08:57 +0000 +Subject: [PATCH 056/156] FROMGIT: phy: amlogic: meson8b-usb2: Don't set + REG_ADP_BC_ACA_ENABLE on Meson8 + +Skip setting REG_ADP_BC_ACA_ENABLE on Meson8 SoCs and polling for the +REG_ADP_BC_ACA_PIN_FLOAT bit. The vendor also skips this part on Meson8 +SoCs. +This fixes initialization of the host-only USB PHY on Meson8 which would +otherwise fail with "USB ID detect failed!". + +Fixes: 4a3449d1a0a10c ("phy: meson8b-usb2: add support for the USB PHY on Meson8 SoCs") +Reported-by: Thomas Graichen +Tested-by: Thomas Graichen +Signed-off-by: Martin Blumenstingl +--- + drivers/phy/amlogic/phy-meson8b-usb2.c | 48 ++++++++++++++++++++------ + 1 file changed, 38 insertions(+), 10 deletions(-) + +diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c +index 86824cc21f11..7236b8885f07 100644 +--- a/drivers/phy/amlogic/phy-meson8b-usb2.c ++++ b/drivers/phy/amlogic/phy-meson8b-usb2.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -105,12 +106,17 @@ + #define RESET_COMPLETE_TIME 500 + #define ACA_ENABLE_COMPLETE_TIME 50 + ++struct phy_meson8b_usb2_match_data { ++ bool host_enable_aca; ++}; ++ + struct phy_meson8b_usb2_priv { +- struct regmap *regmap; +- enum usb_dr_mode dr_mode; +- struct clk *clk_usb_general; +- struct clk *clk_usb; +- struct reset_control *reset; ++ struct regmap *regmap; ++ enum usb_dr_mode dr_mode; ++ struct clk *clk_usb_general; ++ struct clk *clk_usb; ++ struct reset_control *reset; ++ const struct phy_meson8b_usb2_match_data *match; + }; + + static const struct regmap_config phy_meson8b_usb2_regmap_conf = { +@@ -166,7 +172,8 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, + REG_CTRL_SOF_TOGGLE_OUT); + +- if (priv->dr_mode == USB_DR_MODE_HOST) { ++ if (priv->dr_mode == USB_DR_MODE_HOST && ++ priv->match->host_enable_aca) { + regmap_update_bits(priv->regmap, REG_ADP_BC, + REG_ADP_BC_ACA_ENABLE, + REG_ADP_BC_ACA_ENABLE); +@@ -216,6 +223,10 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) + if (IS_ERR(base)) + return PTR_ERR(base); + ++ priv->match = device_get_match_data(&pdev->dev); ++ if (!priv->match) ++ return -ENODEV; ++ + priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, + &phy_meson8b_usb2_regmap_conf); + if (IS_ERR(priv->regmap)) +@@ -254,11 +265,28 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) + return PTR_ERR_OR_ZERO(phy_provider); + } + ++static const struct phy_meson8b_usb2_match_data phy_meson8_usb2_match_data = { ++ .host_enable_aca = false, ++}; ++ ++static const struct phy_meson8b_usb2_match_data phy_meson8b_usb2_match_data = { ++ .host_enable_aca = true, ++}; ++ + static const struct of_device_id phy_meson8b_usb2_of_match[] = { +- { .compatible = "amlogic,meson8-usb2-phy", }, +- { .compatible = "amlogic,meson8b-usb2-phy", }, +- { .compatible = "amlogic,meson-gxbb-usb2-phy", }, +- { }, ++ { ++ .compatible = "amlogic,meson8-usb2-phy", ++ .data = &phy_meson8_usb2_match_data ++ }, ++ { ++ .compatible = "amlogic,meson8b-usb2-phy", ++ .data = &phy_meson8b_usb2_match_data ++ }, ++ { ++ .compatible = "amlogic,meson-gxbb-usb2-phy", ++ .data = &phy_meson8b_usb2_match_data ++ }, ++ { /* sentinel */ } + }; + MODULE_DEVICE_TABLE(of, phy_meson8b_usb2_of_match); + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0057-FROMGIT-phy-amlogic-meson8b-usb2-unset-the-IDDQ-bit-.patch b/projects/Amlogic/patches/linux/amlogic-0057-FROMGIT-phy-amlogic-meson8b-usb2-unset-the-IDDQ-bit-.patch new file mode 100644 index 0000000000..0ff83f6125 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0057-FROMGIT-phy-amlogic-meson8b-usb2-unset-the-IDDQ-bit-.patch @@ -0,0 +1,92 @@ +From 8fc4830bbf8c5038559b9e25ffab217dbee9d592 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:10:00 +0000 +Subject: [PATCH 057/156] FROMGIT: phy: amlogic: meson8b-usb2: unset the IDDQ + bit during PHY power-on + +The vendor driver unsets the set_iddig bit during power-on as well and +sets it when suspending the PHY. I did not notice this in the vendor +driver first, because it's part of the dwc_otg driver there (instead of +their PHY code). While here, also add all other REG_DBG_UART register +bit definitions. + +Tested-by: Thomas Graichen +Signed-off-by: Martin Blumenstingl +--- + drivers/phy/amlogic/phy-meson8b-usb2.c | 44 +++++++++++++++++++------- + 1 file changed, 32 insertions(+), 12 deletions(-) + +diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c +index 7236b8885f07..436dfa1a8a04 100644 +--- a/drivers/phy/amlogic/phy-meson8b-usb2.c ++++ b/drivers/phy/amlogic/phy-meson8b-usb2.c +@@ -78,6 +78,17 @@ + #define REG_ADP_BC_ACA_PIN_FLOAT BIT(26) + + #define REG_DBG_UART 0x10 ++ #define REG_DBG_UART_BYPASS_SEL BIT(0) ++ #define REG_DBG_UART_BYPASS_DM_EN BIT(1) ++ #define REG_DBG_UART_BYPASS_DP_EN BIT(2) ++ #define REG_DBG_UART_BYPASS_DM_DATA BIT(3) ++ #define REG_DBG_UART_BYPASS_DP_DATA BIT(4) ++ #define REG_DBG_UART_FSV_MINUS BIT(5) ++ #define REG_DBG_UART_FSV_PLUS BIT(6) ++ #define REG_DBG_UART_FSV_BURN_IN_TEST BIT(7) ++ #define REG_DBG_UART_LOOPBACK_EN_B BIT(8) ++ #define REG_DBG_UART_SET_IDDQ BIT(9) ++ #define REG_DBG_UART_ATE_RESET BIT(10) + + #define REG_TEST 0x14 + #define REG_TEST_DATA_IN_MASK GENMASK(3, 0) +@@ -172,20 +183,24 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, + REG_CTRL_SOF_TOGGLE_OUT); + +- if (priv->dr_mode == USB_DR_MODE_HOST && +- priv->match->host_enable_aca) { +- regmap_update_bits(priv->regmap, REG_ADP_BC, +- REG_ADP_BC_ACA_ENABLE, +- REG_ADP_BC_ACA_ENABLE); ++ if (priv->dr_mode == USB_DR_MODE_HOST) { ++ regmap_update_bits(priv->regmap, REG_DBG_UART, ++ REG_DBG_UART_SET_IDDQ, 0); + +- udelay(ACA_ENABLE_COMPLETE_TIME); ++ if (priv->match->host_enable_aca) { ++ regmap_update_bits(priv->regmap, REG_ADP_BC, ++ REG_ADP_BC_ACA_ENABLE, ++ REG_ADP_BC_ACA_ENABLE); + +- regmap_read(priv->regmap, REG_ADP_BC, ®); +- if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { +- dev_warn(&phy->dev, "USB ID detect failed!\n"); +- clk_disable_unprepare(priv->clk_usb); +- clk_disable_unprepare(priv->clk_usb_general); +- return -EINVAL; ++ udelay(ACA_ENABLE_COMPLETE_TIME); ++ ++ regmap_read(priv->regmap, REG_ADP_BC, ®); ++ if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { ++ dev_warn(&phy->dev, "USB ID detect failed!\n"); ++ clk_disable_unprepare(priv->clk_usb); ++ clk_disable_unprepare(priv->clk_usb_general); ++ return -EINVAL; ++ } + } + } + +@@ -196,6 +211,11 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) + { + struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); + ++ if (priv->dr_mode == USB_DR_MODE_HOST) ++ regmap_update_bits(priv->regmap, REG_DBG_UART, ++ REG_DBG_UART_SET_IDDQ, ++ REG_DBG_UART_SET_IDDQ); ++ + clk_disable_unprepare(priv->clk_usb); + clk_disable_unprepare(priv->clk_usb_general); + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0058-FROMGIT-phy-amlogic-meson8b-usb2-Add-a-compatible-st.patch b/projects/Amlogic/patches/linux/amlogic-0058-FROMGIT-phy-amlogic-meson8b-usb2-Add-a-compatible-st.patch new file mode 100644 index 0000000000..f8dae7dd4c --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0058-FROMGIT-phy-amlogic-meson8b-usb2-Add-a-compatible-st.patch @@ -0,0 +1,56 @@ +From d3ffc291448009eb2790ceb68d3388ee6914f378 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:11:10 +0000 +Subject: [PATCH 058/156] FROMGIT: phy: amlogic: meson8b-usb2: Add a compatible + string for Meson8m2 + +The 3.10 vendor kernel sets the ACA_ENABLE bit on Meson8b, Meson8m2 and +GXBB, but not on Meson8. Add a compatible string for Meson8m2 which also +sets that bit. +While here, also update the Kconfig text and MODULE_DESCRIPTION. + +Tested-by: Thomas Graichen +Signed-off-by: Martin Blumenstingl +--- + drivers/phy/amlogic/Kconfig | 2 +- + drivers/phy/amlogic/phy-meson8b-usb2.c | 6 +++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/phy/amlogic/Kconfig b/drivers/phy/amlogic/Kconfig +index 3495b23af797..5ec53874d1ea 100644 +--- a/drivers/phy/amlogic/Kconfig ++++ b/drivers/phy/amlogic/Kconfig +@@ -3,7 +3,7 @@ + # Phy drivers for Amlogic platforms + # + config PHY_MESON8B_USB2 +- tristate "Meson8, Meson8b and GXBB USB2 PHY driver" ++ tristate "Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY driver" + default ARCH_MESON + depends on OF && (ARCH_MESON || COMPILE_TEST) + depends on USB_SUPPORT +diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c +index 436dfa1a8a04..03c061dd5f0d 100644 +--- a/drivers/phy/amlogic/phy-meson8b-usb2.c ++++ b/drivers/phy/amlogic/phy-meson8b-usb2.c +@@ -302,6 +302,10 @@ static const struct of_device_id phy_meson8b_usb2_of_match[] = { + .compatible = "amlogic,meson8b-usb2-phy", + .data = &phy_meson8b_usb2_match_data + }, ++ { ++ .compatible = "amlogic,meson8m2-usb2-phy", ++ .data = &phy_meson8b_usb2_match_data ++ }, + { + .compatible = "amlogic,meson-gxbb-usb2-phy", + .data = &phy_meson8b_usb2_match_data +@@ -320,5 +324,5 @@ static struct platform_driver phy_meson8b_usb2_driver = { + module_platform_driver(phy_meson8b_usb2_driver); + + MODULE_AUTHOR("Martin Blumenstingl "); +-MODULE_DESCRIPTION("Meson8, Meson8b and GXBB USB2 PHY driver"); ++MODULE_DESCRIPTION("Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY driver"); + MODULE_LICENSE("GPL"); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0059-FROMGIT-ARM-dts-meson-Add-the-Ethernet-timing-adjust.patch b/projects/Amlogic/patches/linux/amlogic-0059-FROMGIT-ARM-dts-meson-Add-the-Ethernet-timing-adjust.patch new file mode 100644 index 0000000000..bc6f6ac932 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0059-FROMGIT-ARM-dts-meson-Add-the-Ethernet-timing-adjust.patch @@ -0,0 +1,51 @@ +From 33fd227a0f99d3b068e18fb5338a2e748ca7600c Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:17:35 +0000 +Subject: [PATCH 059/156] FROMGIT: ARM: dts: meson: Add the Ethernet + "timing-adjustment" clock + +Add the "timing-adjusment" clock now that we now that this is connected +to the PRG_ETHERNET registers. It is used internally to generate the +RGMII RX delay no the MAC side (if needed). + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/meson8b.dtsi | 5 +++-- + arch/arm/boot/dts/meson8m2.dtsi | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi +index e34b039b9357..ba36168b9c1b 100644 +--- a/arch/arm/boot/dts/meson8b.dtsi ++++ b/arch/arm/boot/dts/meson8b.dtsi +@@ -425,8 +425,9 @@ + + clocks = <&clkc CLKID_ETH>, + <&clkc CLKID_MPLL2>, +- <&clkc CLKID_MPLL2>; +- clock-names = "stmmaceth", "clkin0", "clkin1"; ++ <&clkc CLKID_MPLL2>, ++ <&clkc CLKID_FCLK_DIV2>; ++ clock-names = "stmmaceth", "clkin0", "clkin1", "timing-adjustment"; + rx-fifo-depth = <4096>; + tx-fifo-depth = <2048>; + +diff --git a/arch/arm/boot/dts/meson8m2.dtsi b/arch/arm/boot/dts/meson8m2.dtsi +index 5bde7f502007..96b37d5e9afd 100644 +--- a/arch/arm/boot/dts/meson8m2.dtsi ++++ b/arch/arm/boot/dts/meson8m2.dtsi +@@ -30,8 +30,9 @@ + 0xc1108140 0x8>; + clocks = <&clkc CLKID_ETH>, + <&clkc CLKID_MPLL2>, +- <&clkc CLKID_MPLL2>; +- clock-names = "stmmaceth", "clkin0", "clkin1"; ++ <&clkc CLKID_MPLL2>, ++ <&clkc CLKID_FCLK_DIV2>; ++ clock-names = "stmmaceth", "clkin0", "clkin1", "timing-adjustment"; + resets = <&reset RESET_ETHERNET>; + reset-names = "stmmaceth"; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0060-FROMGIT-ARM-dts-meson-Switch-existing-boards-with-RG.patch b/projects/Amlogic/patches/linux/amlogic-0060-FROMGIT-ARM-dts-meson-Switch-existing-boards-with-RG.patch new file mode 100644 index 0000000000..6bd11ec3cb --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0060-FROMGIT-ARM-dts-meson-Switch-existing-boards-with-RG.patch @@ -0,0 +1,66 @@ +From 378ae7eb141b427a108a288e04eb588ffd3b5d6e Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 1 Jun 2020 09:18:32 +0000 +Subject: [PATCH 060/156] FROMGIT: ARM: dts: meson: Switch existing boards with + RGMII PHY to "rgmii-id" + +Let the PHY generate the RX and TX delay on the Odroid-C1 and MXIII +Plus. + +Previously we did not know that these boards used an RX delay. We +assumed that setting the TX delay on the MAC side It turns out that +these boards also require an RX delay of 2ns (verified on Odroid-C1, +but the u-boot code uses the same setup on both boards). Ethernet only +worked because u-boot added this RX delay on the MAC side. + +The 4ns TX delay was also wrong and the result of using an unsupported +RGMII TX clock divider setting. This has been fixed in the driver with +commit bd6f48546b9cb7 ("net: stmmac: dwmac-meson8b: Fix the RGMII TX +delay on Meson8b/8m2 SoCs"). + +Switch to phy-mode "rgmii-id" to let the PHY side handle all the delays, +(as recommended by the Ethernet maintainers anyways) to correctly +describe the need for a 2ns RX as well as 2ns TX delay on these boards. +This fixes the Ethernet performance on Odroid-C1 where there was a huge +amount of packet loss when transmitting data due to the incorrect TX +delay. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/meson8b-odroidc1.dts | 3 +-- + arch/arm/boot/dts/meson8m2-mxiii-plus.dts | 4 +--- + 2 files changed, 2 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts +index a2a47804fc4a..cb21ac9f517c 100644 +--- a/arch/arm/boot/dts/meson8b-odroidc1.dts ++++ b/arch/arm/boot/dts/meson8b-odroidc1.dts +@@ -202,9 +202,8 @@ + pinctrl-0 = <ð_rgmii_pins>; + pinctrl-names = "default"; + +- phy-mode = "rgmii"; + phy-handle = <ð_phy>; +- amlogic,tx-delay-ns = <4>; ++ phy-mode = "rgmii-id"; + + nvmem-cells = <ðernet_mac_address>; + nvmem-cell-names = "mac-address"; +diff --git a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts +index d54477b1001c..cc498191ddd1 100644 +--- a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts ++++ b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts +@@ -69,9 +69,7 @@ + pinctrl-names = "default"; + + phy-handle = <ð_phy0>; +- phy-mode = "rgmii"; +- +- amlogic,tx-delay-ns = <4>; ++ phy-mode = "rgmii-id"; + + mdio { + compatible = "snps,dwmac-mdio"; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0061-FROMGIT-mmc-meson-gx-limit-segments-to-1-when-dram-a.patch b/projects/Amlogic/patches/linux/amlogic-0061-FROMGIT-mmc-meson-gx-limit-segments-to-1-when-dram-a.patch new file mode 100644 index 0000000000..db7e3eea1f --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0061-FROMGIT-mmc-meson-gx-limit-segments-to-1-when-dram-a.patch @@ -0,0 +1,46 @@ +From 4a444578a62a65e4ac503903586e3dd2f96c277e Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Tue, 24 Dec 2019 05:50:45 +0000 +Subject: [PATCH 061/156] FROMGIT: mmc: meson-gx: limit segments to 1 when + dram-access-quirk is needed + +The actual max_segs computation leads to failure while using the broadcom +sdio brcmfmac/bcmsdh driver, since the driver tries to make usage of scatter +gather. + +But with the dram-access-quirk we use a 1,5K SRAM bounce buffer, and the +max_segs current value of 3 leads to max transfers to 4,5k, which doesn't work. + +This patch sets max_segs to 1 to better describe the hardware limitation, +and fix the SDIO functionnality with the brcmfmac/bcmsdh driver on Amlogic +G12A/G12B SoCs on boards like SEI510 or Khadas VIM3. + +Reported-by: Art Nikpal +Reported-by: Christian Hewitt +Fixes: acdc8e71d9bb ("mmc: meson-gx: add dram-access-quirk") +Signed-off-by: Neil Armstrong +--- + 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..cfaf8e7e22ec 100644 +--- a/drivers/mmc/host/meson-gx-mmc.c ++++ b/drivers/mmc/host/meson-gx-mmc.c +@@ -1143,9 +1143,11 @@ static int meson_mmc_probe(struct platform_device *pdev) + + mmc->caps |= MMC_CAP_CMD23; + if (host->dram_access_quirk) { ++ /* Limit segments to 1 due to low available sram memory */ ++ mmc->max_segs = 1; + /* 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_blk_count = SD_EMMC_SRAM_DATA_BUF_LEN / ++ mmc->max_blk_size; + } else { + mmc->max_blk_count = CMD_CFG_LENGTH_MASK; + mmc->max_segs = SD_EMMC_DESC_BUF_LEN / +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0062-FROMLIST-v1-media-meson-vdec-fix-another-case-of-VP9.patch b/projects/Amlogic/patches/linux/amlogic-0062-FROMLIST-v1-media-meson-vdec-fix-another-case-of-VP9.patch new file mode 100644 index 0000000000..835661408e --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0062-FROMLIST-v1-media-meson-vdec-fix-another-case-of-VP9.patch @@ -0,0 +1,133 @@ +From 72c952cf507307726829c28521cf3f477a473ebd Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Sat, 2 May 2020 21:16:37 +0000 +Subject: [PATCH 062/156] FROMLIST(v1): media: meson: vdec: fix another case of + VP9 buffer shortage + +- Redo the logic where VP9 gets fresh CAPTURE buffers. The previous code + could lead to a hardlock. +- Reserve 4 margin buffers instead of 3, as apparently there are corner + cases where 3 is not enough. + +Fixes: e9a3eb4819ca ("media: meson: vdec: add VP9 input support") +Fixes: 00c43088aa68 ("media: meson: vdec: add VP9 decoder support") +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/codec_vp9.c | 41 +++++++++++++------- + drivers/staging/media/meson/vdec/esparser.c | 24 ++++++------ + 2 files changed, 38 insertions(+), 27 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +index 897f5d7a6aad..28a7e62e7371 100644 +--- a/drivers/staging/media/meson/vdec/codec_vp9.c ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -1185,6 +1185,29 @@ static void codec_vp9_set_mc(struct amvdec_session *sess, + amvdec_write_dos(core, VP9D_MPP_REF_SCALE_ENBL, scale); + } + ++/* ++ * Get a free VB2 buffer that isn't currently used. ++ * VP9 references are held sometimes for so long that it's not really an option ++ * to hold them until they're no longer referenced, as it would delay the ++ * CAPTURE queue too much ++ */ ++static struct vb2_v4l2_buffer *get_free_vbuf(struct amvdec_session *sess) ++{ ++ struct codec_vp9 *vp9 = sess->priv; ++ struct vb2_v4l2_buffer *vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); ++ struct vb2_v4l2_buffer *vbuf2; ++ ++ if (!vbuf) ++ return NULL; ++ ++ if (!codec_vp9_get_frame_by_idx(vp9, vbuf->vb2_buf.index)) ++ return vbuf; ++ ++ vbuf2 = get_free_vbuf(sess); ++ v4l2_m2m_buf_queue(sess->m2m_ctx, vbuf); ++ return vbuf2; ++} ++ + static struct vp9_frame *codec_vp9_get_new_frame(struct amvdec_session *sess) + { + struct codec_vp9 *vp9 = sess->priv; +@@ -1196,25 +1219,13 @@ static struct vp9_frame *codec_vp9_get_new_frame(struct amvdec_session *sess) + if (!new_frame) + return NULL; + +- vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); ++ vbuf = get_free_vbuf(sess); + 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; +@@ -1267,8 +1278,10 @@ static void codec_vp9_process_frame(struct amvdec_session *sess) + codec_vp9_rm_noshow_frame(sess); + + vp9->cur_frame = codec_vp9_get_new_frame(sess); +- if (!vp9->cur_frame) ++ if (!vp9->cur_frame) { ++ amvdec_abort(sess); + return; ++ } + + pr_debug("frame %d: type: %08X; show_exist: %u; show: %u, intra_only: %u\n", + vp9->cur_frame->index, +diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c +index db7022707ff8..814bb0587e3b 100644 +--- a/drivers/staging/media/meson/vdec/esparser.c ++++ b/drivers/staging/media/meson/vdec/esparser.c +@@ -301,21 +301,19 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + u32 offset; + u32 pad_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); +- ++ 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); ++ /* ++ * When max ref frame is held by VP9, this should be -= 4 ++ * 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) +- num_dst_bufs -= 3; ++ num_dst_bufs -= 4; + + if (esparser_vififo_get_free_space(sess) < payload_size || + atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs) +-- +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/projects/Amlogic/patches/linux/amlogic-0063-FROMLIST-v2-drm-bridge-dw-hdmi-do-not-force-none-sca.patch similarity index 68% rename from packages/linux/patches/amlogic/amlogic-0104-FROMLIST-drm-bridge-dw-hdmi-do-not-force-none-scan-m.patch rename to projects/Amlogic/patches/linux/amlogic-0063-FROMLIST-v2-drm-bridge-dw-hdmi-do-not-force-none-sca.patch index 025cff0fd7..7b38481428 100644 --- a/packages/linux/patches/amlogic/amlogic-0104-FROMLIST-drm-bridge-dw-hdmi-do-not-force-none-scan-m.patch +++ b/projects/Amlogic/patches/linux/amlogic-0063-FROMLIST-v2-drm-bridge-dw-hdmi-do-not-force-none-sca.patch @@ -1,16 +1,18 @@ -From ead734fa3522fd224e9ad975206ee4784b64add5 Mon Sep 17 00:00:00 2001 +From ac95514d0458ea95693ab88361743ea7caf82269 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 +Date: Wed, 13 May 2020 03:09:58 +0000 +Subject: [PATCH 063/156] FROMLIST(v2): 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, +change overscan percentage 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. +Reviewed-by: Neil Armstrong +Acked-by: Laurent Pinchart Signed-off-by: Jonas Karlman [updated commit message] Signed-off-by: Jernej Skrabec @@ -19,10 +21,10 @@ Signed-off-by: Jernej Skrabec 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 +index 512398dbeb76..30681398cfb0 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) +@@ -1689,8 +1689,6 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; } diff --git a/projects/Amlogic/patches/linux/amlogic-0064-FROMLIST-v2-drm-meson-add-mode-selection-limits-agai.patch b/projects/Amlogic/patches/linux/amlogic-0064-FROMLIST-v2-drm-meson-add-mode-selection-limits-agai.patch new file mode 100644 index 0000000000..2919f5dd12 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0064-FROMLIST-v2-drm-meson-add-mode-selection-limits-agai.patch @@ -0,0 +1,182 @@ +From 79a8f40793bc9369dab486a2a2456cf34da6cd2a Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Sat, 2 May 2020 21:13:37 +0000 +Subject: [PATCH 064/156] FROMLIST(v2): drm/meson: add mode selection limits + against specific SoC revisions + +The Amlogic S805X/Y uses the same die as the S905X, but with more +limited graphics capabilities. + +This adds a soc version detection adding specific limitations on the HDMI +mode selections. + +Here, we limit to HDMI 1.2a max HDMI PHY clock frequency. + +Changes sinces v1: +- Moved frequency check in the vclk code, and also checks DMT modes + +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_drv.c | 29 ++++++++++++++++++++++++++- + drivers/gpu/drm/meson/meson_drv.h | 6 ++++++ + drivers/gpu/drm/meson/meson_dw_hdmi.c | 2 +- + drivers/gpu/drm/meson/meson_vclk.c | 16 ++++++++++++++- + drivers/gpu/drm/meson/meson_vclk.h | 3 ++- + 5 files changed, 52 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 8c2e1b47e81a..5326e4585f3b 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -183,6 +184,24 @@ static void meson_remove_framebuffers(void) + kfree(ap); + } + ++struct meson_drm_soc_attr { ++ struct meson_drm_soc_limits limits; ++ const struct soc_device_attribute *attrs; ++}; ++ ++static const struct meson_drm_soc_attr meson_drm_soc_attrs[] = { ++ /* S805X/S805Y HDMI PLL won't lock for HDMI PHY freq > 1,65GHz */ ++ { ++ .limits = { ++ .max_hdmi_phy_freq = 1650000, ++ }, ++ .attrs = (const struct soc_device_attribute []) { ++ { .soc_id = "GXL (S805*)", }, ++ { /* sentinel */ }, ++ } ++ }, ++}; ++ + static int meson_drv_bind_master(struct device *dev, bool has_components) + { + struct platform_device *pdev = to_platform_device(dev); +@@ -191,7 +210,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + struct drm_device *drm; + struct resource *res; + void __iomem *regs; +- int ret; ++ int ret, i; + + /* Checks if an output connector is available */ + if (!meson_vpu_has_available_connectors(dev)) { +@@ -281,6 +300,14 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + if (ret) + goto free_drm; + ++ /* Assign limits per soc revision/package */ ++ for (i = 0 ; i < ARRAY_SIZE(meson_drm_soc_attrs) ; ++i) { ++ if (soc_device_match(meson_drm_soc_attrs[i].attrs)) { ++ priv->limits = &meson_drm_soc_attrs[i].limits; ++ break; ++ } ++ } ++ + /* Remove early framebuffers (ie. simplefb) */ + meson_remove_framebuffers(); + +diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h +index 04fdf3826643..5b23704a80d6 100644 +--- a/drivers/gpu/drm/meson/meson_drv.h ++++ b/drivers/gpu/drm/meson/meson_drv.h +@@ -30,6 +30,10 @@ struct meson_drm_match_data { + struct meson_afbcd_ops *afbcd_ops; + }; + ++struct meson_drm_soc_limits { ++ unsigned int max_hdmi_phy_freq; ++}; ++ + struct meson_drm { + struct device *dev; + enum vpu_compatible compat; +@@ -48,6 +52,8 @@ struct meson_drm { + struct drm_plane *primary_plane; + struct drm_plane *overlay_plane; + ++ const struct meson_drm_soc_limits *limits; ++ + /* Components Data */ + struct { + bool osd1_enabled; +diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c +index 64cb6ba4bc42..24a12c453095 100644 +--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c +@@ -695,7 +695,7 @@ dw_hdmi_mode_valid(struct drm_connector *connector, + 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(phy_freq, vclk_freq); ++ return meson_vclk_vic_supported_freq(priv, phy_freq, vclk_freq); + } + + /* Encoder */ +diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c +index fdf26dac9fa8..0eb86943a358 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.c ++++ b/drivers/gpu/drm/meson/meson_vclk.c +@@ -725,6 +725,13 @@ meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned int freq) + /* In DMT mode, path after PLL is always /10 */ + freq *= 10; + ++ /* Check against soc revision/package limits */ ++ if (priv->limits) { ++ if (priv->limits->max_hdmi_phy_freq && ++ freq > priv->limits->max_hdmi_phy_freq) ++ return MODE_CLOCK_HIGH; ++ } ++ + if (meson_hdmi_pll_find_params(priv, freq, &m, &frac, &od)) + return MODE_OK; + +@@ -762,7 +769,7 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv, + } + + enum drm_mode_status +-meson_vclk_vic_supported_freq(unsigned int phy_freq, ++meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq, + unsigned int vclk_freq) + { + int i; +@@ -770,6 +777,13 @@ meson_vclk_vic_supported_freq(unsigned int phy_freq, + DRM_DEBUG_DRIVER("phy_freq = %d vclk_freq = %d\n", + phy_freq, vclk_freq); + ++ /* Check against soc revision/package limits */ ++ if (priv->limits) { ++ if (priv->limits->max_hdmi_phy_freq && ++ phy_freq > priv->limits->max_hdmi_phy_freq) ++ return MODE_CLOCK_HIGH; ++ } ++ + for (i = 0 ; params[i].pixel_freq ; ++i) { + DRM_DEBUG_DRIVER("i = %d pixel_freq = %d alt = %d\n", + i, params[i].pixel_freq, +diff --git a/drivers/gpu/drm/meson/meson_vclk.h b/drivers/gpu/drm/meson/meson_vclk.h +index aed0ab2efa71..60617aaf18dd 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.h ++++ b/drivers/gpu/drm/meson/meson_vclk.h +@@ -25,7 +25,8 @@ 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 phy_freq, unsigned int vclk_freq); ++meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq, ++ unsigned int vclk_freq); + + void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + unsigned int phy_freq, unsigned int vclk_freq, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch b/projects/Amlogic/patches/linux/amlogic-0065-FROMLIST-v6-drm-fourcc-Add-modifier-definitions-for-.patch similarity index 56% rename from packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch rename to projects/Amlogic/patches/linux/amlogic-0065-FROMLIST-v6-drm-fourcc-Add-modifier-definitions-for-.patch index 07224e5d7c..d7e42e6310 100644 --- a/packages/linux/patches/amlogic/amlogic-0115-FROMLIST-drm-fourcc-Add-modifier-definitions-for-des.patch +++ b/projects/Amlogic/patches/linux/amlogic-0065-FROMLIST-v6-drm-fourcc-Add-modifier-definitions-for-.patch @@ -1,8 +1,8 @@ -From 36766de5db4a3e886c5465e8f2a7cc20178ae50e Mon Sep 17 00:00:00 2001 +From 943052b9741ed51335759aa9fc4d3dd702937409 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 +Date: Thu, 14 May 2020 05:24:17 +0000 +Subject: [PATCH 065/156] FROMLIST(v6): 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 @@ -19,21 +19,21 @@ per component, YCbCr 420, single plane : 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. +This introduces the basic layout composed of: +- a body content organized in 64x32 superblocks with 4096 bytes per + superblock in default mode. +- a 32 bytes per 128x64 header block +This layout is tranferrable between Amlogic SoCs supporting this modifier. + +Tested-by: Kevin Hilman Signed-off-by: Neil Armstrong --- - include/uapi/drm/drm_fourcc.h | 56 +++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) + include/uapi/drm/drm_fourcc.h | 74 +++++++++++++++++++++++++++++++++++ + 1 file changed, 74 insertions(+) diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 8bc0b31597d8..8a6e87bacadb 100644 +index 8bc0b31597d8..b7596ba2af30 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -309,6 +309,7 @@ extern "C" { @@ -44,7 +44,7 @@ index 8bc0b31597d8..8a6e87bacadb 100644 /* add more to the end as needed */ -@@ -804,6 +805,61 @@ extern "C" { +@@ -804,6 +805,79 @@ extern "C" { */ #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) @@ -57,39 +57,56 @@ index 8bc0b31597d8..8a6e87bacadb 100644 + * + * 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: ++ * The first 8 bits of the mode defines the layout, then the following 8 bits ++ * defines the options changing the layout. ++ * ++ * Not all combinations are valid, and different SoCs may support different ++ * combinations of layout and options. ++ */ ++#define __fourcc_mod_amlogic_layout_mask 0xf ++#define __fourcc_mod_amlogic_options_shift 8 ++#define __fourcc_mod_amlogic_options_mask 0xf ++ ++#define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \ ++ fourcc_mod_code(AMLOGIC, \ ++ ((__layout) & __fourcc_mod_amlogic_layout_mask) | \ ++ ((__options) & __fourcc_mod_amlogic_options_mask \ ++ << __fourcc_mod_amlogic_options_shift)) ++ ++/* Amlogic FBC Layouts */ ++ ++/* ++ * Amlogic FBC Basic Layout ++ * ++ * The basic layout 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. ++ * This layout is transferrable between Amlogic SoCs supporting this modifier. + */ -+#define DRM_FORMAT_MOD_AMLOGIC_FBC(__modes) fourcc_mod_code(AMLOGIC, __modes) ++#define AMLOGIC_FBC_LAYOUT_BASIC (1ULL) + +/* + * 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. ++ * execution and cannot be saved/dumped neither transferrable between ++ * Amlogic SoCs supporting this modifier. + */ -+#define DRM_FORMAT_MOD_AMLOGIC_FBC_SCATTER (1ULL << 0) ++#define AMLOGIC_FBC_LAYOUT_SCATTER (2ULL) ++ ++/* Amlogic FBC Layout Options Bit Mask */ + +/* + * Amlogic FBC Memory Saving mode @@ -98,10 +115,11 @@ index 8bc0b31597d8..8a6e87bacadb 100644 + * 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. ++ * This mode reduces body layout to 3072 bytes per 64x32 superblock with ++ * the basic layout and 3200 bytes per 64x32 superblock combined with ++ * the scatter layout. + */ -+#define DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING (1ULL << 1) ++#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0) + #if defined(__cplusplus) } diff --git a/packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch b/projects/Amlogic/patches/linux/amlogic-0066-FROMLIST-v6-drm-meson-add-Amlogic-Video-FBC-register.patch similarity index 88% rename from packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch rename to projects/Amlogic/patches/linux/amlogic-0066-FROMLIST-v6-drm-meson-add-Amlogic-Video-FBC-register.patch index 66dc4a80ac..62cafd06a0 100644 --- a/packages/linux/patches/amlogic/amlogic-0116-FROMLIST-drm-meson-add-Amlogic-Video-FBC-registers.patch +++ b/projects/Amlogic/patches/linux/amlogic-0066-FROMLIST-v6-drm-meson-add-Amlogic-Video-FBC-register.patch @@ -1,11 +1,13 @@ -From a46e55e018d8de7f28bedd7bda0ca5816856469f Mon Sep 17 00:00:00 2001 +From 0d7e2b5f292fa9d610f350a34f14c118363e2eca 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 +Date: Thu, 14 May 2020 05:25:15 +0000 +Subject: [PATCH 066/156] FROMLIST(v6): drm/meson: add Amlogic Video FBC + registers Add the registers of the VPU VD1 Amlogic FBC decoder module, and routing register. +Tested-by: Kevin Hilman Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_registers.h | 22 ++++++++++++++++++++++ diff --git a/packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch b/projects/Amlogic/patches/linux/amlogic-0067-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch similarity index 81% rename from packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch rename to projects/Amlogic/patches/linux/amlogic-0067-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch index 4d242c7e88..c17967190e 100644 --- a/packages/linux/patches/amlogic/amlogic-0117-FROMLIST-drm-meson-overlay-setup-overlay-for-Amlogic.patch +++ b/projects/Amlogic/patches/linux/amlogic-0067-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch @@ -1,7 +1,7 @@ -From 2efbbf6375425dee26a2e6e5e0c91822959734bc Mon Sep 17 00:00:00 2001 +From 7c02cb1631ac73dc407980584f70e816bce2fad6 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 +Date: Thu, 14 May 2020 05:26:04 +0000 +Subject: [PATCH 067/156] FROMLIST(v6): drm/meson: overlay: setup overlay for Amlogic FBC Setup the Amlogic FBC decoder for the VD1 video overlay plane. @@ -9,23 +9,21 @@ 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. +This adds support for the basic layout, and needs to calculate the content +body size since the header is allocated after. +Tested-by: Kevin Hilman 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(-) + drivers/gpu/drm/meson/meson_overlay.c | 252 +++++++++++++++++++++++++- + 2 files changed, 260 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 +index 5b23704a80d6..177dac3ca3be 100644 --- a/drivers/gpu/drm/meson/meson_drv.h +++ b/drivers/gpu/drm/meson/meson_drv.h -@@ -80,6 +80,7 @@ struct meson_drm { +@@ -86,6 +86,7 @@ struct meson_drm { bool vd1_enabled; bool vd1_commit; @@ -33,7 +31,7 @@ index 04fdf3826643..da951964e988 100644 unsigned int vd1_planes; uint32_t vd1_if0_gen_reg; uint32_t vd1_if0_luma_x0; -@@ -105,6 +106,21 @@ struct meson_drm { +@@ -111,6 +112,21 @@ struct meson_drm { uint32_t vd1_height0; uint32_t vd1_height1; uint32_t vd1_height2; @@ -56,7 +54,7 @@ index 04fdf3826643..da951964e988 100644 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 +index 2468b0212d52..2713d008cee8 100644 --- a/drivers/gpu/drm/meson/meson_overlay.c +++ b/drivers/gpu/drm/meson/meson_overlay.c @@ -5,6 +5,7 @@ @@ -239,7 +237,7 @@ index 2468b0212d52..1fbb81732e9a 100644 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, +@@ -350,11 +479,57 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, spin_lock_irqsave(&priv->drm->event_lock, flags); @@ -248,20 +246,14 @@ index 2468b0212d52..1fbb81732e9a 100644 - 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)) { ++ if ((fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC(0, 0)) == ++ DRM_FORMAT_MOD_AMLOGIC_FBC(0, 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); @@ -308,7 +300,7 @@ index 2468b0212d52..1fbb81732e9a 100644 /* 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, +@@ -370,6 +545,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; @@ -316,7 +308,7 @@ index 2468b0212d52..1fbb81732e9a 100644 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, +@@ -488,13 +664,28 @@ 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, @@ -329,38 +321,24 @@ index 2468b0212d52..1fbb81732e9a 100644 } + 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; ++ 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; ++ /* Default mode is 4k per superblock */ ++ body_size = (ALIGN(priv->viu.vd1_stride0, 64) / 64) * ++ (ALIGN(priv->viu.vd1_height0, 32) / 32) * ++ 4096; + -+ 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; + -+ 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; -+ } ++ /* 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 = { +@@ -531,6 +722,42 @@ static const struct drm_plane_helper_funcs meson_overlay_helper_funcs = { .prepare_fb = drm_gem_fb_prepare_fb, }; @@ -372,11 +350,30 @@ index 2468b0212d52..1fbb81732e9a 100644 + 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)) ++ if ((modifier & DRM_FORMAT_MOD_AMLOGIC_FBC(0, 0)) == ++ DRM_FORMAT_MOD_AMLOGIC_FBC(0, 0)) { ++ unsigned int layout = modifier & ++ DRM_FORMAT_MOD_AMLOGIC_FBC( ++ __fourcc_mod_amlogic_layout_mask, 0); ++ ++ if (format != DRM_FORMAT_YUV420_8BIT && ++ format != DRM_FORMAT_YUV420_10BIT) { ++ DRM_DEBUG_KMS("%llx invalid format 0x%08x\n", ++ modifier, format); ++ return false; ++ } ++ ++ if (layout != AMLOGIC_FBC_LAYOUT_BASIC) { ++ DRM_DEBUG_KMS("%llx invalid layout %x\n", ++ modifier, layout); ++ return false; ++ } ++ + return true; ++ } ++ ++ DRM_DEBUG_KMS("invalid modifier %llx for format 0x%08x\n", ++ modifier, format); + + return false; +} @@ -384,7 +381,7 @@ index 2468b0212d52..1fbb81732e9a 100644 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 = { +@@ -538,6 +765,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, @@ -392,7 +389,7 @@ index 2468b0212d52..1fbb81732e9a 100644 }; static const uint32_t supported_drm_formats[] = { -@@ -549,6 +778,18 @@ static const uint32_t supported_drm_formats[] = { +@@ -549,6 +777,14 @@ static const uint32_t supported_drm_formats[] = { DRM_FORMAT_YUV420, DRM_FORMAT_YUV411, DRM_FORMAT_YUV410, @@ -401,17 +398,13 @@ index 2468b0212d52..1fbb81732e9a 100644 +}; + +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_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, 0), + 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) +@@ -570,7 +806,7 @@ int meson_overlay_create(struct meson_drm *priv) &meson_overlay_funcs, supported_drm_formats, ARRAY_SIZE(supported_drm_formats), diff --git a/projects/Amlogic/patches/linux/amlogic-0068-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch b/projects/Amlogic/patches/linux/amlogic-0068-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch new file mode 100644 index 0000000000..4ab0b50dfa --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0068-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch @@ -0,0 +1,86 @@ +From e12f5acc80287163a23a72ee07859bb9ce9938e4 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 14 May 2020 05:27:47 +0000 +Subject: [PATCH 068/156] FROMLIST(v6): drm/meson: overlay: setup overlay for + Amlogic FBC Memory Saving mode + +Setup the Amlogic FBC decoder for the VD1 video overlay plane to use +a different superblock size for the Memory Saving mode. + +Tested-by: Kevin Hilman +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_overlay.c | 25 +++++++++++++++++++++++-- + 1 file changed, 23 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c +index 2713d008cee8..b5c502876428 100644 +--- a/drivers/gpu/drm/meson/meson_overlay.c ++++ b/drivers/gpu/drm/meson/meson_overlay.c +@@ -487,6 +487,10 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + AFBC_HOLD_LINE_NUM(8) | + AFBC_BURST_LEN(2); + ++ if (fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC(0, ++ AMLOGIC_FBC_OPTION_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); +@@ -672,12 +676,17 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + } + + if (priv->viu.vd1_afbc) { ++ /* Default mode is 4k per superblock */ ++ unsigned long block_size = 4096; + unsigned long body_size; + +- /* Default mode is 4k per superblock */ ++ /* 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) * +- 4096; ++ block_size; + + priv->viu.vd1_afbc_body_addr = priv->viu.vd1_addr0 >> 4; + +@@ -735,6 +744,9 @@ static bool meson_overlay_format_mod_supported(struct drm_plane *plane, + unsigned int layout = modifier & + DRM_FORMAT_MOD_AMLOGIC_FBC( + __fourcc_mod_amlogic_layout_mask, 0); ++ unsigned int options = ++ (modifier >> __fourcc_mod_amlogic_options_shift) & ++ __fourcc_mod_amlogic_options_mask; + + if (format != DRM_FORMAT_YUV420_8BIT && + format != DRM_FORMAT_YUV420_10BIT) { +@@ -749,6 +761,13 @@ static bool meson_overlay_format_mod_supported(struct drm_plane *plane, + return false; + } + ++ if (options && ++ options != AMLOGIC_FBC_OPTION_MEM_SAVING) { ++ DRM_DEBUG_KMS("%llx invalid layout %x\n", ++ modifier, layout); ++ return false; ++ } ++ + return true; + } + +@@ -782,6 +801,8 @@ static const uint32_t supported_drm_formats[] = { + }; + + static const uint64_t format_modifiers[] = { ++ DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, ++ AMLOGIC_FBC_OPTION_MEM_SAVING), + DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, 0), + DRM_FORMAT_MOD_LINEAR, + DRM_FORMAT_MOD_INVALID, +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0069-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch b/projects/Amlogic/patches/linux/amlogic-0069-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch new file mode 100644 index 0000000000..7b73e215a8 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0069-FROMLIST-v6-drm-meson-overlay-setup-overlay-for-Amlo.patch @@ -0,0 +1,105 @@ +From c8ef474b0c20ba98054f57203144bb91929354bf Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 14 May 2020 05:28:39 +0000 +Subject: [PATCH 069/156] FROMLIST(v6): drm/meson: overlay: setup overlay for + Amlogic FBC Scatter Memory layout + +Setup the Amlogic FBC decoder for the VD1 video overlay plane to use +read the FBC header as Scatter Memory layout reference. + +Tested-by: Kevin Hilman +Signed-off-by: Neil Armstrong +--- + drivers/gpu/drm/meson/meson_overlay.c | 53 ++++++++++++++++++--------- + 1 file changed, 35 insertions(+), 18 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c +index b5c502876428..6aef28767fc1 100644 +--- a/drivers/gpu/drm/meson/meson_overlay.c ++++ b/drivers/gpu/drm/meson/meson_overlay.c +@@ -491,6 +491,10 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + AMLOGIC_FBC_OPTION_MEM_SAVING)) + priv->viu.vd1_afbc_mode |= AFBC_BLK_MEM_MODE; + ++ if ((fb->modifier & __fourcc_mod_amlogic_layout_mask) == ++ AMLOGIC_FBC_LAYOUT_SCATTER) ++ priv->viu.vd1_afbc_mode |= AFBC_SCATTER_MODE; ++ + priv->viu.vd1_afbc_en = 0x1600 | AFBC_DEC_ENABLE; + + priv->viu.vd1_afbc_conv_ctrl = AFBC_CONV_LBUF_LEN(256); +@@ -676,23 +680,32 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, + } + + if (priv->viu.vd1_afbc) { +- /* 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; ++ 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; +@@ -755,7 +768,8 @@ static bool meson_overlay_format_mod_supported(struct drm_plane *plane, + return false; + } + +- if (layout != AMLOGIC_FBC_LAYOUT_BASIC) { ++ if (layout != AMLOGIC_FBC_LAYOUT_BASIC && ++ layout != AMLOGIC_FBC_LAYOUT_SCATTER) { + DRM_DEBUG_KMS("%llx invalid layout %x\n", + modifier, layout); + return false; +@@ -801,8 +815,11 @@ static const uint32_t supported_drm_formats[] = { + }; + + static const uint64_t format_modifiers[] = { ++ DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_SCATTER, ++ AMLOGIC_FBC_OPTION_MEM_SAVING), + DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, + AMLOGIC_FBC_OPTION_MEM_SAVING), ++ DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_SCATTER, 0), + DRM_FORMAT_MOD_AMLOGIC_FBC(AMLOGIC_FBC_LAYOUT_BASIC, 0), + DRM_FORMAT_MOD_LINEAR, + DRM_FORMAT_MOD_INVALID, +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch b/projects/Amlogic/patches/linux/amlogic-0070-FROMLIST-v6-drm-meson-crtc-handle-commit-of-Amlogic-.patch similarity index 94% rename from packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch rename to projects/Amlogic/patches/linux/amlogic-0070-FROMLIST-v6-drm-meson-crtc-handle-commit-of-Amlogic-.patch index bbe9a1ff95..674055fdf5 100644 --- a/packages/linux/patches/amlogic/amlogic-0118-FROMLIST-drm-meson-crtc-handle-commit-of-Amlogic-FBC.patch +++ b/projects/Amlogic/patches/linux/amlogic-0070-FROMLIST-v6-drm-meson-crtc-handle-commit-of-Amlogic-.patch @@ -1,19 +1,20 @@ -From bf2cfb439d3d0936b3636b88d0c793a0a2b8c8a6 Mon Sep 17 00:00:00 2001 +From 6fde0633ecbb79675898bcb518b5150b61f10d72 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 +Date: Thu, 14 May 2020 05:29:36 +0000 +Subject: [PATCH 070/156] FROMLIST(v6): 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. +Tested-by: Kevin Hilman 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 +index e66b6271ff58..2854272dc2d9 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) @@ -129,7 +130,7 @@ index e66b6271ff58..d6dcfd654e9c 100644 + MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR, + MESON_CANVAS_ENDIAN_SWAP64); -+ /* fallthrough */ ++ fallthrough; + case 2: + meson_canvas_config(priv->canvas, + priv->canvas_id_vd1_1, @@ -139,7 +140,7 @@ index e66b6271ff58..d6dcfd654e9c 100644 + MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR, + MESON_CANVAS_ENDIAN_SWAP64); -+ /* fallthrough */ ++ fallthrough; + case 1: + meson_canvas_config(priv->canvas, + priv->canvas_id_vd1_0, diff --git a/projects/Amlogic/patches/linux/amlogic-0071-FROMLIST-v1-thermal-devfreq_cooling-Use-PM-QoS-to-se.patch b/projects/Amlogic/patches/linux/amlogic-0071-FROMLIST-v1-thermal-devfreq_cooling-Use-PM-QoS-to-se.patch new file mode 100644 index 0000000000..9febdab6e2 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0071-FROMLIST-v1-thermal-devfreq_cooling-Use-PM-QoS-to-se.patch @@ -0,0 +1,165 @@ +From 9b363f58982cad5066cf071bda8b8b169595e9ce Mon Sep 17 00:00:00 2001 +From: Matthias Kaehlcke +Date: Wed, 18 Mar 2020 11:45:46 +0000 +Subject: [PATCH 071/156] FROMLIST(v1): thermal: devfreq_cooling: Use PM QoS to + set frequency limits + +Now that devfreq supports limiting the frequency range of a device +through PM QoS make use of it instead of disabling OPPs that should +not be used. + +The switch from disabling OPPs to PM QoS introduces a subtle behavioral +change in case of conflicting requests (min > max): PM QoS gives +precedence to the MIN_FREQUENCY request, while higher OPPs disabled +with dev_pm_opp_disable() would override MIN_FREQUENCY. + +Signed-off-by: Matthias Kaehlcke +Reviewed-by: Lukasz Luba +Reviewed-by: Chanwoo Choi +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20200318114548.19916-4-lukasz.luba@arm.com +--- + drivers/thermal/devfreq_cooling.c | 70 ++++++++++--------------------- + 1 file changed, 23 insertions(+), 47 deletions(-) + +diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c +index a87d4fa031c8..f7f32e98331b 100644 +--- a/drivers/thermal/devfreq_cooling.c ++++ b/drivers/thermal/devfreq_cooling.c +@@ -24,11 +24,13 @@ + #include + #include + #include ++#include + #include + + #include + +-#define SCALE_ERROR_MITIGATION 100 ++#define HZ_PER_KHZ 1000 ++#define SCALE_ERROR_MITIGATION 100 + + static DEFINE_IDA(devfreq_ida); + +@@ -54,6 +56,8 @@ static DEFINE_IDA(devfreq_ida); + * The 'res_util' range is from 100 to (power_table[state] * 100) + * for the corresponding 'state'. + * @capped_state: index to cooling state with in dynamic power budget ++ * @req_max_freq: PM QoS request for limiting the maximum frequency ++ * of the devfreq device. + */ + struct devfreq_cooling_device { + int id; +@@ -66,49 +70,9 @@ struct devfreq_cooling_device { + struct devfreq_cooling_power *power_ops; + u32 res_util; + int capped_state; ++ struct dev_pm_qos_request req_max_freq; + }; + +-/** +- * partition_enable_opps() - disable all opps above a given state +- * @dfc: Pointer to devfreq we are operating on +- * @cdev_state: cooling device state we're setting +- * +- * Go through the OPPs of the device, enabling all OPPs until +- * @cdev_state and disabling those frequencies above it. +- */ +-static int partition_enable_opps(struct devfreq_cooling_device *dfc, +- unsigned long cdev_state) +-{ +- int i; +- struct device *dev = dfc->devfreq->dev.parent; +- +- for (i = 0; i < dfc->freq_table_size; i++) { +- struct dev_pm_opp *opp; +- int ret = 0; +- unsigned int freq = dfc->freq_table[i]; +- bool want_enable = i >= cdev_state ? true : false; +- +- opp = dev_pm_opp_find_freq_exact(dev, freq, !want_enable); +- +- if (PTR_ERR(opp) == -ERANGE) +- continue; +- else if (IS_ERR(opp)) +- return PTR_ERR(opp); +- +- dev_pm_opp_put(opp); +- +- if (want_enable) +- ret = dev_pm_opp_enable(dev, freq); +- else +- ret = dev_pm_opp_disable(dev, freq); +- +- if (ret) +- return ret; +- } +- +- return 0; +-} +- + static int devfreq_cooling_get_max_state(struct thermal_cooling_device *cdev, + unsigned long *state) + { +@@ -135,7 +99,7 @@ static int devfreq_cooling_set_cur_state(struct thermal_cooling_device *cdev, + struct devfreq_cooling_device *dfc = cdev->devdata; + struct devfreq *df = dfc->devfreq; + struct device *dev = df->dev.parent; +- int ret; ++ unsigned long freq; + + if (state == dfc->cooling_state) + return 0; +@@ -145,9 +109,10 @@ static int devfreq_cooling_set_cur_state(struct thermal_cooling_device *cdev, + if (state >= dfc->freq_table_size) + return -EINVAL; + +- ret = partition_enable_opps(dfc, state); +- if (ret) +- return ret; ++ freq = dfc->freq_table[state]; ++ ++ dev_pm_qos_update_request(&dfc->req_max_freq, ++ DIV_ROUND_UP(freq, HZ_PER_KHZ)); + + dfc->cooling_state = state; + +@@ -530,9 +495,15 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df, + if (err) + goto free_dfc; + +- err = ida_simple_get(&devfreq_ida, 0, 0, GFP_KERNEL); ++ err = dev_pm_qos_add_request(df->dev.parent, &dfc->req_max_freq, ++ DEV_PM_QOS_MAX_FREQUENCY, ++ PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE); + if (err < 0) + goto free_tables; ++ ++ err = ida_simple_get(&devfreq_ida, 0, 0, GFP_KERNEL); ++ if (err < 0) ++ goto remove_qos_req; + dfc->id = err; + + snprintf(dev_name, sizeof(dev_name), "thermal-devfreq-%d", dfc->id); +@@ -553,6 +524,10 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df, + + release_ida: + ida_simple_remove(&devfreq_ida, dfc->id); ++ ++remove_qos_req: ++ dev_pm_qos_remove_request(&dfc->req_max_freq); ++ + free_tables: + kfree(dfc->power_table); + kfree(dfc->freq_table); +@@ -601,6 +576,7 @@ void devfreq_cooling_unregister(struct thermal_cooling_device *cdev) + + thermal_cooling_device_unregister(dfc->cdev); + ida_simple_remove(&devfreq_ida, dfc->id); ++ dev_pm_qos_remove_request(&dfc->req_max_freq); + kfree(dfc->power_table); + kfree(dfc->freq_table); + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0072-FROMLIST-v1-drm-meson-Remove-unneeded-semicolon.patch b/projects/Amlogic/patches/linux/amlogic-0072-FROMLIST-v1-drm-meson-Remove-unneeded-semicolon.patch new file mode 100644 index 0000000000..262df70786 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0072-FROMLIST-v1-drm-meson-Remove-unneeded-semicolon.patch @@ -0,0 +1,31 @@ +From a572fc90cded0c91f821d521ff73df226e001089 Mon Sep 17 00:00:00 2001 +From: Zheng Bin +Date: Sat, 25 Apr 2020 03:27:24 +0000 +Subject: [PATCH 072/156] FROMLIST(v1): drm/meson: Remove unneeded semicolon + +Fixes coccicheck warning: + +drivers/gpu/drm/meson/meson_plane.c:226:3-4: Unneeded semicolon + +Reported-by: Hulk Robot +Signed-off-by: Zheng Bin +--- + drivers/gpu/drm/meson/meson_plane.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c +index d5cbc47835bf..35338ed18209 100644 +--- a/drivers/gpu/drm/meson/meson_plane.c ++++ b/drivers/gpu/drm/meson/meson_plane.c +@@ -223,7 +223,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane, + priv->viu.osd1_blk0_cfg[0] |= OSD_BLK_MODE_16 | + OSD_COLOR_MATRIX_16_RGB565; + break; +- }; ++ } + } + + switch (fb->format->format) { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0073-FROMLIST-v1-drm-meson-viu-fix-setting-the-OSD-burst-.patch b/projects/Amlogic/patches/linux/amlogic-0073-FROMLIST-v1-drm-meson-viu-fix-setting-the-OSD-burst-.patch new file mode 100644 index 0000000000..a94d6f6c9e --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0073-FROMLIST-v1-drm-meson-viu-fix-setting-the-OSD-burst-.patch @@ -0,0 +1,81 @@ +From a635aca8df52f601c4ea1cb3facaafb697ca98d9 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 26 Apr 2020 02:39:25 +0000 +Subject: [PATCH 073/156] FROMLIST(v1): drm/meson: viu: fix setting the OSD + burst length in VIU_OSD1_FIFO_CTRL_STAT + +The burst length is configured in VIU_OSD1_FIFO_CTRL_STAT[31] and +VIU_OSD1_FIFO_CTRL_STAT[11:10]. The public S905D3 datasheet describes +this as: +- 0x0 = up to 24 per burst +- 0x1 = up to 32 per burst +- 0x2 = up to 48 per burst +- 0x3 = up to 64 per burst +- 0x4 = up to 96 per burst +- 0x5 = up to 128 per burst + +The lower two bits map to VIU_OSD1_FIFO_CTRL_STAT[11:10] while the upper +bit maps to VIU_OSD1_FIFO_CTRL_STAT[31]. + +Replace meson_viu_osd_burst_length_reg() with pre-defined macros which +set these values. meson_viu_osd_burst_length_reg() always returned 0 +(for the two used values: 32 and 64 at least) and thus incorrectly set +the burst size to 24. + +Fixes: 147ae1cbaa1842 ("drm: meson: viu: use proper macros instead of magic constants") +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_registers.h | 6 ++++++ + drivers/gpu/drm/meson/meson_viu.c | 11 ++--------- + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h +index 08631fdfe4b9..446e7961da48 100644 +--- a/drivers/gpu/drm/meson/meson_registers.h ++++ b/drivers/gpu/drm/meson/meson_registers.h +@@ -266,6 +266,12 @@ + #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 VIU_OSD_BURST_LENGTH_24 (0x0 << 31 | 0x0 << 10) ++#define VIU_OSD_BURST_LENGTH_32 (0x0 << 31 | 0x1 << 10) ++#define VIU_OSD_BURST_LENGTH_48 (0x0 << 31 | 0x2 << 10) ++#define VIU_OSD_BURST_LENGTH_64 (0x0 << 31 | 0x3 << 10) ++#define VIU_OSD_BURST_LENGTH_96 (0x1 << 31 | 0x0 << 10) ++#define VIU_OSD_BURST_LENGTH_128 (0x1 << 31 | 0x1 << 10) + + #define VD1_IF0_GEN_REG 0x1a50 + #define VD1_IF0_CANVAS0 0x1a51 +diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c +index 304f8ff1339c..aede0c67a57f 100644 +--- a/drivers/gpu/drm/meson/meson_viu.c ++++ b/drivers/gpu/drm/meson/meson_viu.c +@@ -411,13 +411,6 @@ void meson_viu_gxm_disable_osd1_afbc(struct meson_drm *priv) + priv->io_base + _REG(VIU_MISC_CTRL1)); + } + +-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; +@@ -444,9 +437,9 @@ void meson_viu_init(struct meson_drm *priv) + VIU_OSD_FIFO_LIMITS(2); /* fifo_lim: 2*16=32 */ + + if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) +- reg |= meson_viu_osd_burst_length_reg(32); ++ reg |= VIU_OSD_BURST_LENGTH_32; + else +- reg |= meson_viu_osd_burst_length_reg(64); ++ reg |= VIU_OSD_BURST_LENGTH_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)); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0074-FROMLIST-v2-dt-bindings-mfd-add-Khadas-Microcontroll.patch b/projects/Amlogic/patches/linux/amlogic-0074-FROMLIST-v2-dt-bindings-mfd-add-Khadas-Microcontroll.patch new file mode 100644 index 0000000000..a0b269d2bd --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0074-FROMLIST-v2-dt-bindings-mfd-add-Khadas-Microcontroll.patch @@ -0,0 +1,72 @@ +From d26d256820295d3be624ef05b407dad787794a85 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 12:52:30 +0000 +Subject: [PATCH 074/156] FROMLIST(v2): dt-bindings: mfd: add Khadas + Microcontroller bindings + +This Microcontroller is present on the Khadas VIM1, VIM2, VIM3 and Edge +boards. + +It has multiple boot control features like password check, power-on +options, power-off control and system FAN control on recent boards. + +Signed-off-by: Neil Armstrong +Reviewed-by: Rob Herring +--- + .../devicetree/bindings/mfd/khadas,mcu.yaml | 44 +++++++++++++++++++ + 1 file changed, 44 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/khadas,mcu.yaml + +diff --git a/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml +new file mode 100644 +index 000000000000..a3b976f101e8 +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml +@@ -0,0 +1,44 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/khadas,mcu.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Khadas on-board Microcontroller Device Tree Bindings ++ ++maintainers: ++ - Neil Armstrong ++ ++description: | ++ Khadas embeds a microcontroller on their VIM and Edge boards adding some ++ system feature as PWM Fan control (for VIM2 rev14 or VIM3), User memory ++ storage, IR/Key resume control, system power LED control and more. ++ ++properties: ++ compatible: ++ enum: ++ - khadas,mcu # MCU revision is discoverable ++ ++ "#cooling-cells": # Only needed for boards having FAN control feature ++ const: 2 ++ ++ reg: ++ maxItems: 1 ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ i2c { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ khadas_mcu: system-controller@18 { ++ compatible = "khadas,mcu"; ++ reg = <0x18>; ++ #cooling-cells = <2>; ++ }; ++ }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0075-FROMLIST-v2-mfd-add-support-for-the-Khadas-System-co.patch b/projects/Amlogic/patches/linux/amlogic-0075-FROMLIST-v2-mfd-add-support-for-the-Khadas-System-co.patch new file mode 100644 index 0000000000..ac3e7d1194 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0075-FROMLIST-v2-mfd-add-support-for-the-Khadas-System-co.patch @@ -0,0 +1,310 @@ +From e96c9fe545682054b949641d4451853baa83f8f2 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 12:53:44 +0000 +Subject: [PATCH 075/156] FROMLIST(v2): mfd: add support for the Khadas System + control Microcontroller + +This Microcontroller is present on the Khadas VIM1, VIM2, VIM3 and Edge +boards. + +It has multiple boot control features like password check, power-on +options, power-off control and system FAN control on recent boards. + +This implements a very basic MFD driver with the fan control and User +NVMEM cells. + +Signed-off-by: Neil Armstrong +--- + drivers/mfd/Kconfig | 14 ++++ + drivers/mfd/Makefile | 1 + + drivers/mfd/khadas-mcu.c | 143 +++++++++++++++++++++++++++++++++ + include/linux/mfd/khadas-mcu.h | 91 +++++++++++++++++++++ + 4 files changed, 249 insertions(+) + create mode 100644 drivers/mfd/khadas-mcu.c + create mode 100644 include/linux/mfd/khadas-mcu.h + +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index 0a59249198d3..b95091397052 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -2003,6 +2003,20 @@ config MFD_WCD934X + This driver provides common support WCD934x audio codec and its + associated Pin Controller, Soundwire Controller and Audio codec. + ++config MFD_KHADAS_MCU ++ tristate "Support for Khadas System control Microcontroller" ++ depends on I2C ++ depends on OF || COMPILE_TEST ++ select MFD_CORE ++ select REGMAP_I2C ++ help ++ Support for the Khadas System control Microcontroller interface present ++ on their VIM and Edge boards. ++ ++ This driver provides common support for accessing the device, ++ additional drivers must be enabled in order to use the functionality ++ of the device. ++ + menu "Multimedia Capabilities Port drivers" + depends on ARCH_SA1100 + +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index f935d10cbf0f..0f1633b096bb 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -257,5 +257,6 @@ obj-$(CONFIG_MFD_ROHM_BD70528) += rohm-bd70528.o + obj-$(CONFIG_MFD_ROHM_BD71828) += rohm-bd71828.o + obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o + obj-$(CONFIG_MFD_STMFX) += stmfx.o ++obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o + + obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o +diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c +new file mode 100644 +index 000000000000..6d08fa2e373a +--- /dev/null ++++ b/drivers/mfd/khadas-mcu.c +@@ -0,0 +1,143 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Driver for Khadas System control Microcontroller ++ * ++ * Copyright (C) 2020 BayLibre SAS ++ * Author(s): Neil Armstrong ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static bool khadas_mcu_reg_volatile(struct device *dev, unsigned int reg) ++{ ++ if (reg >= KHADAS_MCU_USER_DATA_0_REG && ++ reg < KHADAS_MCU_PWR_OFF_CMD_REG) ++ return true; ++ ++ switch (reg) { ++ case KHADAS_MCU_PWR_OFF_CMD_REG: ++ case KHADAS_MCU_PASSWD_START_REG: ++ case KHADAS_MCU_CHECK_VEN_PASSWD_REG: ++ case KHADAS_MCU_CHECK_USER_PASSWD_REG: ++ case KHADAS_MCU_WOL_INIT_START_REG: ++ case KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static bool khadas_mcu_reg_writeable(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case KHADAS_MCU_PASSWD_VEN_0_REG: ++ case KHADAS_MCU_PASSWD_VEN_1_REG: ++ case KHADAS_MCU_PASSWD_VEN_2_REG: ++ case KHADAS_MCU_PASSWD_VEN_3_REG: ++ case KHADAS_MCU_PASSWD_VEN_4_REG: ++ case KHADAS_MCU_PASSWD_VEN_5_REG: ++ case KHADAS_MCU_MAC_0_REG: ++ case KHADAS_MCU_MAC_1_REG: ++ case KHADAS_MCU_MAC_2_REG: ++ case KHADAS_MCU_MAC_3_REG: ++ case KHADAS_MCU_MAC_4_REG: ++ case KHADAS_MCU_MAC_5_REG: ++ case KHADAS_MCU_USID_0_REG: ++ case KHADAS_MCU_USID_1_REG: ++ case KHADAS_MCU_USID_2_REG: ++ case KHADAS_MCU_USID_3_REG: ++ case KHADAS_MCU_USID_4_REG: ++ case KHADAS_MCU_USID_5_REG: ++ case KHADAS_MCU_VERSION_0_REG: ++ case KHADAS_MCU_VERSION_1_REG: ++ case KHADAS_MCU_DEVICE_NO_0_REG: ++ case KHADAS_MCU_DEVICE_NO_1_REG: ++ case KHADAS_MCU_FACTORY_TEST_REG: ++ case KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG: ++ return false; ++ default: ++ return true; ++ } ++} ++ ++static const struct regmap_config khadas_mcu_regmap_config = { ++ .reg_bits = 8, ++ .reg_stride = 1, ++ .val_bits = 8, ++ .max_register = KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, ++ .volatile_reg = khadas_mcu_reg_volatile, ++ .writeable_reg = khadas_mcu_reg_writeable, ++ .cache_type = REGCACHE_RBTREE, ++}; ++ ++static struct mfd_cell khadas_mcu_fan_cells[] = { ++ /* Feature supported only on VIM1/2 Rev13+ and VIM3 */ ++ { .name = "khadas-mcu-fan-ctrl", }, ++}; ++ ++static struct mfd_cell khadas_mcu_cells[] = { ++ /* Features supported on all board revisions */ ++ { .name = "khadas-mcu-user-mem", }, ++}; ++ ++static int khadas_mcu_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct device *dev = &client->dev; ++ struct khadas_mcu *khadas_mcu; ++ int ret; ++ ++ khadas_mcu = devm_kzalloc(dev, sizeof(*khadas_mcu), GFP_KERNEL); ++ if (!khadas_mcu) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(client, khadas_mcu); ++ ++ khadas_mcu->dev = dev; ++ ++ khadas_mcu->map = devm_regmap_init_i2c(client, ++ &khadas_mcu_regmap_config); ++ if (IS_ERR(khadas_mcu->map)) { ++ ret = PTR_ERR(khadas_mcu->map); ++ dev_err(dev, "Failed to allocate register map: %d\n", ret); ++ return ret; ++ } ++ ++ ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, ++ khadas_mcu_cells, ++ ARRAY_SIZE(khadas_mcu_cells), ++ NULL, 0, NULL); ++ if (ret) ++ return ret; ++ ++ if (of_find_property(dev->of_node, "#cooling-cells", NULL)) ++ return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, ++ khadas_mcu_fan_cells, ++ ARRAY_SIZE(khadas_mcu_fan_cells), ++ NULL, 0, NULL); ++ ++ return 0; ++} ++ ++static const struct of_device_id khadas_mcu_of_match[] = { ++ { .compatible = "khadas,mcu", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, khadas_mcu_of_match); ++ ++static struct i2c_driver khadas_mcu_driver = { ++ .driver = { ++ .name = "khadas-mcu-core", ++ .of_match_table = of_match_ptr(khadas_mcu_of_match), ++ }, ++ .probe = khadas_mcu_probe, ++}; ++module_i2c_driver(khadas_mcu_driver); ++ ++MODULE_DESCRIPTION("Khadas MCU core driver"); ++MODULE_AUTHOR("Neil Armstrong "); ++MODULE_LICENSE("GPL v2"); +diff --git a/include/linux/mfd/khadas-mcu.h b/include/linux/mfd/khadas-mcu.h +new file mode 100644 +index 000000000000..2e68af21735c +--- /dev/null ++++ b/include/linux/mfd/khadas-mcu.h +@@ -0,0 +1,91 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Khadas System control Microcontroller Register map ++ * ++ * Copyright (C) 2020 BayLibre SAS ++ * Author(s): Neil Armstrong ++ */ ++ ++#ifndef MFD_KHADAS_MCU_H ++#define MFD_KHADAS_MCU_H ++ ++#define KHADAS_MCU_PASSWD_VEN_0_REG 0x0 /* RO */ ++#define KHADAS_MCU_PASSWD_VEN_1_REG 0x1 /* RO */ ++#define KHADAS_MCU_PASSWD_VEN_2_REG 0x2 /* RO */ ++#define KHADAS_MCU_PASSWD_VEN_3_REG 0x3 /* RO */ ++#define KHADAS_MCU_PASSWD_VEN_4_REG 0x4 /* RO */ ++#define KHADAS_MCU_PASSWD_VEN_5_REG 0x5 /* RO */ ++#define KHADAS_MCU_MAC_0_REG 0x6 /* RO */ ++#define KHADAS_MCU_MAC_1_REG 0x7 /* RO */ ++#define KHADAS_MCU_MAC_2_REG 0x8 /* RO */ ++#define KHADAS_MCU_MAC_3_REG 0x9 /* RO */ ++#define KHADAS_MCU_MAC_4_REG 0xa /* RO */ ++#define KHADAS_MCU_MAC_5_REG 0xb /* RO */ ++#define KHADAS_MCU_USID_0_REG 0xc /* RO */ ++#define KHADAS_MCU_USID_1_REG 0xd /* RO */ ++#define KHADAS_MCU_USID_2_REG 0xe /* RO */ ++#define KHADAS_MCU_USID_3_REG 0xf /* RO */ ++#define KHADAS_MCU_USID_4_REG 0x10 /* RO */ ++#define KHADAS_MCU_USID_5_REG 0x11 /* RO */ ++#define KHADAS_MCU_VERSION_0_REG 0x12 /* RO */ ++#define KHADAS_MCU_VERSION_1_REG 0x13 /* RO */ ++#define KHADAS_MCU_DEVICE_NO_0_REG 0x14 /* RO */ ++#define KHADAS_MCU_DEVICE_NO_1_REG 0x15 /* RO */ ++#define KHADAS_MCU_FACTORY_TEST_REG 0x16 /* R */ ++#define KHADAS_MCU_BOOT_MODE_REG 0x20 /* RW */ ++#define KHADAS_MCU_BOOT_EN_WOL_REG 0x21 /* RW */ ++#define KHADAS_MCU_BOOT_EN_RTC_REG 0x22 /* RW */ ++#define KHADAS_MCU_BOOT_EN_EXP_REG 0x23 /* RW */ ++#define KHADAS_MCU_BOOT_EN_IR_REG 0x24 /* RW */ ++#define KHADAS_MCU_BOOT_EN_DCIN_REG 0x25 /* RW */ ++#define KHADAS_MCU_BOOT_EN_KEY_REG 0x26 /* RW */ ++#define KHADAS_MCU_KEY_MODE_REG 0x27 /* RW */ ++#define KHADAS_MCU_LED_MODE_ON_REG 0x28 /* RW */ ++#define KHADAS_MCU_LED_MODE_OFF_REG 0x29 /* RW */ ++#define KHADAS_MCU_SHUTDOWN_NORMAL_REG 0x2c /* RW */ ++#define KHADAS_MCU_MAC_SWITCH_REG 0x2d /* RW */ ++#define KHADAS_MCU_MCU_SLEEP_MODE_REG 0x2e /* RW */ ++#define KHADAS_MCU_IR_CODE1_0_REG 0x2f /* RW */ ++#define KHADAS_MCU_IR_CODE1_1_REG 0x30 /* RW */ ++#define KHADAS_MCU_IR_CODE1_2_REG 0x31 /* RW */ ++#define KHADAS_MCU_IR_CODE1_3_REG 0x32 /* RW */ ++#define KHADAS_MCU_USB_PCIE_SWITCH_REG 0x33 /* RW */ ++#define KHADAS_MCU_IR_CODE2_0_REG 0x34 /* RW */ ++#define KHADAS_MCU_IR_CODE2_1_REG 0x35 /* RW */ ++#define KHADAS_MCU_IR_CODE2_2_REG 0x36 /* RW */ ++#define KHADAS_MCU_IR_CODE2_3_REG 0x37 /* RW */ ++#define KHADAS_MCU_PASSWD_USER_0_REG 0x40 /* RW */ ++#define KHADAS_MCU_PASSWD_USER_1_REG 0x41 /* RW */ ++#define KHADAS_MCU_PASSWD_USER_2_REG 0x42 /* RW */ ++#define KHADAS_MCU_PASSWD_USER_3_REG 0x43 /* RW */ ++#define KHADAS_MCU_PASSWD_USER_4_REG 0x44 /* RW */ ++#define KHADAS_MCU_PASSWD_USER_5_REG 0x45 /* RW */ ++#define KHADAS_MCU_USER_DATA_0_REG 0x46 /* RW 56 bytes */ ++#define KHADAS_MCU_PWR_OFF_CMD_REG 0x80 /* WO */ ++#define KHADAS_MCU_PASSWD_START_REG 0x81 /* WO */ ++#define KHADAS_MCU_CHECK_VEN_PASSWD_REG 0x82 /* WO */ ++#define KHADAS_MCU_CHECK_USER_PASSWD_REG 0x83 /* WO */ ++#define KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG 0x86 /* RO */ ++#define KHADAS_MCU_WOL_INIT_START_REG 0x87 /* WO */ ++#define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG 0x88 /* WO */ ++ ++/* Boards */ ++enum { ++ KHADAS_BOARD_VIM1 = 0x1, ++ KHADAS_BOARD_VIM2, ++ KHADAS_BOARD_VIM3, ++ KHADAS_BOARD_EDGE = 0x11, ++ KHADAS_BOARD_EDGE_V, ++}; ++ ++/** ++ * struct khadas_mcu_data - Khadas MCU MFD structure ++ * @device: device reference used for logs ++ * @map: register map ++ */ ++struct khadas_mcu { ++ struct device *dev; ++ struct regmap *map; ++}; ++ ++#endif /* MFD_KHADAS_MCU_H */ +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0076-FROMLIST-v2-thermal-add-support-for-the-MCU-controll.patch b/projects/Amlogic/patches/linux/amlogic-0076-FROMLIST-v2-thermal-add-support-for-the-MCU-controll.patch new file mode 100644 index 0000000000..c503b3c4d4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0076-FROMLIST-v2-thermal-add-support-for-the-MCU-controll.patch @@ -0,0 +1,231 @@ +From 1e9ea85d0249f0cc7cd8fd17f59c6cc75a99a84a Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 12:54:59 +0000 +Subject: [PATCH 076/156] FROMLIST(v2): thermal: add support for the MCU + controlled FAN on Khadas boards + +The new Khadas VIM2 and VIM3 boards controls the cooling fan via the +on-board microcontroller. + +This implements the FAN control as thermal devices and as cell of the Khadas +MCU MFD driver. + +Signed-off-by: Neil Armstrong +--- + drivers/thermal/Kconfig | 10 ++ + drivers/thermal/Makefile | 1 + + drivers/thermal/khadas_mcu_fan.c | 174 +++++++++++++++++++++++++++++++ + 3 files changed, 185 insertions(+) + create mode 100644 drivers/thermal/khadas_mcu_fan.c + +diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig +index 91af271e9bb0..72b3960cc5ac 100644 +--- a/drivers/thermal/Kconfig ++++ b/drivers/thermal/Kconfig +@@ -490,4 +490,14 @@ config SPRD_THERMAL + help + Support for the Spreadtrum thermal sensor driver in the Linux thermal + framework. ++ ++config KHADAS_MCU_FAN_THERMAL ++ tristate "Khadas MCU controller FAN cooling support" ++ depends on OF || COMPILE_TEST ++ select MFD_CORE ++ select REGMAP ++ help ++ If you say yes here you get support for the FAN controlled ++ by the Microcontroller found on the Khadas VIM boards. ++ + endif +diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile +index 8c8ed7b79915..460428c2122c 100644 +--- a/drivers/thermal/Makefile ++++ b/drivers/thermal/Makefile +@@ -60,3 +60,4 @@ obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o + obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o + obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o + obj-$(CONFIG_SPRD_THERMAL) += sprd_thermal.o ++obj-$(CONFIG_KHADAS_MCU_FAN_THERMAL) += khadas_mcu_fan.o +diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_fan.c +new file mode 100644 +index 000000000000..044d4aba8be2 +--- /dev/null ++++ b/drivers/thermal/khadas_mcu_fan.c +@@ -0,0 +1,174 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Khadas MCU Controlled FAN driver ++ * ++ * Copyright (C) 2020 BayLibre SAS ++ * Author(s): Neil Armstrong ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MAX_LEVEL 3 ++ ++struct khadas_mcu_fan_ctx { ++ struct khadas_mcu *mcu; ++ unsigned int level; ++ struct thermal_cooling_device *cdev; ++}; ++ ++static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx, ++ unsigned int level) ++{ ++ int ret; ++ ++ ret = regmap_write(ctx->mcu->map, KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, ++ level); ++ if (ret) ++ return ret; ++ ++ ctx->level = level; ++ ++ return 0; ++} ++ ++static int khadas_mcu_fan_get_max_state(struct thermal_cooling_device *cdev, ++ unsigned long *state) ++{ ++ struct khadas_mcu_fan_ctx *ctx = cdev->devdata; ++ ++ if (!ctx) ++ return -EINVAL; ++ ++ *state = MAX_LEVEL; ++ ++ return 0; ++} ++ ++static int khadas_mcu_fan_get_cur_state(struct thermal_cooling_device *cdev, ++ unsigned long *state) ++{ ++ struct khadas_mcu_fan_ctx *ctx = cdev->devdata; ++ ++ if (!ctx) ++ return -EINVAL; ++ ++ *state = ctx->level; ++ ++ return 0; ++} ++ ++static int ++khadas_mcu_fan_set_cur_state(struct thermal_cooling_device *cdev, ++ unsigned long state) ++{ ++ struct khadas_mcu_fan_ctx *ctx = cdev->devdata; ++ ++ if (!ctx || (state > MAX_LEVEL)) ++ return -EINVAL; ++ ++ if (state == ctx->level) ++ return 0; ++ ++ return khadas_mcu_fan_set_level(ctx, state); ++} ++ ++static const struct thermal_cooling_device_ops khadas_mcu_fan_cooling_ops = { ++ .get_max_state = khadas_mcu_fan_get_max_state, ++ .get_cur_state = khadas_mcu_fan_get_cur_state, ++ .set_cur_state = khadas_mcu_fan_set_cur_state, ++}; ++ ++static int khadas_mcu_fan_probe(struct platform_device *pdev) ++{ ++ struct khadas_mcu *mcu = dev_get_drvdata(pdev->dev.parent); ++ struct thermal_cooling_device *cdev; ++ struct device *dev = &pdev->dev; ++ struct khadas_mcu_fan_ctx *ctx; ++ int ret; ++ ++ ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); ++ if (!ctx) ++ return -ENOMEM; ++ ctx->mcu = mcu; ++ platform_set_drvdata(pdev, ctx); ++ ++ cdev = devm_thermal_of_cooling_device_register(dev->parent, ++ dev->parent->of_node, "khadas-mcu-fan", ctx, ++ &khadas_mcu_fan_cooling_ops); ++ if (IS_ERR(cdev)) { ++ ret = PTR_ERR(cdev); ++ dev_err(dev, ++ "Failed to register khadas-mcu-fan as cooling device: %d\n", ++ ret); ++ return ret; ++ } ++ ctx->cdev = cdev; ++ thermal_cdev_update(cdev); ++ ++ return 0; ++} ++ ++static int khadas_mcu_fan_disable(struct device *dev) ++{ ++ struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); ++ unsigned int level_save = ctx->level; ++ int ret; ++ ++ ret = khadas_mcu_fan_set_level(ctx, 0); ++ if (ret) ++ return ret; ++ ++ ctx->level = level_save; ++ ++ return 0; ++} ++ ++static void khadas_mcu_fan_shutdown(struct platform_device *pdev) ++{ ++ khadas_mcu_fan_disable(&pdev->dev); ++} ++ ++#ifdef CONFIG_PM_SLEEP ++static int khadas_mcu_fan_suspend(struct device *dev) ++{ ++ return khadas_mcu_fan_disable(dev); ++} ++ ++static int khadas_mcu_fan_resume(struct device *dev) ++{ ++ struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); ++ ++ return khadas_mcu_fan_set_level(ctx, ctx->level); ++} ++#endif ++ ++static SIMPLE_DEV_PM_OPS(khadas_mcu_fan_pm, khadas_mcu_fan_suspend, ++ khadas_mcu_fan_resume); ++ ++static const struct platform_device_id khadas_mcu_fan_id_table[] = { ++ { .name = "khadas-mcu-fan-ctrl", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(platform, khadas_mcu_fan_id_table); ++ ++static struct platform_driver khadas_mcu_fan_driver = { ++ .probe = khadas_mcu_fan_probe, ++ .shutdown = khadas_mcu_fan_shutdown, ++ .driver = { ++ .name = "khadas-mcu-fan-ctrl", ++ .pm = &khadas_mcu_fan_pm, ++ }, ++ .id_table = khadas_mcu_fan_id_table, ++}; ++ ++module_platform_driver(khadas_mcu_fan_driver); ++ ++MODULE_AUTHOR("Neil Armstrong "); ++MODULE_DESCRIPTION("Khadas MCU FAN driver"); ++MODULE_LICENSE("GPL"); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0077-FROMLIST-v2-nvmem-add-support-for-the-Khadas-MCU-Pro.patch b/projects/Amlogic/patches/linux/amlogic-0077-FROMLIST-v2-nvmem-add-support-for-the-Khadas-MCU-Pro.patch new file mode 100644 index 0000000000..a0487d2671 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0077-FROMLIST-v2-nvmem-add-support-for-the-Khadas-MCU-Pro.patch @@ -0,0 +1,193 @@ +From 9aed6ef7e55f85da21b46def6be06020029f93e9 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 12:56:57 +0000 +Subject: [PATCH 077/156] FROMLIST(v2): nvmem: add support for the Khadas MCU + Programmable User Memory + +The new Khadas VIM2, VIM3 and Edge boards embeds an on-board microcontroller +offering a 56bytes User Programmable NVMEM array. + +This array needs a password to be writable, thus a password sysfs file +has been added on the device node to unlock the NVMEM. + +The default 6bytes password id: "Khadas" + +This implements the user NVMEM devices as cell of the Khadas MCU MFD driver. + +Signed-off-by: Neil Armstrong +--- + drivers/nvmem/Kconfig | 8 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/khadas-mcu-user-mem.c | 128 ++++++++++++++++++++++++++++ + 3 files changed, 138 insertions(+) + create mode 100644 drivers/nvmem/khadas-mcu-user-mem.c + +diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig +index d7b7f6d688e7..92cd4f6aa931 100644 +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -67,6 +67,14 @@ config JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_KHADAS_MCU_USER_MEM ++ tristate "Khadas MCU User programmable memory support" ++ depends on MFD_KHADAS_MCU ++ depends on REGMAP ++ help ++ This is a driver for the MCU User programmable memory ++ available on the Khadas VIM and Edge boards. ++ + config NVMEM_LPC18XX_EEPROM + tristate "NXP LPC18XX EEPROM Memory Support" + depends on ARCH_LPC18XX || COMPILE_TEST +diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile +index a7c377218341..0516a309542d 100644 +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -17,6 +17,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o + obj-$(CONFIG_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_KHADAS_MCU_USER_MEM) += nvmem-khadas-mcu-user-mem.o ++nvmem-khadas-mcu-user-mem-y := khadas-mcu-user-mem.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o + nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o + obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o +diff --git a/drivers/nvmem/khadas-mcu-user-mem.c b/drivers/nvmem/khadas-mcu-user-mem.c +new file mode 100644 +index 000000000000..a1d5ae9a030c +--- /dev/null ++++ b/drivers/nvmem/khadas-mcu-user-mem.c +@@ -0,0 +1,128 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Driver for Khadas MCU User programmable Memory ++ * ++ * Copyright (C) 2020 BayLibre SAS ++ * Author(s): Neil Armstrong ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int khadas_mcu_user_mem_read(void *context, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ struct khadas_mcu *khadas_mcu = context; ++ ++ return regmap_bulk_read(khadas_mcu->map, ++ KHADAS_MCU_USER_DATA_0_REG + offset, ++ val, bytes); ++} ++ ++static int khadas_mcu_user_mem_write(void *context, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ struct khadas_mcu *khadas_mcu = context; ++ ++ return regmap_bulk_write(khadas_mcu->map, ++ KHADAS_MCU_USER_DATA_0_REG + offset, ++ val, bytes); ++} ++ ++static ssize_t password_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct khadas_mcu *khadas_mcu = dev_get_drvdata(dev); ++ int i, ret; ++ ++ if (count < 6) ++ return -EINVAL; ++ ++ ret = regmap_write(khadas_mcu->map, KHADAS_MCU_PASSWD_START_REG, 1); ++ if (ret) ++ return ret; ++ ++ for (i = 0 ; i < 6 ; ++i) { ++ ret = regmap_write(khadas_mcu->map, ++ KHADAS_MCU_CHECK_USER_PASSWD_REG, ++ buf[i]); ++ if (ret) ++ goto out; ++ } ++ ++ ret = regmap_write(khadas_mcu->map, KHADAS_MCU_PASSWD_START_REG, 0); ++ if (ret) ++ return ret; ++ ++ return count; ++out: ++ regmap_write(khadas_mcu->map, KHADAS_MCU_PASSWD_START_REG, 0); ++ ++ return ret; ++} ++ ++static DEVICE_ATTR_WO(password); ++ ++static struct attribute *khadas_mcu_user_mem_sysfs_attributes[] = { ++ &dev_attr_password.attr, ++ NULL, ++}; ++ ++static const struct attribute_group khadas_mcu_user_mem_sysfs_attr_group = { ++ .attrs = khadas_mcu_user_mem_sysfs_attributes, ++}; ++ ++static int khadas_mcu_user_mem_probe(struct platform_device *pdev) ++{ ++ struct khadas_mcu *khadas_mcu = dev_get_drvdata(pdev->dev.parent); ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct nvmem_config *econfig; ++ ++ econfig = devm_kzalloc(dev, sizeof(*econfig), GFP_KERNEL); ++ if (!econfig) ++ return -ENOMEM; ++ ++ econfig->dev = pdev->dev.parent; ++ econfig->name = dev_name(pdev->dev.parent); ++ econfig->stride = 1; ++ econfig->word_size = 1; ++ econfig->reg_read = khadas_mcu_user_mem_read; ++ econfig->reg_write = khadas_mcu_user_mem_write; ++ econfig->size = 56; ++ econfig->priv = khadas_mcu; ++ ++ platform_set_drvdata(pdev, khadas_mcu); ++ ++ nvmem = devm_nvmem_register(&pdev->dev, econfig); ++ if (IS_ERR(nvmem)) ++ return PTR_ERR(nvmem); ++ ++ return sysfs_create_group(&pdev->dev.kobj, ++ &khadas_mcu_user_mem_sysfs_attr_group); ++} ++ ++static const struct platform_device_id khadas_mcu_user_mem_id_table[] = { ++ { .name = "khadas-mcu-user-mem", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(platform, khadas_mcu_user_mem_id_table); ++ ++static struct platform_driver khadas_mcu_user_mem_driver = { ++ .probe = khadas_mcu_user_mem_probe, ++ .driver = { ++ .name = "khadas-mcu-user-mem", ++ }, ++ .id_table = khadas_mcu_user_mem_id_table, ++}; ++ ++module_platform_driver(khadas_mcu_user_mem_driver); ++ ++MODULE_AUTHOR("Neil Armstrong "); ++MODULE_DESCRIPTION("Khadas MCU User MEM driver"); ++MODULE_LICENSE("GPL v2"); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0078-FROMLIST-v2-MAINTAINERS-add-myself-as-maintainer-for.patch b/projects/Amlogic/patches/linux/amlogic-0078-FROMLIST-v2-MAINTAINERS-add-myself-as-maintainer-for.patch new file mode 100644 index 0000000000..b4b2d38b1e --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0078-FROMLIST-v2-MAINTAINERS-add-myself-as-maintainer-for.patch @@ -0,0 +1,38 @@ +From 7b6a71a47fd078c9f6f14da8b08bf27e3bb8deb9 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 12:58:31 +0000 +Subject: [PATCH 078/156] FROMLIST(v2): MAINTAINERS: add myself as maintainer + for Khadas MCU drivers + +Add the HWMON and NVMEM drivers along the MFD drivers and header +as Maintained by myself. + +Signed-off-by: Neil Armstrong +--- + MAINTAINERS | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/MAINTAINERS b/MAINTAINERS +index 091b74ff830a..a389496f2723 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -9436,6 +9436,16 @@ F: include/linux/kdb.h + F: include/linux/kgdb.h + F: kernel/debug/ + ++KHADAS MCU MFD DRIVER ++M: Neil Armstrong ++L: linux-amlogic@lists.infradead.org ++S: Maintained ++F: Documentation/devicetree/bindings/mfd/khadas,mcu.yaml ++F: drivers/mfd/khadas-mcu.c ++F: include/linux/mfd/khadas-mcu.h ++F: drivers/hwmon/khadas-mcu-fan.c ++F: drivers/nvmem/khadas-mcu-user-mem.c ++ + KMEMLEAK + M: Catalin Marinas + S: Maintained +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0079-FROMLIST-v2-arm64-dts-meson-khadas-vim3-add-Khadas-M.patch b/projects/Amlogic/patches/linux/amlogic-0079-FROMLIST-v2-arm64-dts-meson-khadas-vim3-add-Khadas-M.patch new file mode 100644 index 0000000000..e45b8a7cb9 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0079-FROMLIST-v2-arm64-dts-meson-khadas-vim3-add-Khadas-M.patch @@ -0,0 +1,58 @@ +From 984625d91bcbfefb3fb7d6532d8bc2114f9be1ae Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Wed, 13 May 2020 12:59:20 +0000 +Subject: [PATCH 079/156] FROMLIST(v2): arm64: dts: meson-khadas-vim3: add + Khadas MCU nodes + +Add the Khadas MCU node with active FAN thermal nodes for all the +Khadas VIM3 variants. + +Signed-off-by: Neil Armstrong +--- + .../boot/dts/amlogic/meson-khadas-vim3.dtsi | 23 +++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 1ef1e3672b96..27408c10a811 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -183,6 +183,23 @@ + hdmi-phandle = <&hdmi_tx>; + }; + ++&cpu_thermal { ++ trips { ++ cpu_active: cpu-active { ++ temperature = <80000>; /* millicelsius */ ++ hysteresis = <2000>; /* millicelsius */ ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map { ++ trip = <&cpu_active>; ++ cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; ++ }; ++}; ++ + &ext_mdio { + external_phy: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ +@@ -222,6 +239,12 @@ + pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; + pinctrl-names = "default"; + ++ khadas_mcu: system-controller@18 { ++ compatible = "khadas,mcu"; ++ reg = <0x18>; ++ #cooling-cells = <2>; ++ }; ++ + gpio_expander: gpio-controller@20 { + compatible = "ti,tca6408"; + reg = <0x20>; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0080-FROMLIST-v1-ASoC-meson-gx-card-fix-sound-dai-dt-sche.patch b/projects/Amlogic/patches/linux/amlogic-0080-FROMLIST-v1-ASoC-meson-gx-card-fix-sound-dai-dt-sche.patch new file mode 100644 index 0000000000..96177e566f --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0080-FROMLIST-v1-ASoC-meson-gx-card-fix-sound-dai-dt-sche.patch @@ -0,0 +1,48 @@ +From f6370d91aab5db6289f2f878686619f063fdbcc2 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 24 Feb 2020 14:35:17 +0100 +Subject: [PATCH 080/156] FROMLIST(v1): ASoC: meson: gx-card: fix sound-dai dt + schema + +There is a fair amount of warnings when running 'make dtbs_check' with +amlogic,gx-sound-card.yaml. + +Ex: +arch/arm64/boot/dts/amlogic/meson-gxm-q200.dt.yaml: sound: dai-link-0:sound-dai:0:1: missing phandle tag in 0 +arch/arm64/boot/dts/amlogic/meson-gxm-q200.dt.yaml: sound: dai-link-0:sound-dai:0:2: missing phandle tag in 0 +arch/arm64/boot/dts/amlogic/meson-gxm-q200.dt.yaml: sound: dai-link-0:sound-dai:0: [66, 0, 0] is too long + +The reason is that the sound-dai phandle provided has cells, and in such +case the schema should use 'phandle-array' instead of 'phandle'. + +Fixes: fd00366b8e41 ("ASoC: meson: gx: add sound card dt-binding documentation") +Signed-off-by: Jerome Brunet +--- + .../devicetree/bindings/sound/amlogic,gx-sound-card.yaml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml +index fb374c659be1..a48222e8cd08 100644 +--- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml ++++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml +@@ -57,7 +57,7 @@ patternProperties: + rate + + sound-dai: +- $ref: /schemas/types.yaml#/definitions/phandle ++ $ref: /schemas/types.yaml#/definitions/phandle-array + description: phandle of the CPU DAI + + patternProperties: +@@ -71,7 +71,7 @@ patternProperties: + + properties: + sound-dai: +- $ref: /schemas/types.yaml#/definitions/phandle ++ $ref: /schemas/types.yaml#/definitions/phandle-array + description: phandle of the codec DAI + + required: +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch b/projects/Amlogic/patches/linux/amlogic-0081-FROMLIST-v1-ASoC-meson-convert-axg-tdm-interface-to-.patch similarity index 92% rename from packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch rename to projects/Amlogic/patches/linux/amlogic-0081-FROMLIST-v1-ASoC-meson-convert-axg-tdm-interface-to-.patch index 3ed04be6c3..a855b0ab43 100644 --- a/packages/linux/patches/amlogic/amlogic-0036-WIP-ASoC-meson-convert-axg-tdm-interface-to-schema.patch +++ b/projects/Amlogic/patches/linux/amlogic-0081-FROMLIST-v1-ASoC-meson-convert-axg-tdm-interface-to-.patch @@ -1,7 +1,11 @@ -From 0ea69450c57f01517fb17edcb744fc5100c13868 Mon Sep 17 00:00:00 2001 +From ed1ffd86f27e04cb6a89d5949d97d0f86f9cda68 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 +Subject: [PATCH 081/156] FROMLIST(v1): ASoC: meson: convert axg tdm interface + to schema + +Convert the DT binding documentation for the Amlogic tdm interface to +schema. Signed-off-by: Jerome Brunet --- diff --git a/packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch b/projects/Amlogic/patches/linux/amlogic-0082-FROMLIST-v1-ASoC-meson-convert-axg-tdm-formatters-to.patch similarity index 88% rename from packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch rename to projects/Amlogic/patches/linux/amlogic-0082-FROMLIST-v1-ASoC-meson-convert-axg-tdm-formatters-to.patch index 75bd1a1d46..a2013db57d 100644 --- a/packages/linux/patches/amlogic/amlogic-0037-WIP-ASoC-meson-convert-axg-tdm-formatters-to-schema.patch +++ b/projects/Amlogic/patches/linux/amlogic-0082-FROMLIST-v1-ASoC-meson-convert-axg-tdm-formatters-to.patch @@ -1,14 +1,17 @@ -From 8ad9165f35eda957aaeee673475909469945906a Mon Sep 17 00:00:00 2001 +From 001bb8ce0e299728623715eb823b972a6307a2b4 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 +Subject: [PATCH 082/156] FROMLIST(v1): ASoC: meson: convert axg tdm formatters + to schema + +Convert the DT binding documentation for the Amlogic 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(-) + .../sound/amlogic,axg-tdm-formatters.txt | 36 -------- + .../sound/amlogic,axg-tdm-formatters.yaml | 92 +++++++++++++++++++ + 2 files changed, 92 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 @@ -56,10 +59,10 @@ index 5996c0cd89c2..000000000000 -}; 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 +index 000000000000..f6f3bfb546f5 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml -@@ -0,0 +1,101 @@ +@@ -0,0 +1,92 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- @@ -75,20 +78,13 @@ index 000000000000..77b994df0c84 + $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 ++ - amlogic,axg-tdmout + - items: + - enum: + - amlogic,g12a-tdmin @@ -122,7 +118,6 @@ index 000000000000..77b994df0c84 + maxItems: 1 + +required: -+ - "#sound-dai-cells" + - compatible + - reg + - clocks @@ -149,7 +144,6 @@ index 000000000000..77b994df0c84 + 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>, diff --git a/packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch b/projects/Amlogic/patches/linux/amlogic-0083-FROMLIST-v1-ASoC-meson-convert-axg-pdm-to-schema.patch similarity index 94% rename from packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch rename to projects/Amlogic/patches/linux/amlogic-0083-FROMLIST-v1-ASoC-meson-convert-axg-pdm-to-schema.patch index 66bb18892d..88ba3a1e30 100644 --- a/packages/linux/patches/amlogic/amlogic-0038-WIP-ASoC-meson-convert-axg-pdm-to-schema.patch +++ b/projects/Amlogic/patches/linux/amlogic-0083-FROMLIST-v1-ASoC-meson-convert-axg-pdm-to-schema.patch @@ -1,7 +1,10 @@ -From 5368de679f0a3a99ec1c41bb4d7a4d4b3b05021f Mon Sep 17 00:00:00 2001 +From 988af9a7e3d3d5c5db9bc9bf8c7a1d840d8e7cad 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 +Subject: [PATCH 083/156] FROMLIST(v1): ASoC: meson: convert axg pdm to schema + +Convert the DT binding documentation for the Amlogic axg PDM device to +schema. Signed-off-by: Jerome Brunet --- diff --git a/packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch b/projects/Amlogic/patches/linux/amlogic-0084-FROMLIST-v1-ASoC-meson-convert-axg-fifo-to-schema.patch similarity index 95% rename from packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch rename to projects/Amlogic/patches/linux/amlogic-0084-FROMLIST-v1-ASoC-meson-convert-axg-fifo-to-schema.patch index e944bf41bc..74ab543a72 100644 --- a/packages/linux/patches/amlogic/amlogic-0039-WIP-ASoC-meson-convert-axg-fifo-to-schema.patch +++ b/projects/Amlogic/patches/linux/amlogic-0084-FROMLIST-v1-ASoC-meson-convert-axg-fifo-to-schema.patch @@ -1,7 +1,10 @@ -From 0de05051f486a48f7c1a98c9d78ef4d9e4d0fc21 Mon Sep 17 00:00:00 2001 +From 32e581e1e20c6bbfc75c99d9a08cda0e32c349d4 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 +Subject: [PATCH 084/156] FROMLIST(v1): ASoC: meson: convert axg fifo to schema + +Convert the DT binding documentation for the Amlogic axg audio FIFOs to +schema. Signed-off-by: Jerome Brunet --- diff --git a/packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch b/projects/Amlogic/patches/linux/amlogic-0085-FROMLIST-v1-ASoC-meson-convert-axg-spdif-input-to-sc.patch similarity index 94% rename from packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch rename to projects/Amlogic/patches/linux/amlogic-0085-FROMLIST-v1-ASoC-meson-convert-axg-spdif-input-to-sc.patch index 2c31c5fdeb..70a9d93b9b 100644 --- a/packages/linux/patches/amlogic/amlogic-0040-WIP-ASoC-meson-convert-axg-spdif-input-to-schema.patch +++ b/projects/Amlogic/patches/linux/amlogic-0085-FROMLIST-v1-ASoC-meson-convert-axg-spdif-input-to-sc.patch @@ -1,7 +1,11 @@ -From 9542ee0e99f6c34fc0c455502653602343f45880 Mon Sep 17 00:00:00 2001 +From 9374ac6c4840e80551199a47d0ce7934a927244f 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 +Subject: [PATCH 085/156] FROMLIST(v1): ASoC: meson: convert axg spdif input to + schema + +Convert the DT binding documentation for the Amlogic axg spdif input to +schema. Signed-off-by: Jerome Brunet --- diff --git a/packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch b/projects/Amlogic/patches/linux/amlogic-0086-FROMLIST-v1-ASoC-meson-convert-axg-spdif-output-to-s.patch similarity index 93% rename from packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch rename to projects/Amlogic/patches/linux/amlogic-0086-FROMLIST-v1-ASoC-meson-convert-axg-spdif-output-to-s.patch index fea1cd7cd0..653e3bb9e5 100644 --- a/packages/linux/patches/amlogic/amlogic-0041-WIP-ASoC-meson-convert-axg-spdif-output-to-schema.patch +++ b/projects/Amlogic/patches/linux/amlogic-0086-FROMLIST-v1-ASoC-meson-convert-axg-spdif-output-to-s.patch @@ -1,7 +1,11 @@ -From 5692af2959d8c9571500c1f8da856ed6c75f8ffe Mon Sep 17 00:00:00 2001 +From 7b1c07638f9f75bd8955682c3cb5dd497277314d 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 +Subject: [PATCH 086/156] FROMLIST(v1): ASoC: meson: convert axg spdif output + to schema + +Convert the DT binding documentation for the Amlogic axg spdif output to +schema. Signed-off-by: Jerome Brunet --- diff --git a/packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch b/projects/Amlogic/patches/linux/amlogic-0087-FROMLIST-v1-ASoC-meson-convert-g12a-tohdmitx-control.patch similarity index 93% rename from packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch rename to projects/Amlogic/patches/linux/amlogic-0087-FROMLIST-v1-ASoC-meson-convert-g12a-tohdmitx-control.patch index f01b79c63c..8da971f4ea 100644 --- a/packages/linux/patches/amlogic/amlogic-0042-WIP-ASoC-meson-convert-g12a-tohdmitx-control-to-sche.patch +++ b/projects/Amlogic/patches/linux/amlogic-0087-FROMLIST-v1-ASoC-meson-convert-g12a-tohdmitx-control.patch @@ -1,8 +1,11 @@ -From bd5ce2ad81a130c1e57c191efaa4c1b0d14c8351 Mon Sep 17 00:00:00 2001 +From 0ca49b0e3fa2647edc53f0849170e7085f6c755b 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 +Subject: [PATCH 087/156] FROMLIST(v1): ASoC: meson: convert g12a tohdmitx + control to schema + +Convert the DT binding documentation for the Amlogic g12a tohdmitx codec +glue to schema. Signed-off-by: Jerome Brunet --- diff --git a/packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch b/projects/Amlogic/patches/linux/amlogic-0088-FROMLIST-v1-ASoC-meson-convert-axg-sound-card-contro.patch similarity index 95% rename from packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch rename to projects/Amlogic/patches/linux/amlogic-0088-FROMLIST-v1-ASoC-meson-convert-axg-sound-card-contro.patch index fa0a4cf4e6..d522316889 100644 --- a/packages/linux/patches/amlogic/amlogic-0043-WIP-ASoC-meson-convert-axg-sound-card-control-to-sch.patch +++ b/projects/Amlogic/patches/linux/amlogic-0088-FROMLIST-v1-ASoC-meson-convert-axg-sound-card-contro.patch @@ -1,8 +1,11 @@ -From 5c25f36c7a292ca0ec9f5415ae938b111c878ae5 Mon Sep 17 00:00:00 2001 +From 943ae631e86f1fc56fddb022ce95a29ccce9c3da 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 +Subject: [PATCH 088/156] FROMLIST(v1): ASoC: meson: convert axg sound card + control to schema + +Convert the DT binding documentation for the Amlogic axg sound card to +schema. Signed-off-by: Jerome Brunet --- @@ -144,7 +147,7 @@ index 80b411296480..000000000000 -}; 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 +index 000000000000..bb90ac7766ae --- /dev/null +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml @@ -0,0 +1,181 @@ @@ -220,7 +223,7 @@ index 000000000000..168d84b2dcb7 + rate + + sound-dai: -+ $ref: /schemas/types.yaml#/definitions/phandle ++ $ref: /schemas/types.yaml#/definitions/phandle-array + description: phandle of the CPU DAI + + patternProperties: @@ -232,7 +235,7 @@ index 000000000000..168d84b2dcb7 + at one slot, so at least one these mask should be provided with + an enabled slot. + -+ "^codec-[0-9]+$": ++ "^codec(-[0-9]+)?$": + type: object + description: |- + Codecs: @@ -242,7 +245,7 @@ index 000000000000..168d84b2dcb7 + + properties: + sound-dai: -+ $ref: /schemas/types.yaml#/definitions/phandle ++ $ref: /schemas/types.yaml#/definitions/phandle-array + description: phandle of the codec DAI + + patternProperties: @@ -320,7 +323,7 @@ index 000000000000..168d84b2dcb7 + }; + }; + -+ dai-link@3 { ++ dai-link-3 { + sound-dai = <&spdifout>; + + codec { diff --git a/projects/Amlogic/patches/linux/amlogic-0089-FROMLIST-v1-media-videodev2-add-Compressed-Framebuff.patch b/projects/Amlogic/patches/linux/amlogic-0089-FROMLIST-v1-media-videodev2-add-Compressed-Framebuff.patch new file mode 100644 index 0000000000..1aaa1c2318 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0089-FROMLIST-v1-media-videodev2-add-Compressed-Framebuff.patch @@ -0,0 +1,60 @@ +From f607cda7c843afaaeb607a9be6bcd8028b58728c Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Fri, 5 Jun 2020 07:20:34 +0000 +Subject: [PATCH 089/156] FROMLIST(v1): media: videodev2: add Compressed + Framebuffer pixel formats + +Add two generic Compressed Framebuffer pixel formats to be used +with a modifier when imported back in another subsystem like DRM/KMS. + +These pixel formats represents generic 8bits and 10bits compressed buffers +with a vendor specific layout. + +These are aligned with the DRM_FORMAT_YUV420_8BIT and DRM_FORMAT_YUV420_10BIT +used to describe the underlying compressed buffers used for ARM Framebuffer +Compression. In the Amlogic case, the compression is different but the +underlying buffer components is the same. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ + include/uapi/linux/videodev2.h | 9 +++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c +index b2ef8e60ea7d..c5378f82a305 100644 +--- a/drivers/media/v4l2-core/v4l2-ioctl.c ++++ b/drivers/media/v4l2-core/v4l2-ioctl.c +@@ -1395,6 +1395,8 @@ 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_YUV420_8BIT: descr = "Compressed YUV 4:2:0 8-bit Format"; break; ++ case V4L2_PIX_FMT_YUV420_10BIT: descr = "Compressed YUV 4:2:0 10-bit Format"; break; + default: + if (fmt->description[0]) + return; +diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h +index 9817b7e2c968..47c8e6de5fb2 100644 +--- a/include/uapi/linux/videodev2.h ++++ b/include/uapi/linux/videodev2.h +@@ -703,6 +703,15 @@ struct v4l2_pix_format { + #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */ + #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */ + ++/* ++ * Compressed Luminance+Chrominance meta-formats ++ * In these formats, the component ordering is specified (Y, followed by U ++ * then V), but the exact Linear layout is undefined. ++ * These formats can only be used with a non-Linear modifier. ++ */ ++#define V4L2_PIX_FMT_YUV420_8BIT v4l2_fourcc('Y', 'U', '0', '8') /* 1-plane YUV 4:2:0 8-bit */ ++#define V4L2_PIX_FMT_YUV420_10BIT v4l2_fourcc('Y', 'U', '1', '0') /* 1-plane YUV 4:2:0 10-bit */ ++ + /* Vendor-specific formats */ + #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ + #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0090-FROMLIST-v1-media-meson-vdec-handle-bitdepth-on-sour.patch b/projects/Amlogic/patches/linux/amlogic-0090-FROMLIST-v1-media-meson-vdec-handle-bitdepth-on-sour.patch new file mode 100644 index 0000000000..c72abfc483 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0090-FROMLIST-v1-media-meson-vdec-handle-bitdepth-on-sour.patch @@ -0,0 +1,117 @@ +From 30c345683a949068c7769c67d656f0f8246984c9 Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Fri, 5 Jun 2020 07:21:43 +0000 +Subject: [PATCH 090/156] FROMLIST(v1): media: meson: vdec: handle bitdepth on + source change + +In order to handle Compressed Framebuffer support, we need to handle +the switch between 8bit and 10bit frame output. + +This handles the bitdepth in the codec amvdec_src_change() call to handle +a source change/decode resume when the stream bitdepth changes. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/codec_h264.c | 3 ++- + drivers/staging/media/meson/vdec/codec_vp9.c | 3 ++- + drivers/staging/media/meson/vdec/vdec.h | 1 + + drivers/staging/media/meson/vdec/vdec_helpers.c | 10 ++++++---- + drivers/staging/media/meson/vdec/vdec_helpers.h | 3 ++- + 5 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_h264.c b/drivers/staging/media/meson/vdec/codec_h264.c +index c61128fc4bb9..d53c9a464bde 100644 +--- a/drivers/staging/media/meson/vdec/codec_h264.c ++++ b/drivers/staging/media/meson/vdec/codec_h264.c +@@ -353,7 +353,8 @@ static void codec_h264_src_change(struct amvdec_session *sess) + frame_width, frame_height, crop_right, crop_bottom); + + codec_h264_set_par(sess); +- amvdec_src_change(sess, frame_width, frame_height, h264->max_refs + 5); ++ amvdec_src_change(sess, frame_width, frame_height, ++ h264->max_refs + 5, 8); + } + + /* +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +index 28a7e62e7371..3fdce799364e 100644 +--- a/drivers/staging/media/meson/vdec/codec_vp9.c ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -2145,7 +2145,8 @@ static irqreturn_t codec_vp9_threaded_isr(struct amvdec_session *sess) + + codec_vp9_fetch_rpm(sess); + if (codec_vp9_process_rpm(vp9)) { +- amvdec_src_change(sess, vp9->width, vp9->height, 16); ++ amvdec_src_change(sess, vp9->width, vp9->height, 16, ++ vp9->is_10bit ? 10 : 8); + + /* No frame is actually processed */ + vp9->cur_frame = NULL; +diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h +index f95445ac0658..e3e4af73447a 100644 +--- a/drivers/staging/media/meson/vdec/vdec.h ++++ b/drivers/staging/media/meson/vdec/vdec.h +@@ -234,6 +234,7 @@ struct amvdec_session { + u32 width; + u32 height; + u32 colorspace; ++ u32 bitdepth; + u8 ycbcr_enc; + u8 quantization; + u8 xfer_func; +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index 7f07a9175815..eed7a929c5d0 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -436,7 +436,7 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess, + EXPORT_SYMBOL_GPL(amvdec_set_par_from_dar); + + void amvdec_src_change(struct amvdec_session *sess, u32 width, +- u32 height, u32 dpb_size) ++ u32 height, u32 dpb_size, u32 bitdepth) + { + static const struct v4l2_event ev = { + .type = V4L2_EVENT_SOURCE_CHANGE, +@@ -451,7 +451,8 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width, + if (sess->streamon_cap && + sess->width == width && + sess->height == height && +- dpb_size <= sess->num_dst_bufs) { ++ dpb_size <= sess->num_dst_bufs && ++ sess->bitdepth == bitdepth) { + sess->fmt_out->codec_ops->resume(sess); + return; + } +@@ -460,9 +461,10 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width, + sess->width = width; + sess->height = height; + sess->status = STATUS_NEEDS_RESUME; ++ sess->bitdepth = bitdepth; + +- dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB size %u\n", +- width, height, dpb_size); ++ dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB %u, bitdepth %u\n", ++ width, height, dpb_size, bitdepth); + v4l2_event_queue_fh(&sess->fh, &ev); + } + EXPORT_SYMBOL_GPL(amvdec_src_change); +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h +index cfaed52ab526..f059cf195cca 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.h ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.h +@@ -76,9 +76,10 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess, + * @width: picture width detected by the hardware + * @height: picture height detected by the hardware + * @dpb_size: Decoded Picture Buffer size (= amount of buffers for decoding) ++ * @bitdepth: Bit depth (usually 10 or 8) of the coded content + */ + void amvdec_src_change(struct amvdec_session *sess, u32 width, +- u32 height, u32 dpb_size); ++ u32 height, u32 dpb_size, u32 bitdepth); + + /** + * amvdec_abort() - Abort the current decoding session +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0091-FROMLIST-v1-media-meson-vdec-update-compressed-buffe.patch b/projects/Amlogic/patches/linux/amlogic-0091-FROMLIST-v1-media-meson-vdec-update-compressed-buffe.patch new file mode 100644 index 0000000000..360d4eae0d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0091-FROMLIST-v1-media-meson-vdec-update-compressed-buffe.patch @@ -0,0 +1,190 @@ +From eb8d1460ad66d62792039c4fe257c57d08ebef7f Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Fri, 5 Jun 2020 07:22:46 +0000 +Subject: [PATCH 091/156] FROMLIST(v1): media: meson: vdec: update compressed + buffer helpers + +The actual compressed buffer helpers were very basic and only used +to enabled downsampling when decoding a 10bit stream. + +Update and rename these helpers to handle the complete compressed buffer +output buffer size and alignment for 8bit and 10bit streams. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + .../media/meson/vdec/codec_hevc_common.c | 28 ++++++++++++--- + drivers/staging/media/meson/vdec/codec_vp9.c | 7 ++-- + .../staging/media/meson/vdec/vdec_helpers.c | 35 +++++++++++++------ + .../staging/media/meson/vdec/vdec_helpers.h | 8 +++-- + 4 files changed, 58 insertions(+), 20 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c +index 0315cc0911cd..c9bf67aa2668 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc_common.c ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c +@@ -30,8 +30,11 @@ const u16 vdec_hevc_parser_cmd[] = { + void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) + { + struct amvdec_core *core = sess->core; +- u32 body_size = amvdec_am21c_body_size(sess->width, sess->height); +- u32 head_size = amvdec_am21c_head_size(sess->width, sess->height); ++ u32 use_mmu = codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, is_10bit); ++ u32 body_size = amvdec_amfbc_body_size(sess->width, sess->height, ++ is_10bit, use_mmu); ++ u32 head_size = amvdec_amfbc_head_size(sess->width, sess->height); + + if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { + /* Enable 2-plane reference read mode */ +@@ -154,7 +157,12 @@ 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); ++ u32 use_mmu = codec_hevc_use_mmu(sess->core->platform->revision, ++ sess->pixfmt_cap, ++ sess->bitdepth == 10 ? 1 : 0); ++ u32 am21_size = amvdec_amfbc_size(sess->width, sess->height, ++ sess->bitdepth == 10 ? 1 : 0, ++ use_mmu); + int i; + + for (i = 0; i < MAX_REF_PIC_NUM; ++i) { +@@ -173,7 +181,12 @@ 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); ++ u32 use_mmu = codec_hevc_use_mmu(sess->core->platform->revision, ++ sess->pixfmt_cap, ++ sess->bitdepth == 10 ? 1 : 0); ++ u32 am21_size = amvdec_amfbc_size(sess->width, sess->height, ++ sess->bitdepth == 10 ? 1 : 0, ++ use_mmu); + + v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { + u32 idx = buf->vb.vb2_buf.index; +@@ -280,7 +293,12 @@ 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 use_mmu = codec_hevc_use_mmu(sess->core->platform->revision, ++ sess->pixfmt_cap, ++ sess->bitdepth == 10 ? 1 : 0); ++ u32 size = amvdec_amfbc_size(sess->width, sess->height, ++ sess->bitdepth == 10 ? 1 : 0, ++ use_mmu); + u32 nb_pages = size / PAGE_SIZE; + u32 *mmu_map = comm->mmu_map_vaddr; + u32 first_page; +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +index 3fdce799364e..66a1168aa167 100644 +--- a/drivers/staging/media/meson/vdec/codec_vp9.c ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -1147,6 +1147,8 @@ static void codec_vp9_set_mc(struct amvdec_session *sess, + struct codec_vp9 *vp9) + { + struct amvdec_core *core = sess->core; ++ u32 use_mmu = codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, vp9->is_10bit); + u32 scale = 0; + u32 sz; + int i; +@@ -1166,8 +1168,9 @@ static void codec_vp9_set_mc(struct amvdec_session *sess, + vp9->frame_refs[i]->height != vp9->height) + scale = 1; + +- sz = amvdec_am21c_body_size(vp9->frame_refs[i]->width, +- vp9->frame_refs[i]->height); ++ sz = amvdec_amfbc_body_size(vp9->frame_refs[i]->width, ++ vp9->frame_refs[i]->height, ++ vp9->is_10bit, use_mmu); + + amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, + vp9->frame_refs[i]->width); +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index eed7a929c5d0..320cac1ed03e 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -50,32 +50,47 @@ void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val) + } + EXPORT_SYMBOL_GPL(amvdec_write_parser); + +-/* 4 KiB per 64x32 block */ +-u32 amvdec_am21c_body_size(u32 width, u32 height) ++/* AMFBC body is made out of 64x32 blocks with varying block size */ ++u32 amvdec_amfbc_body_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu) + { + u32 width_64 = ALIGN(width, 64) / 64; + u32 height_32 = ALIGN(height, 32) / 32; ++ u32 blk_size = 4096; + +- return SZ_4K * width_64 * height_32; ++ if (!is_10bit) { ++ if (use_mmu) ++ blk_size = 3200; ++ else ++ blk_size = 3072; ++ } ++ ++ return blk_size * width_64 * height_32; + } +-EXPORT_SYMBOL_GPL(amvdec_am21c_body_size); ++EXPORT_SYMBOL_GPL(amvdec_amfbc_body_size); + + /* 32 bytes per 128x64 block */ +-u32 amvdec_am21c_head_size(u32 width, u32 height) ++u32 amvdec_amfbc_head_size(u32 width, u32 height) + { + u32 width_128 = ALIGN(width, 128) / 128; + u32 height_64 = ALIGN(height, 64) / 64; + + return 32 * width_128 * height_64; + } +-EXPORT_SYMBOL_GPL(amvdec_am21c_head_size); ++EXPORT_SYMBOL_GPL(amvdec_amfbc_head_size); ++ ++u32 amvdec_amfbc_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu) ++{ ++ return ALIGN(amvdec_amfbc_body_size(width, height, is_10bit, use_mmu) + ++ amvdec_amfbc_head_size(width, height), SZ_64K); ++} ++EXPORT_SYMBOL_GPL(amvdec_amfbc_size); + +-u32 amvdec_am21c_size(u32 width, u32 height) ++u32 amvdec_is_dst_fbc(struct amvdec_session *sess) + { +- return ALIGN(amvdec_am21c_body_size(width, height) + +- amvdec_am21c_head_size(width, height), SZ_64K); ++ return sess->pixfmt_cap == V4L2_PIX_FMT_YUV420_8BIT || ++ sess->pixfmt_cap == V4L2_PIX_FMT_YUV420_10BIT; + } +-EXPORT_SYMBOL_GPL(amvdec_am21c_size); ++EXPORT_SYMBOL_GPL(amvdec_is_dst_fbc); + + static int canvas_alloc(struct amvdec_session *sess, u8 *canvas_id) + { +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h +index f059cf195cca..c1666125fe4c 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.h ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.h +@@ -27,9 +27,11 @@ void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val); + u32 amvdec_read_parser(struct amvdec_core *core, u32 reg); + void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val); + +-u32 amvdec_am21c_body_size(u32 width, u32 height); +-u32 amvdec_am21c_head_size(u32 width, u32 height); +-u32 amvdec_am21c_size(u32 width, u32 height); ++/* Helpers for the Amlogic compressed framebuffer format */ ++u32 amvdec_amfbc_body_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu); ++u32 amvdec_amfbc_head_size(u32 width, u32 height); ++u32 amvdec_amfbc_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu); ++u32 amvdec_is_dst_fbc(struct amvdec_session *sess); + + /** + * amvdec_dst_buf_done_idx() - Signal that a buffer is done decoding +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0092-FROMLIST-v1-media-meson-vdec-add-support-for-compres.patch b/projects/Amlogic/patches/linux/amlogic-0092-FROMLIST-v1-media-meson-vdec-add-support-for-compres.patch new file mode 100644 index 0000000000..8f391a9235 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0092-FROMLIST-v1-media-meson-vdec-add-support-for-compres.patch @@ -0,0 +1,322 @@ +From 723f6b236a512866e90dc29875b3052b5bd81095 Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Fri, 5 Jun 2020 07:24:01 +0000 +Subject: [PATCH 092/156] FROMLIST(v1): media: meson: vdec: add support for + compressed output for VP9 decoder + +Add the necessary changes to decode VP9 8bit and 10bit streams into +compressed buffers to be imported back into DRM/KMS using a modifier. + +On GXL/GXM platforms, the VP9 decoder will output a basic Framebuffer +Compressed layout, with a memory saving option when decoding 8bit to +better align the compressed macroblocks. This layout includes the buffer +content and an header desscribing the compressed buffer. + +On G12A and later, the VP9 decoder will output "Scatter" layout, meaning +the header buffer will contain references to the internal memory decoder +workspace and frame memory to construct a compressed framebuffer. + +The compressed layout has been described in the DRM Modifier patchset +at [1]. + +[1] https://patchwork.freedesktop.org/series/73722/#rev7 + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + .../media/meson/vdec/codec_hevc_common.c | 112 ++++++------------ + .../media/meson/vdec/codec_hevc_common.h | 13 +- + drivers/staging/media/meson/vdec/codec_vp9.c | 19 +-- + 3 files changed, 47 insertions(+), 97 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c +index c9bf67aa2668..73dae40b3319 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc_common.c ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c +@@ -42,9 +42,17 @@ void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) + return; + } + ++ /* enable mem saving mode for 8-bit */ ++ if (!is_10bit) ++ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(9)); ++ else ++ amvdec_clear_dos_bits(core, HEVC_SAO_CTRL5, BIT(9)); ++ + if (codec_hevc_use_mmu(core->platform->revision, + sess->pixfmt_cap, is_10bit)) + amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(4)); ++ else if (!is_10bit) ++ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(3)); + else + amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0); + +@@ -76,7 +84,7 @@ static void codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, + + idx = vb->index; + +- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) + buf_y_paddr = comm->fbc_buffer_paddr[idx]; + else + buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); +@@ -117,7 +125,6 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, + { + struct amvdec_core *core = sess->core; + struct v4l2_m2m_buffer *buf; +- u32 revision = core->platform->revision; + u32 pixfmt_cap = sess->pixfmt_cap; + int i; + +@@ -130,9 +137,7 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, + dma_addr_t buf_uv_paddr = 0; + u32 idx = vb->index; + +- if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit)) +- buf_y_paddr = comm->mmu_header_paddr[idx]; +- else if (codec_hevc_use_downsample(pixfmt_cap, is_10bit)) ++ 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); +@@ -173,6 +178,14 @@ void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, + comm->fbc_buffer_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_fbc_buffers); + +@@ -205,79 +218,29 @@ static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess, + 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) { +- 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; ++ struct device *dev = core->dev; + int ret; + +- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { +- ret = codec_hevc_alloc_fbc_buffers(sess, comm); +- if (ret) +- return ret; ++ if (codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, is_10bit)) { ++ comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE, ++ &comm->mmu_map_paddr, ++ GFP_KERNEL); ++ if (!comm->mmu_map_vaddr) ++ return -ENOMEM; + } + + if (codec_hevc_use_mmu(core->platform->revision, +- sess->pixfmt_cap, is_10bit)) { +- ret = codec_hevc_alloc_mmu_headers(sess, comm); +- if (ret) { +- codec_hevc_free_fbc_buffers(sess, comm); ++ sess->pixfmt_cap, is_10bit) || ++ codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { ++ ret = codec_hevc_alloc_fbc_buffers(sess, comm); ++ if (ret) + return ret; +- } + } + + if (core->platform->revision == VDEC_REVISION_GXBB) +@@ -291,24 +254,19 @@ EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers); + + void codec_hevc_fill_mmu_map(struct amvdec_session *sess, + struct codec_hevc_common *comm, +- struct vb2_buffer *vb) ++ struct vb2_buffer *vb, ++ u32 is_10bit) + { + u32 use_mmu = codec_hevc_use_mmu(sess->core->platform->revision, +- sess->pixfmt_cap, +- sess->bitdepth == 10 ? 1 : 0); +- u32 size = amvdec_amfbc_size(sess->width, sess->height, +- sess->bitdepth == 10 ? 1 : 0, ++ sess->pixfmt_cap, is_10bit); ++ u32 size = amvdec_amfbc_size(sess->width, sess->height, is_10bit, + use_mmu); + 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; +- ++ first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT; + for (i = 0; i < nb_pages; ++i) + mmu_map[i] = first_page + i; + } +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.h b/drivers/staging/media/meson/vdec/codec_hevc_common.h +index 88e4379ba1ee..5a3c6520940f 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc_common.h ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.h +@@ -22,9 +22,6 @@ 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; + }; +@@ -32,14 +29,15 @@ struct codec_hevc_common { + /* 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; ++ return pixfmt == V4L2_PIX_FMT_YUV420_8BIT || ++ pixfmt == V4L2_PIX_FMT_YUV420_10BIT || ++ 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; ++ return pixfmt == V4L2_PIX_FMT_NV12M && is_10bit; + } + + /* Returns 1 if we are decoding using the IOMMU */ +@@ -66,6 +64,7 @@ int codec_hevc_setup_buffers(struct amvdec_session *sess, + + void codec_hevc_fill_mmu_map(struct amvdec_session *sess, + struct codec_hevc_common *comm, +- struct vb2_buffer *vb); ++ struct vb2_buffer *vb, ++ u32 is_10bit); + + #endif +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +index 66a1168aa167..933fdc47ebf7 100644 +--- a/drivers/staging/media/meson/vdec/codec_vp9.c ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -458,12 +458,6 @@ struct codec_vp9 { + struct list_head ref_frames_list; + u32 frames_num; + +- /* In case of downsampling (decoding with FBC but outputting in NV12M), +- * we need to allocate additional buffers for FBC. +- */ +- void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; +- dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; +- + int ref_frame_map[REF_FRAMES]; + int next_ref_frame_map[REF_FRAMES]; + struct vp9_frame *frame_refs[REFS_PER_FRAME]; +@@ -901,11 +895,8 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, + buf_y_paddr = + vb2_dma_contig_plane_dma_addr(vb, 0); + +- if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { +- val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200; +- amvdec_write_dos(core, HEVC_SAO_CTRL5, val); ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) + amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); +- } + + if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { + buf_y_paddr = +@@ -921,7 +912,7 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, + if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, + vp9->is_10bit)) { + amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, +- vp9->common.mmu_header_paddr[vb->index]); ++ vb2_dma_contig_plane_dma_addr(vb, 0)); + /* use HEVC_CM_HEADER_START_ADDR */ + amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10)); + } +@@ -956,7 +947,8 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, + val &= ~0x3; + if (!codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) + val |= BIT(0); /* disable cm compression */ +- /* TOFIX: Handle Amlogic Framebuffer compression */ ++ else if (amvdec_is_dst_fbc(sess)) ++ val |= BIT(1); /* Disable double write */ + } + + amvdec_write_dos(core, HEVC_SAO_CTRL1, val); +@@ -1299,7 +1291,8 @@ static void codec_vp9_process_frame(struct amvdec_session *sess) + if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, + vp9->is_10bit)) + codec_hevc_fill_mmu_map(sess, &vp9->common, +- &vp9->cur_frame->vbuf->vb2_buf); ++ &vp9->cur_frame->vbuf->vb2_buf, ++ vp9->is_10bit); + + intra_only = param->p.show_frame ? 0 : param->p.intra_only; + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0093-FROMLIST-v1-media-meson-vdec-handle-compressed-outpu.patch b/projects/Amlogic/patches/linux/amlogic-0093-FROMLIST-v1-media-meson-vdec-handle-compressed-outpu.patch new file mode 100644 index 0000000000..88ac5f21b0 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0093-FROMLIST-v1-media-meson-vdec-handle-compressed-outpu.patch @@ -0,0 +1,213 @@ +From 0655dc777e609120507d26c0821e9009b31accaa Mon Sep 17 00:00:00 2001 +From: Maxime Jourdan +Date: Fri, 5 Jun 2020 07:25:37 +0000 +Subject: [PATCH 093/156] FROMLIST(v1): media: meson: vdec: handle compressed + output pixel format negociation with consumer + +Add the necessary to add support for negociating the compressed buffer +pixel format with the V4L2 M2M consumer, and allocating the right +buffers in this case. + +Until a proper mechanism exists to pass a modifier along the pixel format, +only the generic V4L2_PIX_FMT_YUV420_8BIT and V4L2_PIX_FMT_YUV420_10BIT +format are passed in v4l2_pix_format_mplane struct for consumer. + +Signed-off-by: Maxime Jourdan +Signed-off-by: Neil Armstrong +--- + .../media/meson/vdec/codec_hevc_common.c | 1 - + drivers/staging/media/meson/vdec/vdec.c | 46 +++++++++++++++++++ + drivers/staging/media/meson/vdec/vdec.h | 3 ++ + .../staging/media/meson/vdec/vdec_helpers.c | 23 ++++++++++ + .../staging/media/meson/vdec/vdec_platform.c | 9 ++-- + 5 files changed, 78 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c +index 73dae40b3319..78fada7b8fa9 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc_common.c ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c +@@ -10,7 +10,6 @@ + #include "vdec_helpers.h" + #include "hevc_regs.h" + +-#define MMU_COMPRESS_HEADER_SIZE 0x48000 + #define MMU_MAP_SIZE 0x4800 + + const u16 vdec_hevc_parser_cmd[] = { +diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c +index 3040136ceb77..9fb075f69cb9 100644 +--- a/drivers/staging/media/meson/vdec/vdec.c ++++ b/drivers/staging/media/meson/vdec/vdec.c +@@ -192,6 +192,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 revision = sess->core->platform->revision; + + if (*num_planes) { + switch (q->type) { +@@ -215,6 +216,12 @@ 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_YUV420_8BIT: ++ case V4L2_PIX_FMT_YUV420_10BIT: ++ if (*num_planes != 1 || ++ sizes[0] < MMU_COMPRESS_HEADER_SIZE) ++ return -EINVAL; ++ break; + default: + return -EINVAL; + } +@@ -244,6 +251,24 @@ 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_YUV420_8BIT: ++ if (revision >= VDEC_REVISION_G12A) ++ sizes[0] = MMU_COMPRESS_HEADER_SIZE; ++ else ++ sizes[0] = amvdec_amfbc_size(sess->width, ++ sess->height, ++ 0, 0); ++ *num_planes = 1; ++ break; ++ case V4L2_PIX_FMT_YUV420_10BIT: ++ if (revision >= VDEC_REVISION_G12A) ++ sizes[0] = MMU_COMPRESS_HEADER_SIZE; ++ else ++ sizes[0] = amvdec_amfbc_size(sess->width, ++ sess->height, ++ 1, 0); ++ *num_planes = 1; ++ break; + default: + return -EINVAL; + } +@@ -496,6 +521,7 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size, + struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; + const struct amvdec_format *fmts = sess->core->platform->formats; + const struct amvdec_format *fmt_out = NULL; ++ u32 revision = sess->core->platform->revision; + u32 output_size = 0; + + memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); +@@ -548,6 +574,26 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size, + pfmt[2].sizeimage = output_size / 2; + pfmt[2].bytesperline = ALIGN(pixmp->width, 32) / 2; + pixmp->num_planes = 3; ++ } else if (pixmp->pixelformat == V4L2_PIX_FMT_YUV420_8BIT) { ++ if (revision >= VDEC_REVISION_G12A) { ++ pfmt[0].sizeimage = MMU_COMPRESS_HEADER_SIZE; ++ } else { ++ pfmt[0].sizeimage = ++ amvdec_amfbc_size(pixmp->width, ++ pixmp->height, 0, 0); ++ pfmt[0].bytesperline = pixmp->width; ++ } ++ pixmp->num_planes = 1; ++ } else if (pixmp->pixelformat == V4L2_PIX_FMT_YUV420_10BIT) { ++ if (revision >= VDEC_REVISION_G12A) { ++ pfmt[0].sizeimage = MMU_COMPRESS_HEADER_SIZE; ++ } else { ++ pfmt[0].sizeimage = ++ amvdec_amfbc_size(pixmp->width, ++ pixmp->height, 1, 0); ++ pfmt[0].bytesperline = pixmp->width; ++ } ++ pixmp->num_planes = 1; + } + } + +diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h +index e3e4af73447a..1412054a70c4 100644 +--- a/drivers/staging/media/meson/vdec/vdec.h ++++ b/drivers/staging/media/meson/vdec/vdec.h +@@ -17,6 +17,9 @@ + + #include "vdec_platform.h" + ++/* MMU header size for codecs using the IOMMU + FBC */ ++#define MMU_COMPRESS_HEADER_SIZE 0x48000 ++ + /* 32 buffers in 3-plane YUV420 */ + #define MAX_CANVAS (32 * 3) + +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index 320cac1ed03e..7166605b89ae 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -299,6 +299,22 @@ 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_YUV420_8BIT: ++ if (sess->core->platform->revision >= VDEC_REVISION_G12A) ++ vbuf->vb2_buf.planes[0].bytesused = ++ MMU_COMPRESS_HEADER_SIZE; ++ else ++ vbuf->vb2_buf.planes[0].bytesused = ++ amvdec_amfbc_size(sess->width, sess->height, 0, 0); ++ break; ++ case V4L2_PIX_FMT_YUV420_10BIT: ++ if (sess->core->platform->revision >= VDEC_REVISION_G12A) ++ vbuf->vb2_buf.planes[0].bytesused = ++ MMU_COMPRESS_HEADER_SIZE; ++ else ++ vbuf->vb2_buf.planes[0].bytesused = ++ amvdec_amfbc_size(sess->width, sess->height, 1, 0); ++ break; + } + + vbuf->vb2_buf.timestamp = timestamp; +@@ -478,6 +494,13 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width, + sess->status = STATUS_NEEDS_RESUME; + sess->bitdepth = bitdepth; + ++ if (sess->pixfmt_cap == V4L2_PIX_FMT_YUV420_8BIT && ++ bitdepth == 10) ++ sess->pixfmt_cap = V4L2_PIX_FMT_YUV420_10BIT; ++ else if (sess->pixfmt_cap == V4L2_PIX_FMT_YUV420_10BIT && ++ bitdepth == 8) ++ sess->pixfmt_cap = V4L2_PIX_FMT_YUV420_8BIT; ++ + dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB %u, bitdepth %u\n", + width, height, dpb_size, bitdepth); + v4l2_event_queue_fh(&sess->fh, &ev); +diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c +index eabbebab2da2..efc090d2a3bb 100644 +--- a/drivers/staging/media/meson/vdec/vdec_platform.c ++++ b/drivers/staging/media/meson/vdec/vdec_platform.c +@@ -61,7 +61,8 @@ static const struct amvdec_format vdec_formats_gxl[] = { + .vdec_ops = &vdec_hevc_ops, + .codec_ops = &codec_vp9_ops, + .firmware_path = "meson/vdec/gxl_vp9.bin", +- .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420_8BIT, ++ V4L2_PIX_FMT_YUV420_10BIT, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { +@@ -149,7 +150,8 @@ static const struct amvdec_format vdec_formats_g12a[] = { + .vdec_ops = &vdec_hevc_ops, + .codec_ops = &codec_vp9_ops, + .firmware_path = "meson/vdec/g12a_vp9.bin", +- .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420_8BIT, ++ V4L2_PIX_FMT_YUV420_10BIT, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { +@@ -199,7 +201,8 @@ static const struct amvdec_format vdec_formats_sm1[] = { + .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 }, ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420_8BIT, ++ V4L2_PIX_FMT_YUV420_10BIT, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0094-FROMLIST-v2-soc-amlogic-meson-gx-socinfo-Fix-S905X3-.patch b/projects/Amlogic/patches/linux/amlogic-0094-FROMLIST-v2-soc-amlogic-meson-gx-socinfo-Fix-S905X3-.patch new file mode 100644 index 0000000000..bac144123d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0094-FROMLIST-v2-soc-amlogic-meson-gx-socinfo-Fix-S905X3-.patch @@ -0,0 +1,45 @@ +From ea81daeb5a1ce9b81d35d9dc617e162de680d07f Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 3 Jun 2020 08:24:11 +0000 +Subject: [PATCH 094/156] FROMLIST(v2): soc: amlogic: meson-gx-socinfo: Fix + S905X3 and S905D3 ID's + +Correct the SoC revision and package bits/mask values for S905D3/X3 to detect +a wider range of observed SoC IDs, and tweak sort order for A311D/S922X. + +S905X3 05 0000 0101 (SEI610 initial devices) +S905X3 10 0001 0000 (ODROID-C4 and recent Android boxes) +S905X3 50 0101 0000 (SEI610 later revisions) +S905D3 04 0000 0100 (VIM3L devices in kernelci) +S905D3 b0 1011 0000 (VIM3L initial production) + +Fixes commit c9cc9bec36d0 ("soc: amlogic: meson-gx-socinfo: Add SM1 and S905X3 IDs") +Suggested-by: Neil Armstrong +Signed-off-by: Christian Hewitt +--- + drivers/soc/amlogic/meson-gx-socinfo.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c +index 01fc0d20a70d..6f54bd832c8b 100644 +--- a/drivers/soc/amlogic/meson-gx-socinfo.c ++++ b/drivers/soc/amlogic/meson-gx-socinfo.c +@@ -66,10 +66,12 @@ static const struct meson_gx_package_id { + { "A113D", 0x25, 0x22, 0xff }, + { "S905D2", 0x28, 0x10, 0xf0 }, + { "S905X2", 0x28, 0x40, 0xf0 }, +- { "S922X", 0x29, 0x40, 0xf0 }, + { "A311D", 0x29, 0x10, 0xf0 }, +- { "S905X3", 0x2b, 0x5, 0xf }, +- { "S905D3", 0x2b, 0xb0, 0xf0 }, ++ { "S922X", 0x29, 0x40, 0xf0 }, ++ { "S905D3", 0x2b, 0x4, 0xf5 }, ++ { "S905X3", 0x2b, 0x5, 0xf5 }, ++ { "S905X3", 0x2b, 0x10, 0x3f }, ++ { "S905D3", 0x2b, 0x30, 0x3f }, + { "A113L", 0x2c, 0x0, 0xf8 }, + }; + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0095-FROMLIST-v1-spi-dt-bindings-amlogic-meson-gx-spicc-F.patch b/projects/Amlogic/patches/linux/amlogic-0095-FROMLIST-v1-spi-dt-bindings-amlogic-meson-gx-spicc-F.patch new file mode 100644 index 0000000000..eb3e9b0d94 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0095-FROMLIST-v1-spi-dt-bindings-amlogic-meson-gx-spicc-F.patch @@ -0,0 +1,79 @@ +From 67d20391c1642ff88deb07493f25b920610e7698 Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Wed, 10 Jun 2020 10:43:03 +0000 +Subject: [PATCH 095/156] FROMLIST(v1): spi: dt-bindings: amlogic, + meson-gx-spicc: Fix schema for meson-g12a + +This fixes the following warning during dtbs_check: + +spi@13000: clock-names: Additional items are not allowed ('pclk' was unexpected) +spi@13000: clock-names: ['core', 'pclk'] is too long +spi@13000: clocks: [[2, 23], [2, 258]] is too long +spi@15000: clock-names: Additional items are not allowed ('pclk' was unexpected) +spi@15000: clock-names: ['core', 'pclk'] is too long +spi@15000: clocks: [[2, 29], [2, 261]] is too long + +Conditional schema properties don't overwrite others. Instead of +restrictions have to be validated. So general clock amount is 1-2 and +depending on the actual device type limit the mount to 1 or 2. + +Signed-off-by: Alexander Stein +--- + .../bindings/spi/amlogic,meson-gx-spicc.yaml | 26 ++++++++++++------- + 1 file changed, 17 insertions(+), 9 deletions(-) + +diff --git a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml +index 9147df29022a..38efb50081e3 100644 +--- a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml ++++ b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml +@@ -34,12 +34,15 @@ properties: + maxItems: 1 + + clocks: +- maxItems: 1 ++ minItems: 1 ++ maxItems: 2 ++ items: ++ - description: controller register bus clock ++ - description: baud rate generator and delay control clock + + clock-names: +- description: input clock for the baud rate generator +- items: +- - const: core ++ minItems: 1 ++ maxItems: 2 + + if: + properties: +@@ -51,17 +54,22 @@ if: + then: + properties: + clocks: +- contains: +- items: +- - description: controller register bus clock +- - description: baud rate generator and delay control clock ++ minItems: 2 + + clock-names: +- minItems: 2 + items: + - const: core + - const: pclk + ++else: ++ properties: ++ clocks: ++ maxItems: 1 ++ ++ clock-names: ++ items: ++ - const: core ++ + required: + - compatible + - reg +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0096-FROMLIST-v1-pinctrl-meson-fix-drive-strength-registe.patch b/projects/Amlogic/patches/linux/amlogic-0096-FROMLIST-v1-pinctrl-meson-fix-drive-strength-registe.patch new file mode 100644 index 0000000000..be8362f2a4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0096-FROMLIST-v1-pinctrl-meson-fix-drive-strength-registe.patch @@ -0,0 +1,40 @@ +From 4c48fcf5e06f9b09a9813473542c1e596b7b5b09 Mon Sep 17 00:00:00 2001 +From: Hyeonki Hong +Date: Wed, 10 Jun 2020 10:44:22 +0000 +Subject: [PATCH 096/156] FROMLIST(v1): pinctrl: meson: fix drive strength + register and bit calculation + +If a GPIO bank has greater than 16 pins, PAD_DS_REG is split into two +registers. However, when register and bit were calculated, the first +register defined in the bank was used, and the bit was calculated based +on the first pin. This causes problems in setting the driving strength. + +Solved the problem by changing the bit using a mask and selecting the +next register when the bit exceeds 15. + +Signed-off-by: Hyeonki Hong +--- + drivers/pinctrl/meson/pinctrl-meson.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c +index bbc919bef2bf..ef66239b7df5 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson.c ++++ b/drivers/pinctrl/meson/pinctrl-meson.c +@@ -98,6 +98,13 @@ static void meson_calc_reg_and_bit(struct meson_bank *bank, unsigned int pin, + + *reg = desc->reg * 4; + *bit = desc->bit + pin - bank->first; ++ ++ if (reg_type == REG_DS) { ++ if (*bit > 15) { ++ *bit &= 0xf; ++ *reg += 4; ++ } ++ } + } + + static int meson_get_groups_count(struct pinctrl_dev *pcdev) +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0097-FROMLIST-v1-dt-bindings-clk-g12a-clkc-Add-NNA-CLK-So.patch b/projects/Amlogic/patches/linux/amlogic-0097-FROMLIST-v1-dt-bindings-clk-g12a-clkc-Add-NNA-CLK-So.patch new file mode 100644 index 0000000000..912e20f167 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0097-FROMLIST-v1-dt-bindings-clk-g12a-clkc-Add-NNA-CLK-So.patch @@ -0,0 +1,29 @@ +From bbafff079c99e3c2a6a76865aa669ffd47b34bbe Mon Sep 17 00:00:00 2001 +From: Dmitry Shmidt +Date: Wed, 10 Jun 2020 10:45:33 +0000 +Subject: [PATCH 097/156] FROMLIST(v1): dt-bindings: clk: g12a-clkc: Add NNA + CLK Source clock IDs + +This adds the Neural Network Accelerator IP source clocks. + +Signed-off-by: Dmitry Shmidt +Signed-off-by: Neil Armstrong +--- + include/dt-bindings/clock/g12a-clkc.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/dt-bindings/clock/g12a-clkc.h b/include/dt-bindings/clock/g12a-clkc.h +index b0d65d73db96..40d49940d8a8 100644 +--- a/include/dt-bindings/clock/g12a-clkc.h ++++ b/include/dt-bindings/clock/g12a-clkc.h +@@ -145,5 +145,7 @@ + #define CLKID_CPU3_CLK 255 + #define CLKID_SPICC0_SCLK 258 + #define CLKID_SPICC1_SCLK 261 ++#define CLKID_NNA_AXI_CLK 264 ++#define CLKID_NNA_CORE_CLK 267 + + #endif /* __G12A_CLKC_H */ +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0098-FROMLIST-v1-clk-meson-g12a-Add-support-for-NNA-CLK-s.patch b/projects/Amlogic/patches/linux/amlogic-0098-FROMLIST-v1-clk-meson-g12a-Add-support-for-NNA-CLK-s.patch new file mode 100644 index 0000000000..b03732da7a --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0098-FROMLIST-v1-clk-meson-g12a-Add-support-for-NNA-CLK-s.patch @@ -0,0 +1,192 @@ +From c2cc8facc6ce7341053855b004d21ea51ea311e6 Mon Sep 17 00:00:00 2001 +From: Dmitry Shmidt +Date: Wed, 10 Jun 2020 10:46:33 +0000 +Subject: [PATCH 098/156] FROMLIST(v1): clk: meson: g12a: Add support for NNA + CLK source clocks + +This adds the Neural Network Accelerator source clocks hierarchy, it's +2 simple composite clocks to feed the AXI interface and the Core of +the Neural Network Accelerator IP. + +This IP is only present on the Amlogic SM1 SoCs family. + +Signed-off-by: Dmitry Shmidt +Signed-off-by: Neil Armstrong +--- + drivers/clk/meson/g12a.c | 119 +++++++++++++++++++++++++++++++++++++++ + drivers/clk/meson/g12a.h | 7 ++- + 2 files changed, 125 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c +index fad616cac01e..5c2e5cedca96 100644 +--- a/drivers/clk/meson/g12a.c ++++ b/drivers/clk/meson/g12a.c +@@ -3967,6 +3967,113 @@ static struct clk_regmap g12a_spicc1_sclk = { + }, + }; + ++/* Neural Network Accelerator source clock */ ++ ++static const struct clk_parent_data nna_clk_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 sm1_nna_axi_clk_sel = { ++ .data = &(struct clk_regmap_mux_data){ ++ .offset = HHI_NNA_CLK_CNTL, ++ .mask = 7, ++ .shift = 9, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "nna_axi_clk_sel", ++ .ops = &clk_regmap_mux_ops, ++ .parent_data = nna_clk_parent_data, ++ .num_parents = ARRAY_SIZE(nna_clk_parent_data), ++ }, ++}; ++ ++static struct clk_regmap sm1_nna_axi_clk_div = { ++ .data = &(struct clk_regmap_div_data){ ++ .offset = HHI_NNA_CLK_CNTL, ++ .shift = 0, ++ .width = 7, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "nna_axi_clk_div", ++ .ops = &clk_regmap_divider_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &sm1_nna_axi_clk_sel.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ ++static struct clk_regmap sm1_nna_axi_clk = { ++ .data = &(struct clk_regmap_gate_data){ ++ .offset = HHI_NNA_CLK_CNTL, ++ .bit_idx = 8, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "nna_axi_clk", ++ .ops = &clk_regmap_gate_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &sm1_nna_axi_clk_div.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ ++static struct clk_regmap sm1_nna_core_clk_sel = { ++ .data = &(struct clk_regmap_mux_data){ ++ .offset = HHI_NNA_CLK_CNTL, ++ .mask = 7, ++ .shift = 25, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "nna_core_clk_sel", ++ .ops = &clk_regmap_mux_ops, ++ .parent_data = nna_clk_parent_data, ++ .num_parents = ARRAY_SIZE(nna_clk_parent_data), ++ }, ++}; ++ ++static struct clk_regmap sm1_nna_core_clk_div = { ++ .data = &(struct clk_regmap_div_data){ ++ .offset = HHI_NNA_CLK_CNTL, ++ .shift = 16, ++ .width = 7, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "nna_core_clk_div", ++ .ops = &clk_regmap_divider_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &sm1_nna_core_clk_sel.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ ++static struct clk_regmap sm1_nna_core_clk = { ++ .data = &(struct clk_regmap_gate_data){ ++ .offset = HHI_NNA_CLK_CNTL, ++ .bit_idx = 24, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "nna_core_clk", ++ .ops = &clk_regmap_gate_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &sm1_nna_core_clk_div.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ + #define MESON_GATE(_name, _reg, _bit) \ + MESON_PCLK(_name, _reg, _bit, &g12a_clk81.hw) + +@@ -4765,6 +4872,12 @@ static struct clk_hw_onecell_data sm1_hw_onecell_data = { + [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw, + [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw, + [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw, ++ [CLKID_NNA_AXI_CLK_SEL] = &sm1_nna_axi_clk_sel.hw, ++ [CLKID_NNA_AXI_CLK_DIV] = &sm1_nna_axi_clk_div.hw, ++ [CLKID_NNA_AXI_CLK] = &sm1_nna_axi_clk.hw, ++ [CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw, ++ [CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw, ++ [CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw, + [NR_CLKS] = NULL, + }, + .num = NR_CLKS, +@@ -5006,6 +5119,12 @@ static struct clk_regmap *const g12a_clk_regmaps[] = { + &g12a_spicc1_sclk_sel, + &g12a_spicc1_sclk_div, + &g12a_spicc1_sclk, ++ &sm1_nna_axi_clk_sel, ++ &sm1_nna_axi_clk_div, ++ &sm1_nna_axi_clk, ++ &sm1_nna_core_clk_sel, ++ &sm1_nna_core_clk_div, ++ &sm1_nna_core_clk, + }; + + static const struct reg_sequence g12a_init_regs[] = { +diff --git a/drivers/clk/meson/g12a.h b/drivers/clk/meson/g12a.h +index a8852556836e..69b6a69549c7 100644 +--- a/drivers/clk/meson/g12a.h ++++ b/drivers/clk/meson/g12a.h +@@ -70,6 +70,7 @@ + #define HHI_MALI_CLK_CNTL 0x1b0 + #define HHI_VPU_CLKC_CNTL 0x1b4 + #define HHI_VPU_CLK_CNTL 0x1bC ++#define HHI_NNA_CLK_CNTL 0x1C8 + #define HHI_HDMI_CLK_CNTL 0x1CC + #define HHI_VDEC_CLK_CNTL 0x1E0 + #define HHI_VDEC2_CLK_CNTL 0x1E4 +@@ -259,8 +260,12 @@ + #define CLKID_SPICC0_SCLK_DIV 257 + #define CLKID_SPICC1_SCLK_SEL 259 + #define CLKID_SPICC1_SCLK_DIV 260 ++#define CLKID_NNA_AXI_CLK_SEL 262 ++#define CLKID_NNA_AXI_CLK_DIV 263 ++#define CLKID_NNA_CORE_CLK_SEL 265 ++#define CLKID_NNA_CORE_CLK_DIV 266 + +-#define NR_CLKS 262 ++#define NR_CLKS 268 + + /* include the CLKIDs that have been made part of the DT binding */ + #include +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0099-FROMLIST-v1-drm-panfrost-Fix-inbalance-of-devfreq-re.patch b/projects/Amlogic/patches/linux/amlogic-0099-FROMLIST-v1-drm-panfrost-Fix-inbalance-of-devfreq-re.patch new file mode 100644 index 0000000000..1b4ca38fc4 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0099-FROMLIST-v1-drm-panfrost-Fix-inbalance-of-devfreq-re.patch @@ -0,0 +1,66 @@ +From 9c77da7eb1a3c460bf26072c5e2d97c12e39719d Mon Sep 17 00:00:00 2001 +From: Steven Price +Date: Sat, 13 Jun 2020 14:33:31 +0000 +Subject: [PATCH 099/156] FROMLIST(v1): drm/panfrost: Fix inbalance of devfreq + record_busy/idle() + +The calls to panfrost_devfreq_record_busy() and +panfrost_devfreq_record_idle() must be balanced to ensure that the +devfreq utilisation is correctly reported. But there are two cases where +this doesn't work correctly. + +In panfrost_job_hw_submit() if pm_runtime_get_sync() fails or the +WARN_ON() fires then no call to panfrost_devfreq_record_busy() is made, +but when the job times out the corresponding _record_idle() call is +still made in panfrost_job_timedout(). Move the call up to ensure that +it always happens. + +Secondly panfrost_job_timedout() only makes a single call to +panfrost_devfreq_record_idle() even if it is cleaning up multiple jobs. +Move the call inside the loop to ensure that the number of +_record_idle() calls matches the number of _record_busy() calls. + +Fixes: 9e62b885f715 ("drm/panfrost: Simplify devfreq utilisation tracking") +Signed-off-by: Steven Price +--- + drivers/gpu/drm/panfrost/panfrost_job.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index 7914b1570841..f9519afca29d 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -145,6 +145,8 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) + u64 jc_head = job->jc; + int ret; + ++ panfrost_devfreq_record_busy(pfdev); ++ + ret = pm_runtime_get_sync(pfdev->dev); + if (ret < 0) + return; +@@ -155,7 +157,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) + } + + cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); +- panfrost_devfreq_record_busy(pfdev); + + job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF); + job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32); +@@ -410,12 +411,12 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) + for (i = 0; i < NUM_JOB_SLOTS; i++) { + if (pfdev->jobs[i]) { + pm_runtime_put_noidle(pfdev->dev); ++ panfrost_devfreq_record_idle(pfdev); + pfdev->jobs[i] = NULL; + } + } + spin_unlock_irqrestore(&pfdev->js->job_lock, flags); + +- panfrost_devfreq_record_idle(pfdev); + panfrost_device_reset(pfdev); + + for (i = 0; i < NUM_JOB_SLOTS; i++) +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0100-FROMLIST-v2-drm-panfrost-Fix-runtime-PM-imbalance-on.patch b/projects/Amlogic/patches/linux/amlogic-0100-FROMLIST-v2-drm-panfrost-Fix-runtime-PM-imbalance-on.patch new file mode 100644 index 0000000000..2bf36fda9e --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0100-FROMLIST-v2-drm-panfrost-Fix-runtime-PM-imbalance-on.patch @@ -0,0 +1,31 @@ +From 547852a05722df1440c08405cf0bf39d607708cd Mon Sep 17 00:00:00 2001 +From: Dinghao Liu +Date: Sat, 13 Jun 2020 14:37:29 +0000 +Subject: [PATCH 100/156] FROMLIST(v2): drm/panfrost: Fix runtime PM imbalance + on error + +The caller expects panfrost_job_hw_submit() to increase +runtime PM usage counter. The refcount decrement on the +error branch of WARN_ON() will break the counter balance +and needs to be removed. + +Signed-off-by: Dinghao Liu +--- + drivers/gpu/drm/panfrost/panfrost_job.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index f9519afca29d..c6242fe34840 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -152,7 +152,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) + return; + + if (WARN_ON(job_read(pfdev, JS_COMMAND_NEXT(js)))) { +- pm_runtime_put_sync_autosuspend(pfdev->dev); + return; + } + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0101-FROMLIST-v1-drm-panfrost-Fix-runtime-PM-imbalance-in.patch b/projects/Amlogic/patches/linux/amlogic-0101-FROMLIST-v1-drm-panfrost-Fix-runtime-PM-imbalance-in.patch new file mode 100644 index 0000000000..14e95cb2aa --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0101-FROMLIST-v1-drm-panfrost-Fix-runtime-PM-imbalance-in.patch @@ -0,0 +1,49 @@ +From 0563987b75b9240d569b033740a51ee5a7d5b84c Mon Sep 17 00:00:00 2001 +From: Dinghao Liu +Date: Sat, 13 Jun 2020 14:38:16 +0000 +Subject: [PATCH 101/156] FROMLIST(v1): drm/panfrost: Fix runtime PM imbalance + in panfrost_perfcnt_enable_locked + +pm_runtime_get_sync() increments the runtime PM usage counter even +when it returns an error code. Thus a pairing decrement is needed on +the error handling path to keep the counter balanced. For all error +paths after pm_runtime_get_sync(), things are the same. + +Signed-off-by: Dinghao Liu +--- + drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +index 6913578d5aa7..d99bd2f0503a 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c ++++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +@@ -83,11 +83,13 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, + + ret = pm_runtime_get_sync(pfdev->dev); + if (ret < 0) +- return ret; ++ goto err_pm_get; + + bo = drm_gem_shmem_create(pfdev->ddev, perfcnt->bosize); +- if (IS_ERR(bo)) +- return PTR_ERR(bo); ++ if (IS_ERR(bo)) { ++ ret = PTR_ERR(bo); ++ goto err_pm_get; ++ } + + /* Map the perfcnt buf in the address space attached to file_priv. */ + ret = panfrost_gem_open(&bo->base, file_priv); +@@ -168,6 +170,8 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, + panfrost_gem_close(&bo->base, file_priv); + err_put_bo: + drm_gem_object_put_unlocked(&bo->base); ++err_pm_get: ++ pm_runtime_put_noidle(pfdev->dev); + return ret; + } + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0102-FROMLIST-v3-drm-panfrost-Reduce-the-amount-of-logs-o.patch b/projects/Amlogic/patches/linux/amlogic-0102-FROMLIST-v3-drm-panfrost-Reduce-the-amount-of-logs-o.patch new file mode 100644 index 0000000000..09b39144d9 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0102-FROMLIST-v3-drm-panfrost-Reduce-the-amount-of-logs-o.patch @@ -0,0 +1,48 @@ +From b12fd7ac6e20cf68cb6a023ffb2ab14c1c904f52 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Sat, 13 Jun 2020 14:39:51 +0000 +Subject: [PATCH 102/156] FROMLIST(v3): drm/panfrost: Reduce the amount of logs + on deferred probe + +There is no point to print deferred probe (and its failures to get +resources) as an error. Also there is no need to print regulator errors +twice. + +In case of multiple probe tries this would pollute the dmesg. + +Reviewed-by: Steven Price +Signed-off-by: Krzysztof Kozlowski +--- + drivers/gpu/drm/panfrost/panfrost_device.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c +index 8136babd3ba9..b172087eee6a 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_device.c ++++ b/drivers/gpu/drm/panfrost/panfrost_device.c +@@ -101,7 +101,9 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) + pfdev->comp->num_supplies, + pfdev->regulators); + if (ret < 0) { +- dev_err(pfdev->dev, "failed to get regulators: %d\n", ret); ++ if (ret != -EPROBE_DEFER) ++ dev_err(pfdev->dev, "failed to get regulators: %d\n", ++ ret); + return ret; + } + +@@ -213,10 +215,8 @@ int panfrost_device_init(struct panfrost_device *pfdev) + } + + err = panfrost_regulator_init(pfdev); +- if (err) { +- dev_err(pfdev->dev, "regulator init failed %d\n", err); ++ if (err) + goto err_out0; +- } + + err = panfrost_reset_init(pfdev); + if (err) { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0103-FROMLIST-v2-drm-panfrost-Use-kvfree-to-free-bo-sgts.patch b/projects/Amlogic/patches/linux/amlogic-0103-FROMLIST-v2-drm-panfrost-Use-kvfree-to-free-bo-sgts.patch new file mode 100644 index 0000000000..4e81e1c276 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0103-FROMLIST-v2-drm-panfrost-Use-kvfree-to-free-bo-sgts.patch @@ -0,0 +1,46 @@ +From 24b0524ce9d0aaf78aab68d6e18089579983e13a Mon Sep 17 00:00:00 2001 +From: Denis Efremov +Date: Sat, 13 Jun 2020 14:18:32 +0000 +Subject: [PATCH 103/156] FROMLIST(v2): drm/panfrost: Use kvfree() to free + bo->sgts + +Use kvfree() to free bo->sgts, because the memory is allocated with +kvmalloc_array() in panfrost_mmu_map_fault_addr(). + +Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") +Cc: stable@vger.kernel.org +Signed-off-by: Denis Efremov +--- + drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +- + drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c +index 17b654e1eb94..556181ea4a07 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gem.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gem.c +@@ -46,7 +46,7 @@ static void panfrost_gem_free_object(struct drm_gem_object *obj) + sg_free_table(&bo->sgts[i]); + } + } +- kfree(bo->sgts); ++ kvfree(bo->sgts); + } + + drm_gem_shmem_free_object(obj); +diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c +index ed28aeba6d59..3c8ae7411c80 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c +@@ -486,7 +486,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, + pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, + sizeof(struct page *), GFP_KERNEL | __GFP_ZERO); + if (!pages) { +- kfree(bo->sgts); ++ kvfree(bo->sgts); + bo->sgts = NULL; + mutex_unlock(&bo->base.pages_lock); + ret = -ENOMEM; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0104-FROMLIST-v1-panfrost-Add-compatible-string-for-bifro.patch b/projects/Amlogic/patches/linux/amlogic-0104-FROMLIST-v1-panfrost-Add-compatible-string-for-bifro.patch new file mode 100644 index 0000000000..4db2f41e81 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0104-FROMLIST-v1-panfrost-Add-compatible-string-for-bifro.patch @@ -0,0 +1,28 @@ +From e53ab2f38542e37c4173e0956e5234bf5a519c0b Mon Sep 17 00:00:00 2001 +From: Tomeu Vizoso +Date: Thu, 12 Mar 2020 15:50:13 +0000 +Subject: [PATCH 104/156] FROMLIST(v1): panfrost: Add compatible string for + bifrost + +Mesa now supports some Bifrost devices, so enable it. + +Signed-off-by: Tomeu Vizoso +--- + drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c +index 882fecc33fdb..8ff8e140f91e 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_drv.c ++++ b/drivers/gpu/drm/panfrost/panfrost_drv.c +@@ -677,6 +677,7 @@ static const struct of_device_id dt_match[] = { + { .compatible = "arm,mali-t830", .data = &default_data, }, + { .compatible = "arm,mali-t860", .data = &default_data, }, + { .compatible = "arm,mali-t880", .data = &default_data, }, ++ { .compatible = "arm,mali-bifrost", .data = &default_data, }, + {} + }; + MODULE_DEVICE_TABLE(of, dt_match); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0105-FROMLIST-v1-panfrost-Make-sure-GPU-is-powered-on-whe.patch b/projects/Amlogic/patches/linux/amlogic-0105-FROMLIST-v1-panfrost-Make-sure-GPU-is-powered-on-whe.patch new file mode 100644 index 0000000000..2457f42636 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0105-FROMLIST-v1-panfrost-Make-sure-GPU-is-powered-on-whe.patch @@ -0,0 +1,51 @@ +From d913c32904ab41dd93e4e36c58a197c976e2d2a1 Mon Sep 17 00:00:00 2001 +From: Tomeu Vizoso +Date: Wed, 10 Jun 2020 09:46:00 +0200 +Subject: [PATCH 105/156] FROMLIST(v1): panfrost: Make sure GPU is powered on + when reading GPU_LATEST_FLUSH_ID + +Bifrost devices do support the flush reduction feature, so on first job +submit we were trying to read the register while still powered off. + +If the GPU is powered off, the feature doesn't bring any benefit, so +don't try to read. + +Signed-off-by: Tomeu Vizoso +--- + drivers/gpu/drm/panfrost/panfrost_gpu.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c +index f2c1ddc41a9b..e0f190e43813 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #include "panfrost_device.h" + #include "panfrost_features.h" +@@ -368,7 +369,16 @@ void panfrost_gpu_fini(struct panfrost_device *pfdev) + + u32 panfrost_gpu_get_latest_flush_id(struct panfrost_device *pfdev) + { +- if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) +- return gpu_read(pfdev, GPU_LATEST_FLUSH_ID); ++ u32 flush_id; ++ ++ if (panfrost_has_hw_feature(pfdev, HW_FEATURE_FLUSH_REDUCTION)) { ++ /* Flush reduction only makes sense when the GPU is kept powered on between jobs */ ++ if (pm_runtime_get_if_in_use(pfdev->dev)) { ++ flush_id = gpu_read(pfdev, GPU_LATEST_FLUSH_ID); ++ pm_runtime_put(pfdev->dev); ++ return flush_id; ++ } ++ } ++ + return 0; + } +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0106-FROMLIST-v1-arm64-dts-meson-add-missing-gxl-rng-cloc.patch b/projects/Amlogic/patches/linux/amlogic-0106-FROMLIST-v1-arm64-dts-meson-add-missing-gxl-rng-cloc.patch new file mode 100644 index 0000000000..8d76b85e26 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0106-FROMLIST-v1-arm64-dts-meson-add-missing-gxl-rng-cloc.patch @@ -0,0 +1,34 @@ +From 486f528652a716c18a7459f8d164de5f50fef26b Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 17 Jun 2020 14:33:26 +0000 +Subject: [PATCH 106/156] FROMLIST(v1): arm64: dts: meson: add missing gxl rng + clock + +The peripheral clock of the RNG is missing for gxl while it is present +for gxbb. + +Fixes: 1b3f6d148692 ("ARM64: dts: meson-gx: add clock CLKID_RNG0 to hwrng node") +Signed-off-by: Jerome Brunet +--- + arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +index 4e0d8ef97f99..1f7db598025d 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +@@ -332,6 +332,11 @@ + }; + }; + ++&hwrng { ++ clocks = <&clkc CLKID_RNG0>; ++ clock-names = "core"; ++}; ++ + &i2c_A { + clocks = <&clkc CLKID_I2C>; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0107-FROMLIST-v1-ASoC-meson-imply-acodec-glue-on-axg-soun.patch b/projects/Amlogic/patches/linux/amlogic-0107-FROMLIST-v1-ASoC-meson-imply-acodec-glue-on-axg-soun.patch new file mode 100644 index 0000000000..840c047612 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0107-FROMLIST-v1-ASoC-meson-imply-acodec-glue-on-axg-soun.patch @@ -0,0 +1,26 @@ +From 1af0e4f3f5ca5b0651e1f3879d461c952faa797e Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Mon, 30 Mar 2020 17:39:04 +0200 +Subject: [PATCH 107/156] FROMLIST(v1): ASoC: meson: imply acodec glue on axg + sound card + +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 8b6295283989..363dc3b1bbe4 100644 +--- a/sound/soc/meson/Kconfig ++++ b/sound/soc/meson/Kconfig +@@ -68,6 +68,7 @@ config SND_MESON_AXG_SOUND_CARD + imply SND_MESON_AXG_SPDIFOUT + imply SND_MESON_AXG_SPDIFIN + imply SND_MESON_AXG_PDM ++ imply SND_MESON_G12A_TOACODEC + imply SND_MESON_G12A_TOHDMITX if DRM_MESON_DW_HDMI + help + Select Y or M to add support for the AXG SoC sound card +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0108-FROMLIST-v1-dt-bindings-net-dwmac-meson-Add-a-compat.patch b/projects/Amlogic/patches/linux/amlogic-0108-FROMLIST-v1-dt-bindings-net-dwmac-meson-Add-a-compat.patch new file mode 100644 index 0000000000..e186a3df75 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0108-FROMLIST-v1-dt-bindings-net-dwmac-meson-Add-a-compat.patch @@ -0,0 +1,51 @@ +From 1621acb09a49c3ad804a0f555021cee1f82016f1 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 29 Jun 2020 15:36:46 +0000 +Subject: [PATCH 108/156] FROMLIST(v1): dt-bindings: net: dwmac-meson: Add a + compatible string for G12A onwards + +Amlogic Meson G12A, G12B and SM1 have the same (at least as far as we +know at the time of writing) PRG_ETHERNET glue register implementation. +This implementation however is slightly different from AXG as it now has +an undocument "auto cali idx val" register in PRG_ETH1[17:16] which +seems to be related to RGMII Ethernet. + +Add a compatible string for G12A and newer so the new registers can be +used. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +index 64c20c92c07d..85fefe3a0444 100644 +--- a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml ++++ b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +@@ -22,6 +22,7 @@ select: + - amlogic,meson8m2-dwmac + - amlogic,meson-gxbb-dwmac + - amlogic,meson-axg-dwmac ++ - amlogic,meson-g12a-dwmac + required: + - compatible + +@@ -36,6 +37,7 @@ allOf: + - amlogic,meson8m2-dwmac + - amlogic,meson-gxbb-dwmac + - amlogic,meson-axg-dwmac ++ - amlogic,meson-g12a-dwmac + + then: + properties: +@@ -95,6 +97,7 @@ properties: + - amlogic,meson8m2-dwmac + - amlogic,meson-gxbb-dwmac + - amlogic,meson-axg-dwmac ++ - amlogic,meson-g12a-dwmac + contains: + enum: + - snps,dwmac-3.70a +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0109-FROMLIST-v1-net-stmmac-dwmac-meson8b-add-a-compatibl.patch b/projects/Amlogic/patches/linux/amlogic-0109-FROMLIST-v1-net-stmmac-dwmac-meson8b-add-a-compatibl.patch new file mode 100644 index 0000000000..337dee27c9 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0109-FROMLIST-v1-net-stmmac-dwmac-meson8b-add-a-compatibl.patch @@ -0,0 +1,38 @@ +From 76b9a338e5d1c0be6d21dc51b309fcbdb95b245c Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 29 Jun 2020 15:37:37 +0000 +Subject: [PATCH 109/156] FROMLIST(v1): net: stmmac: dwmac-meson8b: add a + compatible string for G12A SoCs + +Amlogic Meson G12A, G12B and SM1 have the same (at least as far as we +know at the time of writing) PRG_ETHERNET glue register implementation. +This implementation however is slightly different from AXG as it now has +an undocument "auto cali idx val" register in PRG_ETH1[17:16] which +seems to be related to RGMII Ethernet. + +Add a new compatible string for G12A SoCs so the logic for this new +register can be implemented in the future. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index 234e8b6816ce..544bc621146c 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -491,6 +491,10 @@ static const struct of_device_id meson8b_dwmac_match[] = { + .compatible = "amlogic,meson-axg-dwmac", + .data = &meson_axg_dwmac_data, + }, ++ { ++ .compatible = "amlogic,meson-g12a-dwmac", ++ .data = &meson_axg_dwmac_data, ++ }, + { } + }; + MODULE_DEVICE_TABLE(of, meson8b_dwmac_match); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0110-FROMLIST-v1-net-stmmac-dwmac-meson8b-use-clk_parent_.patch b/projects/Amlogic/patches/linux/amlogic-0110-FROMLIST-v1-net-stmmac-dwmac-meson8b-use-clk_parent_.patch new file mode 100644 index 0000000000..3b0b174e30 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0110-FROMLIST-v1-net-stmmac-dwmac-meson8b-use-clk_parent_.patch @@ -0,0 +1,143 @@ +From f2a2a00a158fdf93010b6890d590a100871fc9d3 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Tue, 30 Jun 2020 00:17:01 +0000 +Subject: [PATCH 110/156] FROMLIST(v1): net: stmmac: dwmac-meson8b: use + clk_parent_data for clock registration + +Simplify meson8b_init_rgmii_tx_clk() by using struct clk_parent_data to +initialize the clock parents. No functional changes intended. + +Signed-off-by: Martin Blumenstingl +--- + .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 49 +++++++------------ + 1 file changed, 17 insertions(+), 32 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index 544bc621146c..5afcf05bbf9c 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -69,8 +69,6 @@ + */ + #define PRG_ETH0_ADJ_SKEW GENMASK(24, 20) + +-#define MUX_CLK_NUM_PARENTS 2 +- + struct meson8b_dwmac; + + struct meson8b_dwmac_data { +@@ -110,12 +108,12 @@ static void meson8b_dwmac_mask_bits(struct meson8b_dwmac *dwmac, u32 reg, + + static struct clk *meson8b_dwmac_register_clk(struct meson8b_dwmac *dwmac, + const char *name_suffix, +- const char **parent_names, ++ const struct clk_parent_data *parents, + int num_parents, + const struct clk_ops *ops, + struct clk_hw *hw) + { +- struct clk_init_data init; ++ struct clk_init_data init = { }; + char clk_name[32]; + + snprintf(clk_name, sizeof(clk_name), "%s#%s", dev_name(dwmac->dev), +@@ -124,7 +122,7 @@ static struct clk *meson8b_dwmac_register_clk(struct meson8b_dwmac *dwmac, + init.name = clk_name; + init.ops = ops; + init.flags = CLK_SET_RATE_PARENT; +- init.parent_names = parent_names; ++ init.parent_data = parents; + init.num_parents = num_parents; + + hw->init = &init; +@@ -134,11 +132,12 @@ static struct clk *meson8b_dwmac_register_clk(struct meson8b_dwmac *dwmac, + + static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) + { +- int i, ret; + struct clk *clk; + struct device *dev = dwmac->dev; +- const char *parent_name, *mux_parent_names[MUX_CLK_NUM_PARENTS]; +- struct meson8b_dwmac_clk_configs *clk_configs; ++ static const struct clk_parent_data mux_parents[] = { ++ { .fw_name = "clkin0", }, ++ { .fw_name = "clkin1", }, ++ }; + static const struct clk_div_table div_table[] = { + { .div = 2, .val = 2, }, + { .div = 3, .val = 3, }, +@@ -148,62 +147,48 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) + { .div = 7, .val = 7, }, + { /* end of array */ } + }; ++ struct meson8b_dwmac_clk_configs *clk_configs; ++ struct clk_parent_data parent_data = { }; + + clk_configs = devm_kzalloc(dev, sizeof(*clk_configs), GFP_KERNEL); + if (!clk_configs) + return -ENOMEM; + +- /* get the mux parents from DT */ +- for (i = 0; i < MUX_CLK_NUM_PARENTS; i++) { +- char name[16]; +- +- snprintf(name, sizeof(name), "clkin%d", i); +- clk = devm_clk_get(dev, name); +- if (IS_ERR(clk)) { +- ret = PTR_ERR(clk); +- if (ret != -EPROBE_DEFER) +- dev_err(dev, "Missing clock %s\n", name); +- return ret; +- } +- +- mux_parent_names[i] = __clk_get_name(clk); +- } +- + clk_configs->m250_mux.reg = dwmac->regs + PRG_ETH0; + clk_configs->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT; + clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK; +- clk = meson8b_dwmac_register_clk(dwmac, "m250_sel", mux_parent_names, +- MUX_CLK_NUM_PARENTS, &clk_mux_ops, ++ clk = meson8b_dwmac_register_clk(dwmac, "m250_sel", mux_parents, ++ ARRAY_SIZE(mux_parents), &clk_mux_ops, + &clk_configs->m250_mux.hw); + if (WARN_ON(IS_ERR(clk))) + return PTR_ERR(clk); + +- parent_name = __clk_get_name(clk); ++ parent_data.hw = &clk_configs->m250_mux.hw; + clk_configs->m250_div.reg = dwmac->regs + PRG_ETH0; + clk_configs->m250_div.shift = PRG_ETH0_CLK_M250_DIV_SHIFT; + clk_configs->m250_div.width = PRG_ETH0_CLK_M250_DIV_WIDTH; + clk_configs->m250_div.table = div_table; + clk_configs->m250_div.flags = CLK_DIVIDER_ALLOW_ZERO | + CLK_DIVIDER_ROUND_CLOSEST; +- clk = meson8b_dwmac_register_clk(dwmac, "m250_div", &parent_name, 1, ++ clk = meson8b_dwmac_register_clk(dwmac, "m250_div", &parent_data, 1, + &clk_divider_ops, + &clk_configs->m250_div.hw); + if (WARN_ON(IS_ERR(clk))) + return PTR_ERR(clk); + +- parent_name = __clk_get_name(clk); ++ parent_data.hw = &clk_configs->m250_div.hw; + clk_configs->fixed_div2.mult = 1; + clk_configs->fixed_div2.div = 2; +- clk = meson8b_dwmac_register_clk(dwmac, "fixed_div2", &parent_name, 1, ++ clk = meson8b_dwmac_register_clk(dwmac, "fixed_div2", &parent_data, 1, + &clk_fixed_factor_ops, + &clk_configs->fixed_div2.hw); + if (WARN_ON(IS_ERR(clk))) + return PTR_ERR(clk); + +- parent_name = __clk_get_name(clk); ++ parent_data.hw = &clk_configs->fixed_div2.hw; + clk_configs->rgmii_tx_en.reg = dwmac->regs + PRG_ETH0; + clk_configs->rgmii_tx_en.bit_idx = PRG_ETH0_RGMII_TX_CLK_EN; +- clk = meson8b_dwmac_register_clk(dwmac, "rgmii_tx_en", &parent_name, 1, ++ clk = meson8b_dwmac_register_clk(dwmac, "rgmii_tx_en", &parent_data, 1, + &clk_gate_ops, + &clk_configs->rgmii_tx_en.hw); + if (WARN_ON(IS_ERR(clk))) +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0111-FROMLIST-v1-arm64-dts-meson-odroid-n2-enable-audio-l.patch b/projects/Amlogic/patches/linux/amlogic-0111-FROMLIST-v1-arm64-dts-meson-odroid-n2-enable-audio-l.patch new file mode 100644 index 0000000000..e12774436e --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0111-FROMLIST-v1-arm64-dts-meson-odroid-n2-enable-audio-l.patch @@ -0,0 +1,124 @@ +From bc2508a27c990f670eb0a5bb7be37f0edefc21cd Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 2 Jul 2020 13:32:19 +0000 +Subject: [PATCH 111/156] FROMLIST(v1): arm64: dts: meson: odroid-n2: enable + audio loopback + +Add capture pcm interfaces and loopback routes to the odroid-n2 + +Signed-off-by: Jerome Brunet +--- + .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 65 +++++++++++++++++-- + 1 file changed, 61 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +index 169ea283d4ee..d4421ad164bd 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +@@ -209,11 +209,28 @@ + sound { + compatible = "amlogic,axg-sound-card"; + model = "G12B-ODROID-N2"; +- audio-aux-devs = <&tdmout_b>; ++ audio-aux-devs = <&tdmout_b>, <&tdmin_a>, <&tdmin_b>, ++ <&tdmin_c>, <&tdmin_lb>; + 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"; ++ "TDM_B Playback", "TDMOUT_B OUT", ++ "TDMIN_A IN 4", "TDM_B Loopback", ++ "TDMIN_B IN 4", "TDM_B Loopback", ++ "TDMIN_C IN 4", "TDM_B Loopback", ++ "TDMIN_LB IN 1", "TDM_B Loopback", ++ "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"; + + assigned-clocks = <&clkc CLKID_MPLL2>, + <&clkc CLKID_MPLL0>, +@@ -236,8 +253,20 @@ + sound-dai = <&frddr_c>; + }; + +- /* 8ch hdmi interface */ + dai-link-3 { ++ sound-dai = <&toddr_a>; ++ }; ++ ++ dai-link-4 { ++ sound-dai = <&toddr_b>; ++ }; ++ ++ dai-link-5 { ++ sound-dai = <&toddr_c>; ++ }; ++ ++ /* 8ch hdmi interface */ ++ dai-link-6 { + sound-dai = <&tdmif_b>; + dai-format = "i2s"; + dai-tdm-slot-tx-mask-0 = <1 1>; +@@ -252,7 +281,7 @@ + }; + + /* hdmi glue */ +- dai-link-4 { ++ dai-link-7 { + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; + + codec { +@@ -476,6 +505,22 @@ + status = "okay"; + }; + ++&tdmin_a { ++ status = "okay"; ++}; ++ ++&tdmin_b { ++ status = "okay"; ++}; ++ ++&tdmin_c { ++ status = "okay"; ++}; ++ ++&tdmin_lb { ++ status = "okay"; ++}; ++ + &tdmout_b { + status = "okay"; + }; +@@ -484,6 +529,18 @@ + status = "okay"; + }; + ++&toddr_a { ++ status = "okay"; ++}; ++ ++&toddr_b { ++ status = "okay"; ++}; ++ ++&toddr_c { ++ status = "okay"; ++}; ++ + &uart_AO { + status = "okay"; + pinctrl-0 = <&uart_ao_a_pins>; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0112-FROMLIST-v1-arm64-dts-meson-odroid-n2-add-jack-audio.patch b/projects/Amlogic/patches/linux/amlogic-0112-FROMLIST-v1-arm64-dts-meson-odroid-n2-add-jack-audio.patch new file mode 100644 index 0000000000..374f75df7b --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0112-FROMLIST-v1-arm64-dts-meson-odroid-n2-add-jack-audio.patch @@ -0,0 +1,170 @@ +From 049d25c4b0274849dafe2a7a30dda3dc8f09a70f Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Thu, 2 Jul 2020 13:40:26 +0000 +Subject: [PATCH 112/156] FROMLIST(v1): arm64: dts: meson: odroid-n2: add jack + audio output support + +Add support for audio on jack socket of the odroid-n2 + +Signed-off-by: Jerome Brunet +--- + .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 79 +++++++++++++++++-- + 1 file changed, 74 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +index d4421ad164bd..34fffa6d859d 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +@@ -9,6 +9,7 @@ + #include "meson-g12b-s922x.dtsi" + #include + #include ++#include + #include + + / { +@@ -20,6 +21,14 @@ + 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 = "U19"; ++ status = "okay"; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +@@ -209,16 +218,26 @@ + sound { + compatible = "amlogic,axg-sound-card"; + model = "G12B-ODROID-N2"; +- audio-aux-devs = <&tdmout_b>, <&tdmin_a>, <&tdmin_b>, +- <&tdmin_c>, <&tdmin_lb>; ++ audio-widgets = "Line", "Lineout"; ++ audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>, ++ <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>, ++ <&dioo2133>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", + "TDMOUT_B IN 2", "FRDDR_C OUT 1", + "TDM_B Playback", "TDMOUT_B OUT", ++ "TDMOUT_C IN 0", "FRDDR_A OUT 2", ++ "TDMOUT_C IN 1", "FRDDR_B OUT 2", ++ "TDMOUT_C IN 2", "FRDDR_C OUT 2", ++ "TDM_C Playback", "TDMOUT_C OUT", + "TDMIN_A IN 4", "TDM_B Loopback", + "TDMIN_B IN 4", "TDM_B Loopback", + "TDMIN_C IN 4", "TDM_B Loopback", + "TDMIN_LB IN 1", "TDM_B Loopback", ++ "TDMIN_A IN 5", "TDM_C Loopback", ++ "TDMIN_B IN 5", "TDM_C Loopback", ++ "TDMIN_C IN 5", "TDM_C Loopback", ++ "TDMIN_LB IN 2", "TDM_C Loopback", + "TODDR_A IN 0", "TDMIN_A OUT", + "TODDR_B IN 0", "TDMIN_A OUT", + "TODDR_C IN 0", "TDMIN_A OUT", +@@ -230,7 +249,11 @@ + "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"; ++ "TODDR_C IN 6", "TDMIN_LB OUT", ++ "U19 INL", "ACODEC LOLP", ++ "U19 INR", "ACODEC LORP", ++ "Lineout", "U19 OUTL", ++ "Lineout", "U19 OUTR"; + + assigned-clocks = <&clkc CLKID_MPLL2>, + <&clkc CLKID_MPLL0>, +@@ -275,22 +298,56 @@ + dai-tdm-slot-tx-mask-3 = <1 1>; + mclk-fs = <256>; + +- codec { ++ codec-0 { + sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; + }; ++ ++ codec-1 { ++ sound-dai = <&toacodec TOACODEC_IN_B>; ++ }; + }; + +- /* hdmi glue */ ++ /* i2s jack output interface */ + dai-link-7 { ++ sound-dai = <&tdmif_c>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&toacodec TOACODEC_IN_C>; ++ }; ++ }; ++ ++ /* hdmi glue */ ++ dai-link-8 { + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; + + codec { + sound-dai = <&hdmi_tx>; + }; + }; ++ ++ /* acodec glue */ ++ dai-link-9 { ++ sound-dai = <&toacodec TOACODEC_OUT>; ++ ++ codec { ++ sound-dai = <&acodec>; ++ }; ++ }; + }; + }; + ++&acodec { ++ AVDD-supply = <&vddao_1v8>; ++ status = "okay"; ++}; ++ + &arb { + status = "okay"; + }; +@@ -505,6 +562,10 @@ + status = "okay"; + }; + ++&tdmif_c { ++ status = "okay"; ++}; ++ + &tdmin_a { + status = "okay"; + }; +@@ -525,6 +586,14 @@ + status = "okay"; + }; + ++&tdmout_c { ++ status = "okay"; ++}; ++ ++&toacodec { ++ status = "okay"; ++}; ++ + &tohdmitx { + status = "okay"; + }; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0113-FROMLIST-v1-tty-serial-meson_uart-Init-port-lock-ear.patch b/projects/Amlogic/patches/linux/amlogic-0113-FROMLIST-v1-tty-serial-meson_uart-Init-port-lock-ear.patch new file mode 100644 index 0000000000..9e5f350abd --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0113-FROMLIST-v1-tty-serial-meson_uart-Init-port-lock-ear.patch @@ -0,0 +1,39 @@ +From 08202a28756ad3c1d085c9d5f0078e8e044b4fe4 Mon Sep 17 00:00:00 2001 +From: Marc Zyngier +Date: Sun, 5 Jul 2020 09:52:32 +0000 +Subject: [PATCH 113/156] FROMLIST(v1): tty: serial: meson_uart: Init port lock + early + +The meson UART driver triggers a lockdep splat at boot time, due +to the new expectation that the driver has to initialize the +per-port spinlock itself. + +It remains unclear why a double initialization of the port +spinlock is a desirable outcome, but in the meantime let's +fix the splat. + +Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console") +Cc: Andy Shevchenko +Cc: Greg Kroah-Hartman +Signed-off-by: Marc Zyngier +--- + drivers/tty/serial/meson_uart.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c +index d2c08b760f83..386e39c90628 100644 +--- a/drivers/tty/serial/meson_uart.c ++++ b/drivers/tty/serial/meson_uart.c +@@ -759,6 +759,9 @@ static int meson_uart_probe(struct platform_device *pdev) + if (ret) + return ret; + ++ /* Init the spinlock early in case this is the console */ ++ spin_lock_init(&port->lock); ++ + port->iotype = UPIO_MEM; + port->mapbase = res_mem->start; + port->mapsize = resource_size(res_mem); +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0114-REVERT-ASoC-soc-pcm-dpcm-fix-playback-capture-checks.patch b/projects/Amlogic/patches/linux/amlogic-0114-REVERT-ASoC-soc-pcm-dpcm-fix-playback-capture-checks.patch new file mode 100644 index 0000000000..63efbc4d49 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0114-REVERT-ASoC-soc-pcm-dpcm-fix-playback-capture-checks.patch @@ -0,0 +1,74 @@ +From 981a429881b2101ee54a523755492b941abecba6 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Mon, 29 Jun 2020 15:34:00 +0000 +Subject: [PATCH 114/156] REVERT: ASoC: soc-pcm: dpcm: fix playback/capture + checks + +This reverts commit 1bb707fbfd5c246028d76b8f11a19dfd118d6306 which +breaks G12A audio due to wrong merge of a 5.8 change. +--- + sound/soc/soc-pcm.c | 44 ++++++++++---------------------------------- + 1 file changed, 10 insertions(+), 34 deletions(-) + +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c +index 39ce61c5b874..1f302de44052 100644 +--- a/sound/soc/soc-pcm.c ++++ b/sound/soc/soc-pcm.c +@@ -2908,44 +2908,20 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) + struct snd_pcm *pcm; + char new_name[64]; + int ret = 0, playback = 0, capture = 0; +- int stream; + int i; + +- if (rtd->dai_link->dynamic && rtd->num_cpus > 1) { +- dev_err(rtd->dev, +- "DPCM doesn't support Multi CPU for Front-Ends yet\n"); +- return -EINVAL; +- } +- + if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { +- if (rtd->dai_link->dpcm_playback) { +- stream = SNDRV_PCM_STREAM_PLAYBACK; +- +- for_each_rtd_cpu_dais(rtd, i, cpu_dai) +- if (!snd_soc_dai_stream_valid(cpu_dai, +- stream)) { +- dev_err(rtd->card->dev, +- "CPU DAI %s for rtd %s does not support playback\n", +- cpu_dai->name, +- rtd->dai_link->stream_name); +- return -EINVAL; +- } +- playback = 1; +- } +- if (rtd->dai_link->dpcm_capture) { +- stream = SNDRV_PCM_STREAM_CAPTURE; +- +- for_each_rtd_cpu_dais(rtd, i, cpu_dai) +- if (!snd_soc_dai_stream_valid(cpu_dai, +- stream)) { +- dev_err(rtd->card->dev, +- "CPU DAI %s for rtd %s does not support capture\n", +- cpu_dai->name, +- rtd->dai_link->stream_name); +- return -EINVAL; +- } +- capture = 1; ++ cpu_dai = asoc_rtd_to_cpu(rtd, 0); ++ if (rtd->num_cpus > 1) { ++ dev_err(rtd->dev, ++ "DPCM doesn't support Multi CPU yet\n"); ++ return -EINVAL; + } ++ ++ playback = rtd->dai_link->dpcm_playback && ++ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK); ++ capture = rtd->dai_link->dpcm_capture && ++ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE); + } else { + /* Adapt stream for codec2codec links */ + int cpu_capture = rtd->dai_link->params ? +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0115-WIP-drm-panfrost-add-support-for-custom-soft-reset-o.patch b/projects/Amlogic/patches/linux/amlogic-0115-WIP-drm-panfrost-add-support-for-custom-soft-reset-o.patch new file mode 100644 index 0000000000..fef2de5776 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0115-WIP-drm-panfrost-add-support-for-custom-soft-reset-o.patch @@ -0,0 +1,63 @@ +From 35341275c39d2c98dc8da80621c81084697ae5b7 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Fri, 13 Mar 2020 09:44:50 +0000 +Subject: [PATCH 115/156] WIP: drm/panfrost: add support for custom soft-reset + on Amlogic G12 + +Signed-off-by: Neil Armstrong +--- + 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 e0f190e43813..40cd9728ccbd 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c +@@ -9,8 +9,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + + #include "panfrost_device.h" + #include "panfrost_features.h" +@@ -60,7 +62,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-g12a-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..4f4ed17d0262 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_regs.h ++++ b/drivers/gpu/drm/panfrost/panfrost_regs.h +@@ -51,6 +51,10 @@ + #define GPU_STATUS 0x34 + #define GPU_STATUS_PRFCNT_ACTIVE BIT(2) + #define GPU_LATEST_FLUSH_ID 0x38 ++#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_FAULT_STATUS 0x3C + #define GPU_FAULT_ADDRESS_LO 0x40 + #define GPU_FAULT_ADDRESS_HI 0x44 +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch b/projects/Amlogic/patches/linux/amlogic-0116-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch similarity index 87% rename from packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch rename to projects/Amlogic/patches/linux/amlogic-0116-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch index d7c0a6f0c4..5fa4a44b0e 100644 --- a/packages/linux/patches/amlogic/amlogic-0033-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch +++ b/projects/Amlogic/patches/linux/amlogic-0116-WIP-clk-meson-g12a-fix-gp0-and-hifi-ranges.patch @@ -1,7 +1,7 @@ -From f346db4e5460337ece11280792aae0f7064a072f Mon Sep 17 00:00:00 2001 +From a49b5ea299d4b5cc7259738f548fe5be167ee1b6 Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Fri, 15 Feb 2019 14:21:27 +0100 -Subject: [PATCH 033/146] WIP: clk: meson: g12a: fix gp0 and hifi ranges +Subject: [PATCH 116/156] 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 @@ -21,7 +21,7 @@ Signed-off-by: Jerome Brunet 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c -index d2760a021301..cd1de3e004e4 100644 +index 5c2e5cedca96..7fe99b36a53b 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c @@ -1591,7 +1591,7 @@ static struct clk_regmap g12b_cpub_clk_trace = { diff --git a/projects/Amlogic/patches/linux/amlogic-0117-WIP-clk-meson-g12a-fix-hifi-pll-lock.patch b/projects/Amlogic/patches/linux/amlogic-0117-WIP-clk-meson-g12a-fix-hifi-pll-lock.patch new file mode 100644 index 0000000000..466aeccdc8 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0117-WIP-clk-meson-g12a-fix-hifi-pll-lock.patch @@ -0,0 +1,33 @@ +From 99b732b7cd8b442ceec880d36586d24a5c2b1c23 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 17 Jun 2020 16:30:53 +0000 +Subject: [PATCH 117/156] WIP: clk: meson: g12a: fix hifi pll lock + +The HIFI pll of the g12a sometimes takes a long time to report the lock in +HIFI_PLL_CNTL0 bit 31. The would eventually be reported but the delay may +be so long that the driver consider it a lock failure. + +Bit 30 seems to do the same job but more quickly, let's try this instead. + +Fixes: 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller") +Signed-off-by: Jerome Brunet +--- + 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 7fe99b36a53b..e672e9f015f0 100644 +--- a/drivers/clk/meson/g12a.c ++++ b/drivers/clk/meson/g12a.c +@@ -1771,7 +1771,7 @@ static struct clk_regmap g12a_hifi_pll_dco = { + }, + .l = { + .reg_off = HHI_HIFI_PLL_CNTL0, +- .shift = 31, ++ .shift = 30, + .width = 1, + }, + .rst = { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0118-WIP-dt-bindings-arm-amlogic-add-support-for-the-WeTe.patch b/projects/Amlogic/patches/linux/amlogic-0118-WIP-dt-bindings-arm-amlogic-add-support-for-the-WeTe.patch new file mode 100644 index 0000000000..0a42bc4bda --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0118-WIP-dt-bindings-arm-amlogic-add-support-for-the-WeTe.patch @@ -0,0 +1,45 @@ +From c3ce4d9a0b6e5c0230ddc6a9294eb25387ad338d Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 14 May 2020 04:05:10 +0000 +Subject: [PATCH 118/156] WIP: dt-bindings: arm: amlogic: add support for the + WeTek Core 2 + +The WeTek Core 2 is a commercial Android device based on the Amlogic Q200 +reference design using the S912-H chipset. Specs: + +3GB DDR3 RAM +32GB eMMC storage +10/100 Ethernet using Realtex RTL8152 +802.11 a/b/g/n/ac + BT 4.1 HS sdio wireless module (AP6356S) +2x single colour LEDs to indicate power +1x power button +1x reset button on the underside of the box +HDMI 2.0 (4k@60p) video +Composite video + 2-channel audio output on 3.5mm jack +S/PDIF audio output +2x USB 2.0 ports +1x USB OTG port (internal) +1x micro SD card slot +UART pins (internal) +IR Sensor + +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 db35e0d0134c..d06c77233e4d 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -121,6 +121,7 @@ properties: + - libretech,aml-s912-pc + - nexbox,a1 + - tronsmart,vega-s96 ++ - wetek,core2 + - const: amlogic,s912 + - const: amlogic,meson-gxm + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0119-WIP-arm64-dts-meson-add-support-for-the-WeTek-Core-2.patch b/projects/Amlogic/patches/linux/amlogic-0119-WIP-arm64-dts-meson-add-support-for-the-WeTek-Core-2.patch new file mode 100644 index 0000000000..de0e3b580b --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0119-WIP-arm64-dts-meson-add-support-for-the-WeTek-Core-2.patch @@ -0,0 +1,132 @@ +From d925973e7033a5f0a75927d3ebe3ad1c17afa965 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 14 May 2020 03:57:23 +0000 +Subject: [PATCH 119/156] WIP: arm64: dts: meson: add support for the WeTek + Core 2 + +The WeTek Core2 is a commercial device based on the Amlogic Q200 reference +design but with the following differences: + +- 3GB RAM, 32GB eMMC +- Blue and Red LEDs used to signal on/off status +- uart_AO can be accessed after opening the case; soldering required +- USB OTG is not accessible (inside the case) + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../dts/amlogic/meson-gxm-wetek-core2.dts | 90 +++++++++++++++++++ + 2 files changed, 91 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-wetek-core2.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index 5cac4d1d487d..4e2239ffcaa5 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -41,6 +41,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q201.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-rbox-pro.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-s912-libretech-pc.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-wetek-core2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-wetek-core2.dts +new file mode 100644 +index 000000000000..4b973dc1e559 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-wetek-core2.dts +@@ -0,0 +1,90 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2020 Christian Hewitt ++ */ ++ ++/dts-v1/; ++ ++#include "meson-gxm.dtsi" ++#include "meson-gx-p23x-q20x.dtsi" ++#include ++#include ++ ++/ { ++ compatible = "wetek,core2", "amlogic,s912", "amlogic,meson-gxm"; ++ model = "WeTek Core 2"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */ ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ blue { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 0>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1710000>; ++ ++ button-update { ++ label = "update"; ++ linux,code = ; ++ press-threshold-microvolt = <10000>; ++ }; ++ }; ++ ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ poll-interval = <100>; ++ ++ button-power { ++ label = "power"; ++ linux,code = ; ++ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++/* This is disabled as Realtek RTL8152 USB provides Ethernet */ ++ðmac { ++ status = "disabled"; ++ phy-mode = "rmii"; ++ phy-handle = <&internal_phy>; ++}; ++ ++&internal_phy { ++ pinctrl-0 = <ð_link_led_pins>, <ð_act_led_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-wetek-play2"; ++}; ++ ++/* 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; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ enable-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-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch b/projects/Amlogic/patches/linux/amlogic-0120-WIP-dt-bindings-arm-amlogic-add-support-for-the-Tani.patch similarity index 78% rename from packages/linux/patches/amlogic/amlogic-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch rename to projects/Amlogic/patches/linux/amlogic-0120-WIP-dt-bindings-arm-amlogic-add-support-for-the-Tani.patch index 3d2f59d386..cae109f5e7 100644 --- a/packages/linux/patches/amlogic/amlogic-0130-FROMLIST-dt-bindings-arm-amlogic-add-support-for-the.patch +++ b/projects/Amlogic/patches/linux/amlogic-0120-WIP-dt-bindings-arm-amlogic-add-support-for-the-Tani.patch @@ -1,8 +1,8 @@ -From 6b445aae3d6ec06df2adaecfbf33c2a02ddbe283 Mon Sep 17 00:00:00 2001 +From c6941e0d1e23fafbe06c1bdc3a24e4b83cebba14 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 +Subject: [PATCH 120/156] WIP: 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. @@ -13,10 +13,10 @@ Signed-off-by: Christian Hewitt 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 +index d06c77233e4d..46cb6359f530 100644 --- a/Documentation/devicetree/bindings/arm/amlogic.yaml +++ b/Documentation/devicetree/bindings/arm/amlogic.yaml -@@ -137,6 +137,7 @@ properties: +@@ -138,6 +138,7 @@ properties: - amediatech,x96-max - amlogic,u200 - seirobotics,sei510 diff --git a/packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch b/projects/Amlogic/patches/linux/amlogic-0121-WIP-arm64-dts-meson-add-support-for-the-Tanix-TX5-Ma.patch similarity index 96% rename from packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch rename to projects/Amlogic/patches/linux/amlogic-0121-WIP-arm64-dts-meson-add-support-for-the-Tanix-TX5-Ma.patch index f8e00c1862..ca5c99d1c6 100644 --- a/packages/linux/patches/amlogic/amlogic-0131-FROMLIST-arm64-dts-meson-g12a-tanix-tx5max-add-initi.patch +++ b/projects/Amlogic/patches/linux/amlogic-0121-WIP-arm64-dts-meson-add-support-for-the-Tanix-TX5-Ma.patch @@ -1,10 +1,10 @@ -From 371d0120f2ea3ce669669680d1ca1e762843a895 Mon Sep 17 00:00:00 2001 +From 36f7281201a6c413a084079d5cfd5f564e3d0635 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 +Subject: [PATCH 121/156] WIP: arm64: dts: meson: add support for the Tanix TX5 + Max -The Oranth Tanix TX5 Max is based on the Amlogic U200 reference design +The Tanix TX5 Max is based on the Amlogic U200 reference design using the S905X2 chipset. Hardware specification: - 4GB LPDDR4 RAM @@ -18,9 +18,6 @@ using the S905X2 chipset. Hardware specification: - 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 + @@ -29,7 +26,7 @@ Signed-off-by: Christian Hewitt 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 +index 4e2239ffcaa5..e03ae9a2be38 100644 --- a/arch/arm64/boot/dts/amlogic/Makefile +++ b/arch/arm64/boot/dts/amlogic/Makefile @@ -1,6 +1,7 @@ @@ -42,7 +39,7 @@ index ce276044748b..c1185c932b33 100644 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 +index 000000000000..48efd72930b0 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-tanix-tx5max.dts @@ -0,0 +1,481 @@ @@ -196,6 +193,13 @@ index 000000000000..c3ef0ee37d6f + regulator-always-on; + }; + ++ 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-TANIX-TX5MAX"; @@ -275,13 +279,6 @@ index 000000000000..c3ef0ee37d6f + }; + }; + }; -+ -+ wifi32k: wifi32k { -+ compatible = "pwm-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <32768>; -+ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ -+ }; +}; + +&arb { @@ -491,7 +488,7 @@ index 000000000000..c3ef0ee37d6f +/* eMMC */ +&sd_emmc_c { + status = "okay"; -+ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; ++ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; + pinctrl-1 = <&emmc_clk_gate_pins>; + pinctrl-names = "default", "clk-gate"; + diff --git a/projects/Amlogic/patches/linux/amlogic-0122-WIP-arm64-dts-meson-add-common-SM1-ac2xx-dtsi.patch b/projects/Amlogic/patches/linux/amlogic-0122-WIP-arm64-dts-meson-add-common-SM1-ac2xx-dtsi.patch new file mode 100644 index 0000000000..3d89c8578d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0122-WIP-arm64-dts-meson-add-common-SM1-ac2xx-dtsi.patch @@ -0,0 +1,411 @@ +From 4ffc710a4c5f6c9a5f16577daeb206015b8b69e5 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 24 Jun 2020 12:41:46 +0000 +Subject: [PATCH 122/156] WIP: arm64: dts: meson: add common SM1 ac2xx dtsi + +Add a common dtsi for Android STB devices based on the Amlogic S905X3 +(AC213/AC214) and S905D3 (AC201/AC202) reference designs. The dtsi is +loosely based on the existing SEI610 device-tree. + +Popular SS905X3/D3 devices often ship in three configurations: + +- 2GB/16GB with 10/100 internal PHY ethernet +- 4GB/32GB with 1GB external PHY ethernet +- 4GB/64GB with 1GB external PHY ethernet + +Device dts filenames based on the common dtsi should include a 2g/4g +suffix, as this helps users to select a device-tree that matches the +Ethernet PHY spec for their device, e.g. + +- meson-sm1-tvbox-2g.dts +- meson-sm1-tvbox-4g.dts + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-sm1-ac2xx.dtsi | 374 ++++++++++++++++++ + 1 file changed, 374 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi +new file mode 100644 +index 000000000000..b37c37320bef +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi +@@ -0,0 +1,374 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 BayLibre SAS. All rights reserved. ++ * Copyright (c) 2020 Christian Hewitt ++ * ++ * AC200/AC202 = S905D3 ++ * AC213/AC214 = S905X3 ++ * ++ */ ++ ++#include "meson-sm1.dtsi" ++#include ++#include ++#include ++#include ++ ++/ { ++ aliases { ++ serial0 = &uart_AO; ++ ethernet0 = ðmac; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ hdmi-connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++ ++ ao_5v: regulator-ao_5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "AO_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&dc_in>; ++ 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; ++ }; ++ ++ emmc_1v8: regulator-emmc_1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "EMMC_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 { ++ /* ++ * SY8120B1ABC DC/DC Regulator. ++ */ ++ compatible = "pwm-regulator"; ++ ++ regulator-name = "VDDCPU"; ++ regulator-min-microvolt = <690000>; ++ regulator-max-microvolt = <1050000>; ++ ++ vin-supply = <&dc_in>; ++ ++ pwms = <&pwm_AO_cd 1 1500 0>; ++ pwm-dutycycle-range = <100 0>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vddio_ao1v8: regulator-vddio_ao1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDIO_AO1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vddao_3v3>; ++ regulator-always-on; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; ++ clocks = <&wifi32k>; ++ clock-names = "ext_clock"; ++ }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "SM1-X96-AIR"; ++ audio-aux-devs = <&tdmout_b>; ++ audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", ++ "TDMOUT_B IN 1", "FRDDR_B OUT 1", ++ "TDMOUT_B IN 2", "FRDDR_C OUT 1", ++ "TDM_B Playback", "TDMOUT_B OUT"; ++ ++ assigned-clocks = <&clkc CLKID_MPLL2>, ++ <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>; ++ assigned-clock-parents = <0>, <0>, <0>; ++ assigned-clock-rates = <294912000>, ++ <270950400>, ++ <393216000>; ++ status = "okay"; ++ ++ dai-link-0 { ++ sound-dai = <&frddr_a>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&frddr_b>; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&frddr_c>; ++ }; ++ ++ /* 8ch hdmi interface */ ++ dai-link-3 { ++ sound-dai = <&tdmif_b>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ dai-tdm-slot-tx-mask-1 = <1 1>; ++ dai-tdm-slot-tx-mask-2 = <1 1>; ++ dai-tdm-slot-tx-mask-3 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; ++ }; ++ }; ++ ++ /* hdmi glue */ ++ dai-link-4 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; ++ ++ codec { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++ ++ wifi32k: wifi32k { ++ compatible = "pwm-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ ++ }; ++}; ++ ++&arb { ++ status = "okay"; ++}; ++ ++&cec_AO { ++ pinctrl-0 = <&cec_ao_a_h_pins>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ hdmi-phandle = <&hdmi_tx>; ++}; ++ ++&cecb_AO { ++ pinctrl-0 = <&cec_ao_b_h_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ hdmi-phandle = <&hdmi_tx>; ++}; ++ ++&clkc_audio { ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vddcpu>; ++ 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>; ++}; ++ ++&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_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-x96max"; ++}; ++ ++&pwm_AO_ab { ++ status = "okay"; ++ pinctrl-0 = <&pwm_ao_a_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin0"; ++}; ++ ++&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>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>; ++ clock-names = "clkin0"; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vddio_ao1v8>; ++}; ++ ++&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 = <&vddio_ao1v8>; ++}; ++ ++/* 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 = <35000000>; ++ disable-wp; ++ ++ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_3v3>; ++}; ++ ++/* eMMC */ ++&sd_emmc_c { ++ status = "okay"; ++ pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; ++ pinctrl-1 = <&emmc_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-ddr-1_8v; ++ mmc-hs200-1_8v; ++ max-frequency = <200000000>; ++ non-removable; ++ disable-wp; ++ ++ mmc-pwrseq = <&emmc_pwrseq>; ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&emmc_1v8>; ++}; ++ ++&tdmif_b { ++ status = "okay"; ++}; ++ ++&tdmout_b { ++ status = "okay"; ++}; ++ ++&tohdmitx { ++ status = "okay"; ++}; ++ ++&uart_AO { ++ status = "okay"; ++ pinctrl-0 = <&uart_ao_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&usb { ++ status = "okay"; ++ dr_mode = "otg"; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0123-WIP-dt-bindings-arm-amlogic-add-X96-AIR-bindings.patch b/projects/Amlogic/patches/linux/amlogic-0123-WIP-dt-bindings-arm-amlogic-add-X96-AIR-bindings.patch new file mode 100644 index 0000000000..d465aed014 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0123-WIP-dt-bindings-arm-amlogic-add-X96-AIR-bindings.patch @@ -0,0 +1,35 @@ +From afd970bc383dec7122aad57bb493fe947fe3ee90 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Mon, 18 May 2020 23:23:40 +0000 +Subject: [PATCH 123/156] WIP: dt-bindings: arm: amlogic: add X96-AIR bindings + +Add the board bindings for the Amediatech X96-AIR STB which ships in +two variants distinguished by RAM size which corresponds to internal +(2GB) vs. external (4GB) Ethernet PHY configuration. + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/arm/amlogic.yaml | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml +index 46cb6359f530..d0bb581ee9ee 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -162,9 +162,11 @@ properties: + - description: Boards with the Amlogic Meson SM1 S905X3/D3/Y3 SoC + items: + - enum: +- - seirobotics,sei610 +- - khadas,vim3l ++ - amediatech,x96-air-2g ++ - amediatech,x96-air-4g + - hardkernel,odroid-c4 ++ - khadas,vim3l ++ - seirobotics,sei610 + - const: amlogic,sm1 + + - description: Boards with the Amlogic Meson A1 A113L SoC +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0124-WIP-arm64-dts-meson-add-initial-device-trees-for-X96.patch b/projects/Amlogic/patches/linux/amlogic-0124-WIP-arm64-dts-meson-add-initial-device-trees-for-X96.patch new file mode 100644 index 0000000000..10134d2aa1 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0124-WIP-arm64-dts-meson-add-initial-device-trees-for-X96.patch @@ -0,0 +1,260 @@ +From 21e4c17a8cc4055608aa86dff1f706aa4ea68b49 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 24 Jun 2020 15:04:10 +0000 +Subject: [PATCH 124/156] WIP: arm64: dts: meson: add initial device-trees for + X96-AIR + +Add device-trees for the 2GB/16GB and 4G(32/64GB) variants of the +X96-AIR Android STB device using the Amlogic S905X3 chip. + +X96-AIR uses the Realtek RTL8822CS SDIO WiFi+BT module. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 5 +- + .../boot/dts/amlogic/meson-sm1-x96-air-2g.dts | 95 +++++++++++++++ + .../boot/dts/amlogic/meson-sm1-x96-air-4g.dts | 114 ++++++++++++++++++ + 3 files changed, 213 insertions(+), 1 deletion(-) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-2g.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-4g.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index e03ae9a2be38..6b0355f65c3a 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -43,7 +43,10 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-rbox-pro.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-s912-libretech-pc.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb +-dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-sm1-a95xf3-air.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-2g.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-4g.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-2g.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-2g.dts +new file mode 100644 +index 000000000000..521d0bbc9912 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-2g.dts +@@ -0,0 +1,95 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 BayLibre SAS. All rights reserved. ++ * Copyright (c) 2020 Christian Hewitt ++ */ ++ ++/dts-v1/; ++ ++#include "meson-sm1-ac2xx.dtsi" ++ ++/ { ++ compatible = "amediatech,x96-air-2g", "amlogic,sm1"; ++ model = "Shenzhen Amediatech Technology Co., Ltd X96 Air"; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "SM1-X96-AIR"; ++ 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>; ++ }; ++ }; ++ }; ++}; ++ ++ðmac { ++ status = "okay"; ++ phy-handle = <&internal_ephy>; ++ phy-mode = "rmii"; ++}; ++ ++&uart_A { ++ status = "okay"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "realtek,rtl8822cs-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>; ++ clock-names = "lpo"; ++ vbat-supply = <&vddao_3v3>; ++ vddio-supply = <&vddio_ao1v8>; ++ }; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-4g.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-4g.dts +new file mode 100644 +index 000000000000..057bbceef497 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-4g.dts +@@ -0,0 +1,114 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 BayLibre SAS. All rights reserved. ++ * Copyright (c) 2020 Christian Hewitt ++ */ ++ ++/dts-v1/; ++ ++#include "meson-sm1-ac2xx.dtsi" ++ ++/ { ++ compatible = "amediatech,x96-air-4g", "amlogic,sm1"; ++ model = "Shenzhen Amediatech Technology Co., Ltd X96 Air"; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "SM1-X96-AIR"; ++ 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>; ++ }; ++ }; ++ }; ++}; ++ ++&ext_mdio { ++ external_phy: ethernet-phy@0 { ++ /* Realtek RTL8211F (0x001cc916) */ ++ reg = <0>; ++ max-speed = <100>; ++ 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-id"; ++ phy-handle = <&external_phy>; ++}; ++ ++&uart_A { ++ status = "okay"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "realtek,rtl8822cs-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>; ++ clock-names = "lpo"; ++ vbat-supply = <&vddao_3v3>; ++ vddio-supply = <&vddio_ao1v8>; ++ }; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0125-WIP-dt-bindings-arm-amlogic-add-A95XF3-AIR-bindings.patch b/projects/Amlogic/patches/linux/amlogic-0125-WIP-dt-bindings-arm-amlogic-add-A95XF3-AIR-bindings.patch new file mode 100644 index 0000000000..b3692a2233 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0125-WIP-dt-bindings-arm-amlogic-add-A95XF3-AIR-bindings.patch @@ -0,0 +1,28 @@ +From 07c3c2afa93aec0a2896fa29ec964fbafa849d15 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Mon, 29 Jun 2020 15:54:45 +0000 +Subject: [PATCH 125/156] WIP: dt-bindings: arm: amlogic: add A95XF3-AIR + bindings + +Add the board bindings for the CYX A95XF3-AIR STB device. + +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 d0bb581ee9ee..55605571e182 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -164,6 +164,7 @@ properties: + - enum: + - amediatech,x96-air-2g + - amediatech,x96-air-4g ++ - cyx,a95xf3-air + - hardkernel,odroid-c4 + - khadas,vim3l + - seirobotics,sei610 +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0126-WIP-arm64-dts-meson-sm1-add-support-for-CYX-A95XF3-A.patch b/projects/Amlogic/patches/linux/amlogic-0126-WIP-arm64-dts-meson-sm1-add-support-for-CYX-A95XF3-A.patch new file mode 100644 index 0000000000..61351b5fcc --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0126-WIP-arm64-dts-meson-sm1-add-support-for-CYX-A95XF3-A.patch @@ -0,0 +1,138 @@ +From ebb48ca47911e8c9021853c1af4c4ee707f74779 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Wed, 3 Jun 2020 18:03:22 +0000 +Subject: [PATCH 126/156] WIP: arm64: dts: meson-sm1: add support for CYX + A95XF3-AIR + +A95XF3-AIR is an Android STB based on the Amlogic S905X3 chipset. The +device-tree is loosely based on the SEI610 device. + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-sm1-a95xf3-air.dts | 114 ++++++++++++++++++ + 1 file changed, 114 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts +new file mode 100644 +index 000000000000..e5736b5129fa +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts +@@ -0,0 +1,114 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 BayLibre SAS. All rights reserved. ++ * Copyright (c) 2020 Christian Hewitt ++ */ ++ ++/dts-v1/; ++ ++#include "meson-sm1-ac2xx.dtsi" ++ ++/ { ++ compatible = "cyx,a95xf3-air", "amlogic,sm1"; ++ model = "Shenzhen CYX Industrial Co., Ltd A95XF3-AIR"; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "SM1-A95XF3-AIR"; ++ 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>; ++ }; ++ }; ++ }; ++}; ++ ++&ext_mdio { ++ external_phy: ethernet-phy@0 { ++ /* Realtek RTL8211F (0x001cc916) */ ++ reg = <0>; ++ max-speed = <100>; ++ 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-id"; ++ phy-handle = <&external_phy>; ++}; ++ ++&uart_A { ++ status = "okay"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "mediatek,mt7668u-bluetooth"; ++ 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>; ++ clock-names = "lpo"; ++ vbat-supply = <&vddao_3v3>; ++ vddio-supply = <&vddio_ao1v8>; ++ }; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0127-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch b/projects/Amlogic/patches/linux/amlogic-0127-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch new file mode 100644 index 0000000000..3149382f83 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0127-WIP-dt-bindings-arm-amlogic-add-support-for-the-Beel.patch @@ -0,0 +1,29 @@ +From f0de6c272c4804d00a1979cdc2f4f1b8cb2c9cf2 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 12 Jun 2020 08:04:00 +0000 +Subject: [PATCH 127/156] WIP: dt-bindings: arm: amlogic: add support for the + Beelink GS-King-X + +The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference +board with an S922X-H 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 55605571e182..52440e38436a 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -151,6 +151,7 @@ properties: + - description: Boards with the Amlogic Meson G12B S922X SoC + items: + - enum: ++ - awz,gsking-x + - azw,gtking + - azw,gtking-pro + - hardkernel,odroid-n2 +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0128-WIP-arm64-dts-meson-add-initial-Beelink-GS-King-X-de.patch b/projects/Amlogic/patches/linux/amlogic-0128-WIP-arm64-dts-meson-add-initial-Beelink-GS-King-X-de.patch new file mode 100644 index 0000000000..2e2c0554d1 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0128-WIP-arm64-dts-meson-add-initial-Beelink-GS-King-X-de.patch @@ -0,0 +1,276 @@ +From 5d8a52c19327b52e8c1e705ba7df6e5c2db6505d Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 12 Jun 2020 08:05:20 +0000 +Subject: [PATCH 128/156] WIP: arm64: dts: meson: add initial Beelink GS-King-X + device-tree + +The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference +board with an S922X-H 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 +- 2x ESS9018 audio DACs +- 4x Ricor RT6862 audio amps +- Analogue headphone output +- 1x USB 2.0 OTG port +- 3x USB 3.0 ports +- IR receiver +- 1x micro SD card slot (internal) +- USB SATA contoller with 2x 3.5" drive bays +- 1x Power on/off button + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 1 + + .../boot/dts/amlogic/meson-g12b-gsking-x.dts | 223 ++++++++++++++++++ + 2 files changed, 224 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index 6b0355f65c3a..662cd22f7e8a 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -4,6 +4,7 @@ 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-gsking-x.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 +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts +new file mode 100644 +index 000000000000..ef54b5353c05 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts +@@ -0,0 +1,223 @@ ++// 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-w400.dtsi" ++#include ++#include ++ ++/ { ++ compatible = "azw,gsking-x", "amlogic,g12b"; ++ model = "Beelink GS-King X"; ++ ++ gpio-keys-polled { ++ compatible = "gpio-keys-polled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ poll-interval = <100>; ++ ++ power-button { ++ label = "power"; ++ linux,code = ; ++ gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ blue { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ }; ++ ++ lineout: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "everest,es7134"; ++ VDD-supply = <&vcc_3v3>; ++ PVDD-supply = <&vcc_5v>; ++ status = "okay"; ++ sound-name-prefix = "Lineout"; ++ }; ++ ++ spdif_dit: audio-codec-1 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "G12B-GSKING-X"; ++ audio-aux-devs = <&tdmout_a>, <&tdmout_b>; ++ audio-widgets = "Line", "Lineout"; ++ ++ 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", ++ "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_A Playback", "TDMOUT_A OUT", ++ "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", ++ "Lineout", "Lineout AOUTL", ++ "Lineout", "Lineout AOUTR"; ++ ++ 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_a>; ++ 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_A>; ++ }; ++ }; ++ ++ /* external DACs */ ++ dai-link-4 { ++ sound-dai = <&tdmif_b>; ++ dai-format = "i2s"; ++ dai-tdm-slot-tx-mask-0 = <1 1>; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&lineout>; ++ }; ++ }; ++ ++ /* spdif hdmi or toslink interface */ ++ dai-link-5 { ++ sound-dai = <&spdifout>; ++ ++ codec-0 { ++ sound-dai = <&spdif_dit>; ++ }; ++ ++ codec-1 { ++ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>; ++ }; ++ }; ++ ++ /* spdif hdmi interface */ ++ dai-link-6 { ++ sound-dai = <&spdifout_b>; ++ ++ codec { ++ sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>; ++ }; ++ }; ++ ++ /* hdmi glue */ ++ dai-link-7 { ++ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; ++ ++ codec { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&arb { ++ status = "okay"; ++}; ++ ++&clkc_audio { ++ status = "okay"; ++}; ++ ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ ++&spdifout { ++ pinctrl-0 = <&spdif_out_h_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&spdifout_b { ++ status = "okay"; ++}; ++ ++&tdmif_a { ++ status = "okay"; ++}; ++ ++&tdmif_b { ++ pinctrl-0 = <&tdm_b_sclk_pins>, <&tdm_b_fs_pins>, ++ <&tdm_b_dout0_pins>, <&mclk0_a_pins>; ++ pinctrl-names = "default"; ++ ++ assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD1>, ++ <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD1>, ++ <&clkc_audio AUD_CLKID_TDM_MCLK_PAD0>; ++ assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_B_SCLK>, ++ <&clkc_audio AUD_CLKID_MST_B_LRCLK>, ++ <&clkc_audio AUD_CLKID_MST_B_MCLK>; ++ assigned-clock-rates = <0>, <0>, <0>; ++ ++ status = "okay"; ++}; ++ ++&tdmout_a { ++ status = "okay"; ++}; ++ ++&tdmout_b { ++ status = "okay"; ++}; ++ ++&tohdmitx { ++ status = "okay"; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0129-WIP-arm64-dts-meson-add-multiple-MeCool-device-trees.patch b/projects/Amlogic/patches/linux/amlogic-0129-WIP-arm64-dts-meson-add-multiple-MeCool-device-trees.patch new file mode 100644 index 0000000000..46ecb0a3cd --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0129-WIP-arm64-dts-meson-add-multiple-MeCool-device-trees.patch @@ -0,0 +1,266 @@ +From bac9b51cdc52875bf6e278d4b810269260d5066c Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Mon, 21 Oct 2019 03:58:06 +0000 +Subject: [PATCH 129/156] WIP: arm64: dts: meson: add multiple MeCool device + trees + +This adds initial device trees for a range of MeCool devices based on various +Amlogic GXBB, GXL and GXM reference designs. The current purpose is to allow +devices to be associated with their respective IR remote keymaps. It also +prepares for the addition of DVB support in the future. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/Makefile | 7 ++++ + .../dts/amlogic/meson-gxbb-mecool-ki-plus.dts | 34 +++++++++++++++++++ + .../dts/amlogic/meson-gxbb-mecool-kii-pro.dts | 34 +++++++++++++++++++ + .../meson-gxl-s905d-mecool-ki-plus.dts | 21 ++++++++++++ + .../amlogic/meson-gxl-s905d-mecool-ki-pro.dts | 16 +++++++++ + .../meson-gxl-s905d-mecool-kii-pro.dts | 16 +++++++++ + .../meson-gxl-s905d-mecool-m8s-plus.dts | 16 +++++++++ + .../dts/amlogic/meson-gxm-mecool-kiii-pro.dts | 22 ++++++++++++ + 8 files changed, 166 insertions(+) + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-ki-plus.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-kii-pro.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-plus.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-pro.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-m8s-plus.dts + create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts + +diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile +index 662cd22f7e8a..1a67aebea855 100644 +--- a/arch/arm64/boot/dts/amlogic/Makefile ++++ b/arch/arm64/boot/dts/amlogic/Makefile +@@ -12,6 +12,8 @@ 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-kii-pro.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-mecool-ki-plus.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-mecool-kii-pro.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 +@@ -28,6 +30,10 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-khadas-vim.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-mecool-ki-plus.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-mecool-ki-pro.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-mecool-kii-pro.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-mecool-m8s-plus.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 +@@ -37,6 +43,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-p281.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-tx3-mini.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-libretech-pc.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb ++dtb-$(CONFIG_ARCH_MESON) += meson-gxm-mecool-kiii-pro.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q200.dtb + dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q201.dtb +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-ki-plus.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-ki-plus.dts +new file mode 100644 +index 000000000000..f08e2a7178c5 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-ki-plus.dts +@@ -0,0 +1,34 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxbb-p201.dts" ++ ++/ { ++ compatible = "mecool,gxbb-ki-plus", "amlogic,meson-gxbb"; ++ model = "MeCool KI Plus"; ++ ++ clock: meson_clock { ++ compatible = "amlogic, gxbb-clock"; ++ reg = <0x0 0xc883c000 0x0 0x1000>, ++ <0x0 0xc8100000 0x0 0x1000>; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ sys_max = <1536000000>; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-ki-plus"; ++}; ++ ++&usb_pwr { ++ gpio = <>; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-kii-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-kii-pro.dts +new file mode 100644 +index 000000000000..4f43aff680c3 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-mecool-kii-pro.dts +@@ -0,0 +1,34 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxbb-p201.dts" ++ ++/ { ++ compatible = "mecool,gxbb-kii-pro", "amlogic,meson-gxbb"; ++ model = "MeCool KII Pro"; ++ ++ clock: meson_clock { ++ compatible = "amlogic, gxbb-clock"; ++ reg = <0x0 0xc883c000 0x0 0x1000>, ++ <0x0 0xc8100000 0x0 0x1000>; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ sys_max = <1536000000>; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-kii-pro"; ++}; ++ ++&usb_pwr { ++ gpio = <>; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-plus.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-plus.dts +new file mode 100644 +index 000000000000..c034225b9d9c +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-plus.dts +@@ -0,0 +1,21 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxl-s905d-p231.dts" ++ ++/ { ++ compatible = "mecool,ki-plus", "amlogic,s905d", "amlogic,meson-gxl"; ++ model = "MeCool KI Plus"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0x40000000>; ++ }; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-ki-plus"; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-pro.dts +new file mode 100644 +index 000000000000..606c5dc2efb2 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-ki-pro.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxl-s905d-p230.dts" ++ ++/ { ++ compatible = "mecool,ki-pro", "amlogic,s905d", "amlogic,meson-gxl"; ++ model = "MeCool KI Pro"; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-ki-pro"; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts +new file mode 100644 +index 000000000000..8db4d097f667 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxl-s905d-p231.dts" ++ ++/ { ++ compatible = "mecool,kii-pro", "amlogic,s905d", "amlogic,meson-gxl"; ++ model = "MeCool KII Pro"; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-kii-pro"; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-m8s-plus.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-m8s-plus.dts +new file mode 100644 +index 000000000000..2da13c9f69b6 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-m8s-plus.dts +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxl-s905d-p231.dts" ++ ++/ { ++ compatible = "mecool,kii-pro", "amlogic,s905d", "amlogic,meson-gxl"; ++ model = "MeCool M8S Plus"; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-m8s-plus"; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts +new file mode 100644 +index 000000000000..453779ac1d14 +--- /dev/null ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts +@@ -0,0 +1,22 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/* ++ * Author: Christian Hewitt ++ */ ++ ++#include "meson-gxm-q200.dts" ++ ++/ { ++ compatible = "mecool,gxm-kiii-pro", "amlogic,s912", ++ "amlogic,meson-gxm"; ++ model = "MeCool KIII Pro"; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x0 0x0 0x0 0xC0000000>; ++ }; ++}; ++ ++&ir { ++ linux,rc-map-name = "rc-mecool-kiii-pro"; ++}; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0130-WIP-arm64-dts-meson-add-audio-playback-to-a95x.patch b/projects/Amlogic/patches/linux/amlogic-0130-WIP-arm64-dts-meson-add-audio-playback-to-a95x.patch new file mode 100644 index 0000000000..2682b22693 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0130-WIP-arm64-dts-meson-add-audio-playback-to-a95x.patch @@ -0,0 +1,73 @@ +From f4fa1c5cb11622d5695ab05ee206546d2cac0b62 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 07:11:26 +0000 +Subject: [PATCH 130/156] WIP: arm64: dts: meson: add audio playback to a95x + +Add initial audio support limited to HDMI i2s. + +Signed-off-by: Christian Hewittt +--- + .../dts/amlogic/meson-gxbb-nexbox-a95x.dts | 40 +++++++++++++++++++ + 1 file changed, 40 insertions(+) + +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 67d901ed2fa3..b5b11cb9f393 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +@@ -10,6 +10,7 @@ + #include "meson-gxbb.dtsi" + #include + #include ++#include + + / { + compatible = "nexbox,a95x", "amlogic,meson-gxbb"; +@@ -139,6 +140,45 @@ + }; + }; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-NEXBOX-A95X"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cvbs_vdac_port { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0131-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch b/projects/Amlogic/patches/linux/amlogic-0131-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch new file mode 100644 index 0000000000..2a9d6e1c96 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0131-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch @@ -0,0 +1,86 @@ +From b53bc6d34b76dc6e21dc0b9446eed321a8a7fc9f Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 06:53:49 +0000 +Subject: [PATCH 131/156] WIP: arm64: dts: meson: add audio playback to + khadas-vim2 + +Add initial audio support limited to HDMI i2s. + +Signed-off-by: Christian Hewitt +--- + .../dts/amlogic/meson-gxm-khadas-vim2.dts | 44 +++++++++++++++++-- + 1 file changed, 41 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +index 27eeab71ec77..a884417515b4 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +@@ -7,9 +7,9 @@ + + /dts-v1/; + +-#include +- + #include "meson-gxm.dtsi" ++#include ++#include + + / { + compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm"; +@@ -145,6 +145,45 @@ + clock-frequency = <32768>; + pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXM-KHADAS-VIM2"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + &cec_AO { +@@ -154,7 +193,6 @@ + hdmi-phandle = <&hdmi_tx>; + }; + +- + &cpu_cooling_maps { + map0 { + cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch b/projects/Amlogic/patches/linux/amlogic-0132-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch similarity index 85% rename from packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch rename to projects/Amlogic/patches/linux/amlogic-0132-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch index 008af21a79..3614bea348 100644 --- a/packages/linux/patches/amlogic/amlogic-0144-WIP-arm64-dts-meson-khadas-vim3l-add-audio-playback-.patch +++ b/projects/Amlogic/patches/linux/amlogic-0132-WIP-arm64-dts-meson-add-audio-playback-to-khadas-vim.patch @@ -1,10 +1,10 @@ -From b8e34deeeadc2792e6fcddc26d01d392bed75a2b Mon Sep 17 00:00:00 2001 +From 78859bff8afa1a19e8ce3ed1ab6521bad2be410f 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 +Date: Fri, 15 May 2020 07:47:01 +0000 +Subject: [PATCH 132/156] WIP: arm64: dts: meson: add audio playback to + khadas-vim3l -Add the sound and related audio nodes to the VIM3L device-tree. +Add initial audio support limited to HDMI i2s. Signed-off-by: Christian Hewitt --- @@ -12,7 +12,7 @@ Signed-off-by: Christian Hewitt 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 +index dbbf29a0dbf6..b900a433ef7a 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 @@ @@ -98,7 +98,7 @@ index dbbf29a0dbf6..0ccb268589df 100644 }; +&frddr_a { -+ status = "okay"; ++ status = "okay"; +}; + +&frddr_b { @@ -118,15 +118,15 @@ index dbbf29a0dbf6..0ccb268589df 100644 */ + +&tdmif_b { -+ status = "okay"; ++ status = "okay"; +}; + +&tdmout_b { -+ status = "okay"; ++ status = "okay"; +}; + +&tohdmitx { -+ status = "okay"; ++ status = "okay"; +}; -- 2.17.1 diff --git a/projects/Amlogic/patches/linux/amlogic-0133-WIP-arm64-dts-meson-add-audio-playback-to-nanopi-k2.patch b/projects/Amlogic/patches/linux/amlogic-0133-WIP-arm64-dts-meson-add-audio-playback-to-nanopi-k2.patch new file mode 100644 index 0000000000..0b5cd0a96d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0133-WIP-arm64-dts-meson-add-audio-playback-to-nanopi-k2.patch @@ -0,0 +1,74 @@ +From b071abd1b41d2cc991494f6c90a2dbe56dd60e1a Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 07:14:50 +0000 +Subject: [PATCH 133/156] WIP: arm64: dts: meson: add audio playback to + nanopi-k2 + +Add initial audio support limited to HDMI i2s. + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 +++++++++++++++++++ + 1 file changed, 40 insertions(+) + +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 7be3e354093b..8e5df00b06a2 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +@@ -7,6 +7,7 @@ + + #include "meson-gxbb.dtsi" + #include ++#include + + / { + compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb"; +@@ -130,6 +131,45 @@ + }; + }; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-NANOPI-K2"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ 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-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch b/projects/Amlogic/patches/linux/amlogic-0134-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch similarity index 65% rename from packages/linux/patches/amlogic/amlogic-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch rename to projects/Amlogic/patches/linux/amlogic-0134-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch index 23f8bafac0..08f659243d 100644 --- a/packages/linux/patches/amlogic/amlogic-0063-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch +++ b/projects/Amlogic/patches/linux/amlogic-0134-WIP-arm64-dts-meson-add-audio-playback-to-nexbox-a1.patch @@ -1,38 +1,32 @@ -From 12d1a0d333ed209569376378ea097b11136fd804 Mon Sep 17 00:00:00 2001 +From 0013b81146b4c086526052acb9cee8ba965bab4d 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 +Date: Fri, 15 May 2020 07:23:05 +0000 +Subject: [PATCH 134/156] WIP: arm64: dts: meson: add audio playback to + nexbox-a1 + +Add initial support is limited to HDMI i2s and SPDIF (LPCM). Signed-off-by: Christian Hewitt --- - .../boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 113 ++++++++++++++++++ - 1 file changed, 113 insertions(+) + .../boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 80 +++++++++++++++++++ + 1 file changed, 80 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 +index c2bd4dbbf38c..854212198f4a 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 @@ - +@@ -10,6 +10,7 @@ /dts-v1/; -+#include -+ #include "meson-gxm.dtsi" ++#include / { -@@ -24,11 +26,44 @@ + compatible = "nexbox,a1", "amlogic,s912", "amlogic,meson-gxm"; +@@ -24,11 +25,37 @@ 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"; @@ -67,7 +61,7 @@ index c2bd4dbbf38c..3b0538f75a68 100644 vddio_boot: regulator-vddio-boot { compatible = "regulator-fixed"; regulator-name = "VDDIO_BOOT"; -@@ -75,6 +110,84 @@ +@@ -75,6 +102,59 @@ }; }; }; @@ -75,17 +69,9 @@ index c2bd4dbbf38c..3b0538f75a68 100644 + 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-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -108,10 +94,6 @@ index c2bd4dbbf38c..3b0538f75a68 100644 + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; -+ -+ codec-1 { -+ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; -+ }; + }; + + dai-link-3 { @@ -129,22 +111,9 @@ index c2bd4dbbf38c..3b0538f75a68 100644 + 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>; diff --git a/packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch b/projects/Amlogic/patches/linux/amlogic-0135-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch similarity index 77% rename from packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch rename to projects/Amlogic/patches/linux/amlogic-0135-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch index b4027992d3..b5470b10e8 100644 --- a/packages/linux/patches/amlogic/amlogic-0064-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch +++ b/projects/Amlogic/patches/linux/amlogic-0135-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c2.patch @@ -1,8 +1,10 @@ -From 4afc5a48754695e99624ad8f1635b45f51f89dd3 Mon Sep 17 00:00:00 2001 +From 46943f2ca03704a60a2efffb8923ed40e24a2172 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 +Date: Fri, 15 May 2020 07:27:22 +0000 +Subject: [PATCH 135/156] WIP: arm64: dts: meson: add audio playback to + odroid-c2 + +Add initial audio support limited to HDMI i2s. Signed-off-by: Christian Hewitt --- @@ -10,7 +12,7 @@ Signed-off-by: Christian Hewitt 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 +index 70fcfb7b0683..9d8c919c6e19 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 @@ @@ -29,9 +31,9 @@ index 6ded279c40c8..76841f75a8a8 100644 + sound { + compatible = "amlogic,gx-sound-card"; + model = "GXBB-ODROID-C2"; -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -45,7 +47,7 @@ index 6ded279c40c8..76841f75a8a8 100644 + dai-link-1 { + sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; + dai-format = "i2s"; -+ mclk-fs = <512>; ++ mclk-fs = <256>; + + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; diff --git a/projects/Amlogic/patches/linux/amlogic-0136-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c4.patch b/projects/Amlogic/patches/linux/amlogic-0136-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c4.patch new file mode 100644 index 0000000000..931b660714 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0136-WIP-arm64-dts-meson-add-audio-playback-to-odroid-c4.patch @@ -0,0 +1,136 @@ +From 2ac8b2124860ab7c4a95d30fe87488c8ff9d9188 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 07:42:07 +0000 +Subject: [PATCH 136/156] WIP: arm64: dts: meson: add audio playback to + odroid-c4 + +Add initial audio support limited to HDMI i2s. + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 88 +++++++++++++++++++ + 1 file changed, 88 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +index 00d90b30f8b4..cf5a98f0e47c 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +@@ -8,6 +8,7 @@ + #include "meson-sm1.dtsi" + #include + #include ++#include + + / { + compatible = "hardkernel,odroid-c4", "amlogic,sm1"; +@@ -186,6 +187,69 @@ + }; + }; + }; ++ ++ sound { ++ compatible = "amlogic,axg-sound-card"; ++ model = "SM1-ODROID-C4"; ++ 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 { +@@ -237,6 +301,18 @@ + amlogic,tx-delay-ns = <2>; + }; + ++&frddr_a { ++ status = "okay"; ++}; ++ ++&frddr_b { ++ status = "okay"; ++}; ++ ++&frddr_c { ++ status = "okay"; ++}; ++ + &gpio { + gpio-line-names = + /* GPIOZ */ +@@ -381,6 +457,18 @@ + vqmmc-supply = <&flash_1v8>; + }; + ++&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/projects/Amlogic/patches/linux/amlogic-0137-WIP-arm64-dts-meson-add-audio-playback-to-p201.patch b/projects/Amlogic/patches/linux/amlogic-0137-WIP-arm64-dts-meson-add-audio-playback-to-p201.patch new file mode 100644 index 0000000000..da88e13b2f --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0137-WIP-arm64-dts-meson-add-audio-playback-to-p201.patch @@ -0,0 +1,70 @@ +From 2e982715b779ed2d50347037c64d5733714cfb50 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 07:52:47 +0000 +Subject: [PATCH 137/156] WIP: arm64: dts: meson: add audio playback to p201 + +Add initial audio support limited to HDMI i2s. + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxbb-p201.dts | 40 +++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts +index 150a82f3b2d7..2e2bccbcfd43 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts +@@ -8,10 +8,50 @@ + /dts-v1/; + + #include "meson-gxbb-p20x.dtsi" ++#include + + / { + compatible = "amlogic,p201", "amlogic,meson-gxbb"; + model = "Amlogic Meson GXBB P201 Development Board"; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-P201"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; + }; + + ðmac { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0138-WIP-arm64-dts-meson-add-audio-playback-to-p200.patch b/projects/Amlogic/patches/linux/amlogic-0138-WIP-arm64-dts-meson-add-audio-playback-to-p200.patch new file mode 100644 index 0000000000..d8f83770e3 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0138-WIP-arm64-dts-meson-add-audio-playback-to-p200.patch @@ -0,0 +1,99 @@ +From 4fea728793a5576837bff09660f0dbbfa1460c9b Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 07:56:15 +0000 +Subject: [PATCH 138/156] WIP: arm64: dts: meson: add audio playback to p200 + +Add initial support limited to HDMI i2s and SPDIF (LPCM). + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxbb-p200.dts | 61 +++++++++++++++++++ + 1 file changed, 61 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts +index 3c93d1898b40..a16dac72600d 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts +@@ -9,11 +9,19 @@ + + #include "meson-gxbb-p20x.dtsi" + #include ++#include + + / { + compatible = "amlogic,p200", "amlogic,meson-gxbb"; + model = "Amlogic Meson GXBB P200 Development Board"; + ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + avdd18_usb_adc: regulator-avdd18_usb_adc { + compatible = "regulator-fixed"; + regulator-name = "AVDD18_USB_ADC"; +@@ -57,6 +65,59 @@ + press-threshold-microvolt = <0>; /* 0% */ + }; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-P200"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_y_pins>; ++ pinctrl-names = "default"; + }; + + ðmac { +-- +2.17.1 + diff --git a/packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch b/projects/Amlogic/patches/linux/amlogic-0139-WIP-arm64-dts-meson-add-audio-playback-to-p212-s905x.patch similarity index 50% rename from packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch rename to projects/Amlogic/patches/linux/amlogic-0139-WIP-arm64-dts-meson-add-audio-playback-to-p212-s905x.patch index 7ee7ed5e3e..de465553c0 100644 --- a/packages/linux/patches/amlogic/amlogic-0060-WIP-arm64-dts-meson-add-audio-playback-to-s905x-p212.patch +++ b/projects/Amlogic/patches/linux/amlogic-0139-WIP-arm64-dts-meson-add-audio-playback-to-p212-s905x.patch @@ -1,16 +1,18 @@ -From 17a05478590bd50ba98fbecccdeac66b9c100972 Mon Sep 17 00:00:00 2001 +From 8b2e4f20dbd2360a4052c5399082c40cd8f33e0b 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 +Date: Fri, 15 May 2020 08:02:54 +0000 +Subject: [PATCH 139/156] WIP: arm64: dts: meson: add audio playback to + p212-s905x dtsi + +Add initial audio support limited to HDMI i2s. Signed-off-by: Christian Hewitt --- - .../dts/amlogic/meson-gxl-s905x-p212.dtsi | 70 +++++++++++++++++++ - 1 file changed, 70 insertions(+) + .../dts/amlogic/meson-gxl-s905x-p212.dtsi | 40 +++++++++++++++++++ + 1 file changed, 40 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 +index 6ac678f88bd8..da8c2e5296f6 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 @@ @@ -21,21 +23,7 @@ index 43eb7d149e36..ba74f54c5b3f 100644 / { 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 @@ +@@ -85,6 +86,45 @@ clocks = <&wifi32k>; clock-names = "ext_clock"; }; @@ -43,15 +31,9 @@ index 43eb7d149e36..ba74f54c5b3f 100644 + 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-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -65,15 +47,11 @@ index 43eb7d149e36..ba74f54c5b3f 100644 + dai-link-1 { + sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; + dai-format = "i2s"; -+ mclk-fs = <512>; ++ mclk-fs = <256>; + + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; -+ -+ codec-1 { -+ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>; -+ }; + }; + + dai-link-2 { @@ -83,22 +61,9 @@ index 43eb7d149e36..ba74f54c5b3f 100644 + 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"; }; diff --git a/projects/Amlogic/patches/linux/amlogic-0140-WIP-arm64-dts-meson-add-audio-playback-to-rbox-pro.patch b/projects/Amlogic/patches/linux/amlogic-0140-WIP-arm64-dts-meson-add-audio-playback-to-rbox-pro.patch new file mode 100644 index 0000000000..13d79296a1 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0140-WIP-arm64-dts-meson-add-audio-playback-to-rbox-pro.patch @@ -0,0 +1,128 @@ +From 5a047746565c8a51e32b0ec77403295ccb62ad4b Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 15 May 2020 08:13:00 +0000 +Subject: [PATCH 140/156] WIP: arm64: dts: meson: add audio playback to + rbox-pro + +Add initial support limited to HDMI i2s and SPDIF (LPCM). + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxm-rbox-pro.dts | 80 +++++++++++++++++++ + 1 file changed, 80 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +index c89c9f846fb1..7b23b3da27ff 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +@@ -14,6 +14,7 @@ + /dts-v1/; + + #include "meson-gxm.dtsi" ++#include + + / { + compatible = "kingnovel,r-box-pro", "amlogic,s912", "amlogic,meson-gxm"; +@@ -33,6 +34,13 @@ + reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */ + }; + ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -51,6 +59,25 @@ + }; + }; + ++ 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"; +@@ -90,6 +117,59 @@ + clocks = <&wifi32k>; + clock-names = "ext_clock"; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXM-RBOX-PRO"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ }; ++}; ++ ++&aiu { ++ status = "okay"; ++ pinctrl-0 = <&spdif_out_h_pins>; ++ pinctrl-names = "default"; + }; + + ðmac { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0141-WIP-arm64-dts-meson-add-audio-playback-to-u200.patch b/projects/Amlogic/patches/linux/amlogic-0141-WIP-arm64-dts-meson-add-audio-playback-to-u200.patch new file mode 100644 index 0000000000..7d9d884ff3 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0141-WIP-arm64-dts-meson-add-audio-playback-to-u200.patch @@ -0,0 +1,192 @@ +From 77f7897d27e5f16069ea6d37a4e056b039764382 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sun, 17 May 2020 05:00:55 +0000 +Subject: [PATCH 141/156] WIP: arm64: dts: meson: add audio playback to u200 + +Add initial support limited to HDMI i2s and SPDIF (LPCM). + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-g12a-u200.dts | 131 ++++++++++++++++++ + 1 file changed, 131 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts +index a26bfe72550f..dde7e258a184 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,13 @@ + 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"; + }; +@@ -147,6 +155,91 @@ + 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 { +@@ -163,6 +256,10 @@ + hdmi-phandle = <&hdmi_tx>; + }; + ++&clkc_audio { ++ status = "okay"; ++}; ++ + &cpu0 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; +@@ -203,6 +300,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 +397,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/projects/Amlogic/patches/linux/amlogic-0142-WIP-arm64-dts-meson-add-audio-playback-to-vega-s95-d.patch b/projects/Amlogic/patches/linux/amlogic-0142-WIP-arm64-dts-meson-add-audio-playback-to-vega-s95-d.patch new file mode 100644 index 0000000000..9f58cf7eee --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0142-WIP-arm64-dts-meson-add-audio-playback-to-vega-s95-d.patch @@ -0,0 +1,102 @@ +From e485aa1d6f2033732e79f11618b65c0c8f6b393d Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 16 May 2020 07:04:58 +0000 +Subject: [PATCH 142/156] WIP: arm64: dts: meson: add audio playback to + vega-s95 dtsi + +Add initial support limited to HDMI i2s and SPDIF (LPCM). + +Signed-off-by: Christian Hewitt +--- + .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 61 +++++++++++++++++++ + 1 file changed, 61 insertions(+) + +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 222ee8069cfa..1300585a1ec7 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,7 @@ + */ + + #include "meson-gxbb.dtsi" ++#include + + / { + compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb"; +@@ -17,6 +18,13 @@ + stdout-path = "serial0:115200n8"; + }; + ++ spdif_dit: audio-codec-0 { ++ #sound-dai-cells = <0>; ++ compatible = "linux,spdif-dit"; ++ status = "okay"; ++ sound-name-prefix = "DIT"; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -97,6 +105,59 @@ + clocks = <&wifi32k>; + clock-names = "ext_clock"; + }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "GXBB-VEGA-S95"; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; ++ 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>; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ }; ++}; ++ ++&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-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch b/projects/Amlogic/patches/linux/amlogic-0143-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch similarity index 70% rename from packages/linux/patches/amlogic/amlogic-0066-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch rename to projects/Amlogic/patches/linux/amlogic-0143-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch index 2f54be8c60..3adbc8c743 100644 --- a/packages/linux/patches/amlogic/amlogic-0066-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch +++ b/projects/Amlogic/patches/linux/amlogic-0143-WIP-arm64-dts-meson-add-audio-playback-to-wetek-hub.patch @@ -1,19 +1,21 @@ -From 8c7fee8ff955e4afff1341859ee11c741f2e943a Mon Sep 17 00:00:00 2001 +From 1909c77b7f02cc7ec4a4149b9a83ae2cb738b0d5 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 +Date: Sat, 16 May 2020 07:10:31 +0000 +Subject: [PATCH 143/156] WIP: arm64: dts: meson: add audio playback to + wetek-hub + +Add initial audio support limited to HDMI i2s. Signed-off-by: Christian Hewitt --- - .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 41 +++++++++++++++++++ - 1 file changed, 41 insertions(+) + .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 +++++++++++++++++++ + 1 file changed, 40 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 +index 83b985bb015e..0c1570153842 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 @@ +@@ -7,10 +7,50 @@ /dts-v1/; #include "meson-gxbb-wetek.dtsi" @@ -23,13 +25,12 @@ index 83b985bb015e..5222c4e0fb61 100644 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-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -43,7 +44,7 @@ index 83b985bb015e..5222c4e0fb61 100644 + dai-link-1 { + sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; + dai-format = "i2s"; -+ mclk-fs = <512>; ++ mclk-fs = <256>; + + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; diff --git a/packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch b/projects/Amlogic/patches/linux/amlogic-0144-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch similarity index 69% rename from packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch rename to projects/Amlogic/patches/linux/amlogic-0144-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch index 03e46ea750..a7dcb7a5fa 100644 --- a/packages/linux/patches/amlogic/amlogic-0067-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch +++ b/projects/Amlogic/patches/linux/amlogic-0144-WIP-arm64-dts-meson-add-audio-playback-to-wetek-play.patch @@ -1,19 +1,21 @@ -From 539c1c15ac9f9fe95050ed7f8b8674a930dab927 Mon Sep 17 00:00:00 2001 +From 12cf49055c12a0861a427e91cc147e766f3ae4f8 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 +Date: Sat, 16 May 2020 07:15:54 +0000 +Subject: [PATCH 144/156] WIP: arm64: dts: meson: add audio playback to + wetek-play2 + +Add initial support limited to HDMI i2s and SPDIF (LPCM). Signed-off-by: Christian Hewitt --- - .../dts/amlogic/meson-gxbb-wetek-play2.dts | 57 +++++++++++++++++++ - 1 file changed, 57 insertions(+) + .../dts/amlogic/meson-gxbb-wetek-play2.dts | 61 +++++++++++++++++++ + 1 file changed, 61 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 +index 2ab8a3d10079..f2562c7de67c 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 @@ +@@ -8,11 +8,19 @@ #include "meson-gxbb-wetek.dtsi" #include @@ -21,24 +23,29 @@ index 1d32d1f6d032..6c3925e66a56 100644 / { compatible = "wetek,play2", "amlogic,meson-gxbb"; -@@ -39,6 +40,62 @@ - gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>; - }; - }; -+ + model = "WeTek Play 2"; + + spdif_dit: audio-codec-0 { + #sound-dai-cells = <0>; + compatible = "linux,spdif-dit"; + status = "okay"; + sound-name-prefix = "DIT"; + }; ++ + leds { + led-wifi { + label = "wetek-play:wifi-status"; +@@ -39,6 +47,59 @@ + gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>; + }; + }; + + sound { + compatible = "amlogic,gx-sound-card"; + model = "GXBB-WETEK-PLAY2"; -+ assigned-clocks = <&clkc CLKID_MPLL2>, -+ <&clkc CLKID_MPLL0>, -+ <&clkc CLKID_MPLL1>; ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>, ++ <&clkc CLKID_MPLL2>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, @@ -50,16 +57,20 @@ index 1d32d1f6d032..6c3925e66a56 100644 + }; + + 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 = <512>; ++ mclk-fs = <256>; + + codec-0 { + sound-dai = <&aiu AIU_HDMI CTRL_I2S>; + }; + }; + -+ dai-link-2 { ++ dai-link-3 { + sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>; + + codec-0 { @@ -67,7 +78,7 @@ index 1d32d1f6d032..6c3925e66a56 100644 + }; + }; + -+ dai-link-3 { ++ dai-link-4 { + sound-dai = <&aiu AIU_HDMI CTRL_OUT>; + + codec-0 { diff --git a/projects/Amlogic/patches/linux/amlogic-0145-DEBUG-s-dev_dbg-dev_err-g-drivers-net-phy-realtek.c.patch b/projects/Amlogic/patches/linux/amlogic-0145-DEBUG-s-dev_dbg-dev_err-g-drivers-net-phy-realtek.c.patch new file mode 100644 index 0000000000..62783533b2 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0145-DEBUG-s-dev_dbg-dev_err-g-drivers-net-phy-realtek.c.patch @@ -0,0 +1,44 @@ +From f484fe55c0205fb3cd23eaceb1fd1480ef7cb99a Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Mon, 1 Jun 2020 08:16:58 +0000 +Subject: [PATCH 145/156] DEBUG: s/dev_dbg/dev_err/g drivers/net/phy/realtek.c + +--- + drivers/net/phy/realtek.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 2d99e9de6ee1..9864d31f41b8 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -210,11 +210,11 @@ static int rtl8211f_config_init(struct phy_device *phydev) + dev_err(dev, "Failed to update the TX delay register\n"); + return ret; + } else if (ret) { +- dev_dbg(dev, ++ dev_err(dev, + "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n", + val_txdly ? "Enabling" : "Disabling"); + } else { +- dev_dbg(dev, ++ dev_err(dev, + "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n", + val_txdly ? "enabled" : "disabled"); + } +@@ -225,11 +225,11 @@ static int rtl8211f_config_init(struct phy_device *phydev) + dev_err(dev, "Failed to update the RX delay register\n"); + return ret; + } else if (ret) { +- dev_dbg(dev, ++ dev_err(dev, + "%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n", + val_rxdly ? "Enabling" : "Disabling"); + } else { +- dev_dbg(dev, ++ dev_err(dev, + "2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n", + val_rxdly ? "enabled" : "disabled"); + } +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0146-DEBUG-print-PRG_ETH0-PRG_ETH1-values-at-init.patch b/projects/Amlogic/patches/linux/amlogic-0146-DEBUG-print-PRG_ETH0-PRG_ETH1-values-at-init.patch new file mode 100644 index 0000000000..a6f70ff10d --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0146-DEBUG-print-PRG_ETH0-PRG_ETH1-values-at-init.patch @@ -0,0 +1,26 @@ +From ea8567c29924d05355035e7adecccbb34c64829f Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Tue, 2 Jun 2020 19:20:27 +0000 +Subject: [PATCH 146/156] DEBUG: print PRG_ETH0/PRG_ETH1 values at init + +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +index 5afcf05bbf9c..cf3df1d8dd97 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +@@ -425,6 +425,9 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) + goto err_remove_config_dt; + } + ++ dev_err(&pdev->dev, "PRG_ETH0 value at init = 0x%08x\n", readl(dwmac->regs + PRG_ETH0)); ++ dev_err(&pdev->dev, "PRG_ETH1 value at init = 0x%08x\n", readl(dwmac->regs + 0x04)); ++ + ret = meson8b_init_rgmii_tx_clk(dwmac); + if (ret) + goto err_remove_config_dt; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0147-WIP-arm64-dts-meson-misc-fixups-for-w400-dtsi.patch b/projects/Amlogic/patches/linux/amlogic-0147-WIP-arm64-dts-meson-misc-fixups-for-w400-dtsi.patch new file mode 100644 index 0000000000..b6ae2ca569 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0147-WIP-arm64-dts-meson-misc-fixups-for-w400-dtsi.patch @@ -0,0 +1,70 @@ +From 0f26624455f71f7bf2b25d46f7b3e18ee43662bb Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 18 Jun 2020 08:34:03 +0000 +Subject: [PATCH 147/156] WIP: arm64: dts: meson: misc fixups for w400 dtsi + +Current devices using the W400 dtsi show mmc tuning errors: + +[12483.917391] mmc0: tuning execution failed: -5 +[30535.551221] mmc0: tuning execution failed: -5 +[35359.953671] mmc0: tuning execution failed: -5 +[35561.875332] mmc0: tuning execution failed: -5 +[61733.348709] mmc0: tuning execution failed: -5 + +Removing "sd-uhs-sdr50" from the SDIO node prevents this. We also add +faster speeds to the SD card node, and fix an indentation. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +index 98b70d216a6f..3af3a4db8685 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +@@ -277,7 +277,7 @@ + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; +- phy-mode = "rgmii"; ++ phy-mode = "rgmii-id"; + phy-handle = <&external_phy>; + amlogic,tx-delay-ns = <2>; + }; +@@ -336,9 +336,11 @@ + + bus-width = <4>; + cap-sd-highspeed; +- sd-uhs-sdr50; + max-frequency = <100000000>; + ++ /* WiFi firmware requires power to be kept while in suspend */ ++ keep-power-in-suspend; ++ + non-removable; + disable-wp; + +@@ -379,7 +381,9 @@ + + bus-width = <8>; + cap-mmc-highspeed; +- max-frequency = <100000000>; ++ mmc-ddr-1_8v; ++ mmc-hs200-1_8v; ++ max-frequency = <200000000>; + disable-wp; + + mmc-pwrseq = <&emmc_pwrseq>; +@@ -398,7 +402,7 @@ + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + max-speed = <2000000>; + clocks = <&wifi32k>; +- clock-names = "lpo"; ++ clock-names = "lpo"; + }; + }; + +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0148-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch b/projects/Amlogic/patches/linux/amlogic-0148-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch new file mode 100644 index 0000000000..406cdd7d71 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0148-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch @@ -0,0 +1,50 @@ +From 4d394c132e9429014b06301b4a9de7c419bc55e2 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 19 Jun 2020 10:56:46 +0000 +Subject: [PATCH 148/156] WIP: arm64: dts: meson: add i2c3/rtc nodes and vrtc + alias to W400 dtsi + +The schematics for all devices currently based on the W400 dtsi show +the same haoyu,hym8563 rtc chip, so add the required i2c3/rtc nodes +and an alias to ensure the meson-vrtc timer which probes earlier is +not assigned the /dev/rtc0 device. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +index 3af3a4db8685..a1c0bf3e8f62 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +@@ -16,6 +16,7 @@ + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; ++ rtc1 = &vrtc; + }; + + chosen { +@@ -301,6 +302,18 @@ + pinctrl-names = "default"; + }; + ++&i2c3 { ++ status = "okay"; ++ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; ++ pinctrl-names = "default"; ++ ++ rtc@51 { ++ compatible = "haoyu,hym8563"; ++ reg = <0x51>; ++ #clock-cells = <0>; ++ }; ++}; ++ + &pwm_ab { + pinctrl-0 = <&pwm_a_e_pins>; + pinctrl-names = "default"; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0149-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch b/projects/Amlogic/patches/linux/amlogic-0149-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch new file mode 100644 index 0000000000..d42a6c8074 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0149-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch @@ -0,0 +1,49 @@ +From 58c3872d9946512795d5d260bed3ee9ea5c3b006 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 19 Jun 2020 11:30:55 +0000 +Subject: [PATCH 149/156] WIP: arm64: dts: meson: add i2c3/rtc nodes and vrtc + alias to ODROID-N2 + +Add the i2c3 and rtc nodes to the ODROID-N2 device-tree. Also assign +an alias to the meson-vrtc timer device to prevent it being assigned +to /dev/rtc0 which disto userspace tools assume is a clock device. + +Signed-off-by: Christian Hewitt +--- + .../arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +index 34fffa6d859d..326424231944 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +@@ -19,6 +19,7 @@ + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; ++ rtc1 = &vrtc; + }; + + dioo2133: audio-amplifier-0 { +@@ -484,6 +485,18 @@ + linux,rc-map-name = "rc-odroid"; + }; + ++&i2c3 { ++ status = "okay"; ++ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; ++ pinctrl-names = "default"; ++ ++ rtc@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ #clock-cells = <0>; ++ }; ++}; ++ + &pwm_ab { + pinctrl-0 = <&pwm_a_e_pins>; + pinctrl-names = "default"; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0150-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch b/projects/Amlogic/patches/linux/amlogic-0150-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch new file mode 100644 index 0000000000..dd7ff52b7b --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0150-WIP-arm64-dts-meson-add-i2c3-rtc-nodes-and-vrtc-alia.patch @@ -0,0 +1,44 @@ +From 9f08ae70bc041ef1ff15f57aa6409dd95328430b Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Thu, 2 Jul 2020 11:48:57 +0000 +Subject: [PATCH 150/156] WIP: arm64: dts: meson: add i2c3/rtc nodes and vrtc + alias to ODROID-C4 + +--- + arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +index cf5a98f0e47c..909ea19e48fd 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +@@ -17,6 +17,7 @@ + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; ++ rtc1 = &vrtc; + }; + + chosen { +@@ -405,6 +406,18 @@ + linux,rc-map-name = "rc-odroid"; + }; + ++&i2c3 { ++ status = "okay"; ++ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; ++ pinctrl-names = "default"; ++ ++ rtc@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ #clock-cells = <0>; ++ }; ++}; ++ + &pwm_AO_cd { + pinctrl-0 = <&pwm_ao_d_e_pins>; + pinctrl-names = "default"; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0151-WIP-arm64-dts-meson-enable-rtc-node-on-Khadas-VIM1-V.patch b/projects/Amlogic/patches/linux/amlogic-0151-WIP-arm64-dts-meson-enable-rtc-node-on-Khadas-VIM1-V.patch new file mode 100644 index 0000000000..20a1d4969b --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0151-WIP-arm64-dts-meson-enable-rtc-node-on-Khadas-VIM1-V.patch @@ -0,0 +1,48 @@ +From d578685b42889c1f6685208613602d71c55179a0 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 12 Jun 2020 10:14:36 +0000 +Subject: [PATCH 151/156] WIP: arm64: dts: meson: enable rtc node on Khadas + VIM1/VIM2 boards + +Enable the rtc node on VIM1/VIM2 boards (as with VIM3/VIM3L) so users can +attach a power cell and use it without recompiling the device-tree. If no +cell is attached the kernel reports a harmless error. + +Suggested-by: Nick Xie +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 3 +-- + arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 3 +-- + 2 files changed, 2 insertions(+), 4 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 440bc23c7342..e398e3e65ceb 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 +@@ -97,8 +97,7 @@ + pinctrl-names = "default"; + + rtc: rtc@51 { +- /* has to be enabled manually when a battery is connected: */ +- status = "disabled"; ++ status = "okay"; + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; +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 a884417515b4..ffbe02807b04 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +@@ -266,8 +266,7 @@ + pinctrl-names = "default"; + + rtc: rtc@51 { +- /* has to be enabled manually when a battery is connected: */ +- status = "disabled"; ++ status = "okay"; + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0152-WIP-arm64-dts-meson-fix-spifc-node-on-Khadas-VIM3-VI.patch b/projects/Amlogic/patches/linux/amlogic-0152-WIP-arm64-dts-meson-fix-spifc-node-on-Khadas-VIM3-VI.patch new file mode 100644 index 0000000000..d1ef470c98 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0152-WIP-arm64-dts-meson-fix-spifc-node-on-Khadas-VIM3-VI.patch @@ -0,0 +1,31 @@ +From 0de0b041dfdc9e5bda39380cd81f8b95fa89abd3 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 12 Jun 2020 11:09:43 +0000 +Subject: [PATCH 152/156] WIP: arm64: dts: meson: fix spifc node on Khadas + VIM3/VIM3L + +The VIM3/VIM3L Boards use w25q128 not w25q32. + +Fixes: 0e1610e726d3 ("arm64: dts: khadas-vim3: add SPIFC controller node") +Suggested-by: Art Nikpal +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 27408c10a811..6b75157265e1 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -360,7 +360,7 @@ + pinctrl-0 = <&nor_pins>; + pinctrl-names = "default"; + +- w25q32: spi-flash@0 { ++ w25q128: spi-flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128fw", "jedec,spi-nor"; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0153-WIP-arm64-dts-meson-fix-mmc0-tuning-error-on-Khadas-.patch b/projects/Amlogic/patches/linux/amlogic-0153-WIP-arm64-dts-meson-fix-mmc0-tuning-error-on-Khadas-.patch new file mode 100644 index 0000000000..bca3c78cc3 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0153-WIP-arm64-dts-meson-fix-mmc0-tuning-error-on-Khadas-.patch @@ -0,0 +1,54 @@ +From b18ca293bbf9615b0d263284120a9906f747b6c1 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 13 Jun 2020 05:05:36 +0000 +Subject: [PATCH 153/156] WIP: arm64: dts: meson: fix mmc0 tuning error on + Khadas VIM3 + +I see reports of mmc0 tuning errors on VIM3 after a few hours uptime: + +[12483.917391] mmc0: tuning execution failed: -5 +[30535.551221] mmc0: tuning execution failed: -5 +[35359.953671] mmc0: tuning execution failed: -5 +[35561.875332] mmc0: tuning execution failed: -5 +[61733.348709] mmc0: tuning execution failed: -5 + +I do not see the same on VIM3L, so remove sd-uhs-sdr50 from the common dtsi +to silence the error, then (re)add it to the VIM3L dts. + +Suggested-by: Art Nikpal +Signed-off-by: Chrisitan Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 1 - + arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts | 4 ++++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 6b75157265e1..94f75b446504 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -293,7 +293,6 @@ + + bus-width = <4>; + cap-sd-highspeed; +- sd-uhs-sdr50; + max-frequency = <100000000>; + + non-removable; +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 b900a433ef7a..61e4dbf08d78 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts +@@ -164,6 +164,10 @@ + status = "okay"; + }; + ++&sd_emmc_a { ++ sd-uhs-sdr50; ++}; ++ + &usb { + phys = <&usb2_phy0>, <&usb2_phy1>; + phy-names = "usb2-phy0", "usb2-phy1"; +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0154-WIP-arm64-dts-meson-switch-VIM3-VIM3L-to-rgmii-id.patch b/projects/Amlogic/patches/linux/amlogic-0154-WIP-arm64-dts-meson-switch-VIM3-VIM3L-to-rgmii-id.patch new file mode 100644 index 0000000000..55f9030d00 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0154-WIP-arm64-dts-meson-switch-VIM3-VIM3L-to-rgmii-id.patch @@ -0,0 +1,28 @@ +From 0ea432e72c1cc590976549860cecd5f4add332d5 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 13 Jun 2020 05:34:20 +0000 +Subject: [PATCH 154/156] WIP: arm64: dts: meson: switch VIM3/VIM3L to rgmii-id + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 94f75b446504..b65beccd4e66 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -216,9 +216,8 @@ + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; +- phy-mode = "rgmii"; ++ phy-mode = "rgmii-id"; + phy-handle = <&external_phy>; +- amlogic,tx-delay-ns = <2>; + }; + + &hdmi_tx { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0155-WIP-arm64-dts-meson-switch-ODROID-N2-to-rgmii-id.patch b/projects/Amlogic/patches/linux/amlogic-0155-WIP-arm64-dts-meson-switch-ODROID-N2-to-rgmii-id.patch new file mode 100644 index 0000000000..8d7f74c473 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0155-WIP-arm64-dts-meson-switch-ODROID-N2-to-rgmii-id.patch @@ -0,0 +1,27 @@ +From bd5a684056d6f58cdf709a6d04b8de7dd65b0a82 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Wed, 24 Jun 2020 10:33:59 +0000 +Subject: [PATCH 155/156] WIP: arm64: dts: meson: switch ODROID-N2 to rgmii-id + +--- + arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +index 326424231944..dbadb585d1f6 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +@@ -433,9 +433,8 @@ + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; +- phy-mode = "rgmii"; ++ phy-mode = "rgmii-id"; + phy-handle = <&external_phy>; +- amlogic,tx-delay-ns = <2>; + }; + + &frddr_a { +-- +2.17.1 + diff --git a/projects/Amlogic/patches/linux/amlogic-0156-WIP-arm64-dts-meson-switch-ODROID-C4-to-rgmii-id.patch b/projects/Amlogic/patches/linux/amlogic-0156-WIP-arm64-dts-meson-switch-ODROID-C4-to-rgmii-id.patch new file mode 100644 index 0000000000..d7b8ade233 --- /dev/null +++ b/projects/Amlogic/patches/linux/amlogic-0156-WIP-arm64-dts-meson-switch-ODROID-C4-to-rgmii-id.patch @@ -0,0 +1,27 @@ +From 6fde1ebcfb3d5a1f2f859443ec039468198e5447 Mon Sep 17 00:00:00 2001 +From: chewitt +Date: Wed, 24 Jun 2020 11:21:22 +0000 +Subject: [PATCH 156/156] WIP: arm64: dts: meson: switch ODROID-C4 to rgmii-id + +--- + arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +index 909ea19e48fd..e652203a4a8d 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +@@ -297,9 +297,8 @@ + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; +- phy-mode = "rgmii"; ++ phy-mode = "rgmii-id"; + phy-handle = <&external_phy>; +- amlogic,tx-delay-ns = <2>; + }; + + &frddr_a { +-- +2.17.1 +