diff options
author | yjun | 2023-08-29 22:05:36 +0800 |
---|---|---|
committer | yjun | 2023-08-29 22:05:36 +0800 |
commit | 9707e58d46ede9291863ccb24ac4bd941ef4bc6b (patch) | |
tree | 5c23ae180b756ea5df418173a5acf6319fb72cfa | |
parent | 93e2c5ae5cca5b66aeb23c0947bc07936579c0d1 (diff) | |
download | aur-9707e58d46ede9291863ccb24ac4bd941ef4bc6b.tar.gz |
fix hdmi sound kernel error
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | ASOC-sun9i-hdmi-audio-Initial-implementation.patch | 235 | ||||
-rw-r--r-- | PKGBUILD | 11 | ||||
-rw-r--r-- | arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch | 17 | ||||
-rw-r--r-- | config | 3 | ||||
-rw-r--r-- | sun50i-h6-tqc-a01.dts | 2 |
6 files changed, 257 insertions, 21 deletions
@@ -1,6 +1,6 @@ pkgbase = linux-tqc-a01 pkgver = 6.4.12 - pkgrel = 1 + pkgrel = 2 url = http://www.kernel.org/ arch = aarch64 license = GPL2 @@ -28,6 +28,7 @@ pkgbase = linux-tqc-a01 source = net-stmmac-sun8i-Rename-PHY-regulator-variable-to-regulator_phy.patch source = net-stmmac-sun8i-Use-devm_regulator_get-for-PHY-regulator.patch source = arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch + source = ASOC-sun9i-hdmi-audio-Initial-implementation.patch source = 0009-allwinner-h6-support-ac200-audio-codec.patch source = 0010-allwinner-add-sunxi_get_soc_chipid-and-sunxi_get_ser.patch source = arm64-dts-sun50i-h6.dtsi-improve-thermals.patch @@ -40,7 +41,7 @@ pkgbase = linux-tqc-a01 source = 90-linux.hook source = https://mirror.bjtu.edu.cn/kernel/linux/kernel/v6.x/patch-6.4.12.xz md5sums = bb65b2232cf596e7044c56a7c4205f51 - md5sums = d8b83f286380f920cef80c637a7af091 + md5sums = 5f100d68519ca0847b3d2b68af673693 md5sums = 7a18066683f3351b2bbd2653db783f80 md5sums = 74baf0cb243b3abd5e38f0131c95408f md5sums = 947f64e1c0eec0564cb683940a5af51f @@ -52,14 +53,15 @@ pkgbase = linux-tqc-a01 md5sums = f585248da27f4a1a2ae00fcef89ad92e md5sums = ab514581687e4bb1f107a3692bba4bf3 md5sums = b45a181d414c98d99fe3231dc56ee38d - md5sums = 4c79495bf2f66cc506d780e7a62fd927 + md5sums = f8aa3197a5c1e6d01cb1809c31cc2d92 + md5sums = 151b9f379579573f3b0761421da303aa md5sums = eda5ceb6d7f63318bba5ec63c601ae93 md5sums = a709f3089148690f41c739275e66e9b0 md5sums = 99368425ced226332796b7f69fda3a2b md5sums = 6ab19f7244b9f82f56edabeb7e1e1004 md5sums = a95bab65e3009909138c0982ab7234aa md5sums = 113ec102b9b94a8c8c44dbde7e9b8d59 - md5sums = 9681a8a5d7255d2e69a804ffcafa4dd6 + md5sums = bd2306453a718711540bdb6ac4e8fd86 md5sums = 66e0ae63183426b28c0ec0c7e10b5e16 md5sums = ce6c81ad1ad1f8b333fd6077d47abdaf md5sums = 3dc88030a8f2f5a5f97266d99b149f77 diff --git a/ASOC-sun9i-hdmi-audio-Initial-implementation.patch b/ASOC-sun9i-hdmi-audio-Initial-implementation.patch new file mode 100644 index 000000000000..82790b81179f --- /dev/null +++ b/ASOC-sun9i-hdmi-audio-Initial-implementation.patch @@ -0,0 +1,235 @@ +From af95c64c05a49aee08c7bb6084cf27feaf72ce45 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec <jernej.skrabec@gmail.com> +Date: Tue, 10 Nov 2020 20:42:44 +0100 +Subject: [PATCH 230/389] ASOC: sun9i-hdmi-audio: Initial implementation + +This implements HDMI audio sound card which is used to enable HDMI audio +on all Allwinner SoCs with DW-HDMI core. First such SoC is A80, but it's +been used on plenty of others, like A64, A83t, H2+, H3, H5, H6, R40 and +V40. + +Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> +--- + sound/soc/sunxi/Kconfig | 8 ++ + sound/soc/sunxi/Makefile | 1 + + sound/soc/sunxi/sun9i-hdmi-audio.c | 180 +++++++++++++++++++++++++++++ + 3 files changed, 189 insertions(+) + create mode 100644 sound/soc/sunxi/sun9i-hdmi-audio.c + +diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig +index 1f18f016acbb..6a17e49535bd 100644 +--- a/sound/soc/sunxi/Kconfig ++++ b/sound/soc/sunxi/Kconfig +@@ -63,6 +63,14 @@ config SND_SUN50I_DMIC + Say Y or M to add support for the DMIC audio block in the Allwinner + H6 and affiliated SoCs. + ++config SND_SUN9I_HDMI_AUDIO ++ tristate "Allwinner sun9i HDMI Audio Sound Card" ++ depends on OF ++ depends on SND_SUN4I_I2S ++ help ++ Say Y or M to add support for the HDMI Audio sound card for Allwinner ++ SoCs with DW-HDMI core. ++ + config SND_SUN8I_ADDA_PR_REGMAP + tristate + select REGMAP +diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile +index 4483fe9c94ef..f9b7daf063fe 100644 +--- a/sound/soc/sunxi/Makefile ++++ b/sound/soc/sunxi/Makefile +@@ -7,3 +7,4 @@ obj-$(CONFIG_SND_SUN50I_CODEC_ANALOG) += sun50i-codec-analog.o + obj-$(CONFIG_SND_SUN8I_CODEC) += sun8i-codec.o + obj-$(CONFIG_SND_SUN8I_ADDA_PR_REGMAP) += sun8i-adda-pr-regmap.o + obj-$(CONFIG_SND_SUN50I_DMIC) += sun50i-dmic.o ++obj-$(CONFIG_SND_SUN9I_HDMI_AUDIO) += sun9i-hdmi-audio.o +diff --git a/sound/soc/sunxi/sun9i-hdmi-audio.c b/sound/soc/sunxi/sun9i-hdmi-audio.c +new file mode 100644 +index 000000000000..fc8f03d398c0 +--- /dev/null ++++ b/sound/soc/sunxi/sun9i-hdmi-audio.c +@@ -0,0 +1,180 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// sun9i hdmi audio sound card ++// ++// Copyright (C) 2021 Jernej Skrabec <jernej.skrabec@gmail.com> ++ ++#include <linux/module.h> ++#include <linux/of_platform.h> ++ ++#include <sound/soc.h> ++#include <sound/soc-dai.h> ++ ++static int sun9i_hdmi_audio_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ unsigned int mclk; ++ ++ mclk = params_rate(params) * 128; ++ ++ return snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, 0), 0, mclk, ++ SND_SOC_CLOCK_OUT); ++} ++ ++static const struct snd_soc_ops sun9i_hdmi_audio_ops = { ++ .hw_params = sun9i_hdmi_audio_hw_params, ++}; ++ ++static int sun9i_hdmi_audio_dai_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ int ret; ++ ++ /* TODO: switch to custom api once it's implemented in sun4i-i2s */ ++ ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0, 0, 2, 32); ++ if (ret) { ++ dev_err(asoc_rtd_to_cpu(rtd, 0)->dev, ++ "setting tdm link slots failed\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int sun9i_hdmi_audio_parse_dai(struct device_node *node, ++ struct snd_soc_dai_link_component *dlc) ++{ ++ struct of_phandle_args args; ++ int ret; ++ ++ if (!node) ++ return 0; ++ ++ ret = of_parse_phandle_with_args(node, "sound-dai", ++ "#sound-dai-cells", 0, &args); ++ if (ret) ++ return ret; ++ ++ ret = snd_soc_get_dai_name(&args, &dlc->dai_name); ++ if (ret < 0) { ++ of_node_put(args.np); ++ ++ return ret; ++ } ++ ++ dlc->of_node = args.np; ++ ++ return 0; ++} ++ ++static int sun9i_hdmi_audio_probe(struct platform_device *pdev) ++{ ++ struct snd_soc_dai_link_component *dlc; ++ struct device *dev = &pdev->dev; ++ struct snd_soc_dai_link *link; ++ struct snd_soc_card *card; ++ struct device_node *child; ++ int ret; ++ ++ card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); ++ if (!card) ++ return -ENOMEM; ++ ++ link = devm_kzalloc(dev, sizeof(*link), GFP_KERNEL); ++ if (!link) ++ return -ENOMEM; ++ ++ dlc = devm_kzalloc(dev, sizeof(*dlc) * 3, GFP_KERNEL); ++ if (!dlc) ++ return -ENOMEM; ++ ++ child = of_get_child_by_name(dev->of_node, "codec"); ++ if (!child) ++ return -ENODEV; ++ ++ ret = sun9i_hdmi_audio_parse_dai(child, &dlc[1]); ++ of_node_put(child); ++ if (ret) ++ return ret; ++ ++ child = of_get_child_by_name(dev->of_node, "cpu"); ++ if (!child) { ++ ret = -ENODEV; ++ goto out_err; ++ } ++ ++ ret = sun9i_hdmi_audio_parse_dai(child, &dlc[0]); ++ of_node_put(child); ++ if (ret) ++ goto out_err; ++ ++ dlc[2].of_node = dlc[0].of_node; ++ ++ platform_set_drvdata(pdev, card); ++ ++ link->cpus = &dlc[0]; ++ link->codecs = &dlc[1]; ++ link->platforms = &dlc[2]; ++ ++ link->num_cpus = 1; ++ link->num_codecs = 1; ++ link->num_platforms = 1; ++ ++ link->playback_only = 1; ++ ++ link->name = "SUN9I-HDMI"; ++ link->stream_name = "SUN9I-HDMI PCM"; ++ ++ link->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_CBS_CFS; ++ ++ link->ops = &sun9i_hdmi_audio_ops; ++ link->init = sun9i_hdmi_audio_dai_init; ++ ++ card->dai_link = link; ++ card->num_links = 1; ++ card->owner = THIS_MODULE; ++ card->dev = dev; ++ card->name = "sun9i-hdmi"; ++ ++ ret = devm_snd_soc_register_card(dev, card); ++ if (ret) ++ goto out_err; ++ ++ return 0; ++ ++out_err: ++ of_node_put(dlc[0].of_node); ++ of_node_put(dlc[1].of_node); ++ ++ return ret; ++} ++ ++static int sun9i_hdmi_audio_remove(struct platform_device *pdev) ++{ ++ struct snd_soc_card *card = platform_get_drvdata(pdev); ++ ++ of_node_put(card->dai_link->cpus->of_node); ++ of_node_put(card->dai_link->codecs->of_node); ++ ++ return 0; ++} ++ ++static const struct of_device_id sun9i_hdmi_audio_match[] = { ++ { .compatible = "allwinner,sun9i-a80-hdmi-audio" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, sun9i_hdmi_audio_match); ++ ++static struct platform_driver sun9i_hdmi_audio_driver = { ++ .probe = sun9i_hdmi_audio_probe, ++ .remove = sun9i_hdmi_audio_remove, ++ .driver = { ++ .name = "sun9i-hdmi-audio", ++ .of_match_table = sun9i_hdmi_audio_match, ++ }, ++}; ++module_platform_driver(sun9i_hdmi_audio_driver); ++ ++MODULE_DESCRIPTION("sun9i HDMI Audio Sound Card"); ++MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@gmail.com>"); ++MODULE_LICENSE("GPL v2"); +-- +2.35.3 + @@ -10,7 +10,7 @@ _srcname=linux-6.4 _kernelname=${pkgbase#linux} _desc="AArch64 kernel for TQC A01" pkgver=6.4.12 -pkgrel=1 +pkgrel=2 arch=('aarch64') url="http://www.kernel.org/" license=('GPL2') @@ -36,6 +36,7 @@ source=( 'net-stmmac-sun8i-Use-devm_regulator_get-for-PHY-regulator.patch' # hdmi sound 'arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch' + 'ASOC-sun9i-hdmi-audio-Initial-implementation.patch' # audio codec '0009-allwinner-h6-support-ac200-audio-codec.patch' # misc @@ -64,7 +65,7 @@ source=( source+=("https://mirror.bjtu.edu.cn/kernel/linux/kernel/v6.x/patch-${pkgver}.xz") md5sums=('bb65b2232cf596e7044c56a7c4205f51' - 'd8b83f286380f920cef80c637a7af091' + '5f100d68519ca0847b3d2b68af673693' '7a18066683f3351b2bbd2653db783f80' '74baf0cb243b3abd5e38f0131c95408f' '947f64e1c0eec0564cb683940a5af51f' @@ -76,14 +77,15 @@ md5sums=('bb65b2232cf596e7044c56a7c4205f51' 'f585248da27f4a1a2ae00fcef89ad92e' 'ab514581687e4bb1f107a3692bba4bf3' 'b45a181d414c98d99fe3231dc56ee38d' - '4c79495bf2f66cc506d780e7a62fd927' + 'f8aa3197a5c1e6d01cb1809c31cc2d92' + '151b9f379579573f3b0761421da303aa' 'eda5ceb6d7f63318bba5ec63c601ae93' 'a709f3089148690f41c739275e66e9b0' '99368425ced226332796b7f69fda3a2b' '6ab19f7244b9f82f56edabeb7e1e1004' 'a95bab65e3009909138c0982ab7234aa' '113ec102b9b94a8c8c44dbde7e9b8d59' - '9681a8a5d7255d2e69a804ffcafa4dd6' + 'bd2306453a718711540bdb6ac4e8fd86' '66e0ae63183426b28c0ec0c7e10b5e16' 'ce6c81ad1ad1f8b333fd6077d47abdaf' '3dc88030a8f2f5a5f97266d99b149f77' @@ -120,6 +122,7 @@ prepare() { patch -p1 < ../net-stmmac-sun8i-Add-support-for-enabling-a-regulator-for-PHY-I.patch patch -p1 < ../arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch + patch -p1 < ../ASOC-sun9i-hdmi-audio-Initial-implementation.patch patch -p1 < ../0009-allwinner-h6-support-ac200-audio-codec.patch diff --git a/arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch b/arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch index 26899f5b7fc9..603522ba0505 100644 --- a/arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch +++ b/arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch @@ -14,26 +14,21 @@ diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/ index fbe94abbb1f9..60d7ee645c31 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi -@@ -101,6 +101,25 @@ scpi_protocol: scpi { +@@ -101,6 +101,20 @@ scpi_protocol: scpi { shmem = <&scpi_sram>; }; -+ hdmi_sound: hdmi-sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,format = "i2s"; -+ simple-audio-card,name = "sun50i-h6-hdmi"; -+ simple-audio-card,mclk-fs = <128>; -+ simple-audio-card,frame-inversion; ++ sound_hdmi: sound_hdmi { ++ compatible = "allwinner,sun9i-a80-hdmi-audio", ++ "allwinner,sun50i-h6-hdmi-audio"; + status = "disabled"; + -+ simple-audio-card,codec { ++ codec { + sound-dai = <&hdmi>; + }; + -+ simple-audio-card,cpu { ++ cpu { + sound-dai = <&i2s1>; -+ dai-tdm-slot-num = <2>; -+ dai-tdm-slot-width = <32>; + }; + }; + @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 6.4.11 Kernel Configuration +# Linux/arm64 6.4.12 Kernel Configuration # CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.1.0" CONFIG_CC_IS_GCC=y @@ -6501,6 +6501,7 @@ CONFIG_SND_SUN50I_CODEC_ANALOG=m CONFIG_SND_SUN4I_I2S=m CONFIG_SND_SUN4I_SPDIF=m # CONFIG_SND_SUN50I_DMIC is not set +CONFIG_SND_SUN9I_HDMI_AUDIO=m CONFIG_SND_SUN8I_ADDA_PR_REGMAP=m # end of Allwinner SoC Audio support diff --git a/sun50i-h6-tqc-a01.dts b/sun50i-h6-tqc-a01.dts index 17d59c787f80..17f0ccc2a0ac 100644 --- a/sun50i-h6-tqc-a01.dts +++ b/sun50i-h6-tqc-a01.dts @@ -348,7 +348,7 @@ clocks = <&ext_osc32k>; }; -&hdmi_sound { +&sound_hdmi { status = "okay"; }; |