diff --git a/pkgs/linux-packages/rt5640/package.nix b/pkgs/linux-packages/rt5640/package.nix index f3ddd47af..e46215e9e 100644 --- a/pkgs/linux-packages/rt5640/package.nix +++ b/pkgs/linux-packages/rt5640/package.nix @@ -1,6 +1,8 @@ # C code is taken from megi's kernel tree. # this is a patched version of mainline driver. -# notably, it resolves some errors like "rt5640 1-001c: ASoC: error at snd_soc_dai_set_sysclk on rt5640-aif1: -22". +# notably, it resolves some errors like: +# - "rt5640 1-001c: ASoC: error at snd_soc_dai_set_sysclk on rt5640-aif1: -22" (older linux, i think pre 6.13?) +# - "rt5640: 1-001c: ASoC error (-22): at snd_soc_dai_set_sysclk() on rt5640-aif1" (linux 6.15.6+) # # the driver source lives at sound/soc/codecs/rt5640.c; it's renamed to sound-soc-rt5640 during build { @@ -21,7 +23,8 @@ stdenv.mkDerivation { makeFlags = [ # "KERNELRELEASE=${kernel.modDirVersion}" - "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + # "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "KERNEL_DIR=$(buildRoot)" "INSTALL_MOD_PATH=$(out)/lib/modules/${kernel.modDirVersion}/kernel" # from "O=$(buildRoot)" @@ -33,6 +36,14 @@ stdenv.mkDerivation { "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; + preConfigure = '' + # starting with linux 6.13.0 it wants to write to `KERNEL_DIR`, so we copy that here to make it writable + cp -R ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build . + export buildRoot=$(pwd)/build + + chmod u+w -R build + ''; + # the modules shipped in-tree are .xz, so if i want to replace those i need to also xz this module: postInstall = '' find $out -name '*.ko' -exec xz {} \; diff --git a/pkgs/linux-packages/rt5640/snd-soc-rt5640.c b/pkgs/linux-packages/rt5640/snd-soc-rt5640.c index b4fa38cce..d46123818 100644 --- a/pkgs/linux-packages/rt5640/snd-soc-rt5640.c +++ b/pkgs/linux-packages/rt5640/snd-soc-rt5640.c @@ -1804,10 +1804,10 @@ static int rt5640_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) int dai_sel; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { - case SND_SOC_DAIFMT_CBM_CFM: + case SND_SOC_DAIFMT_CBP_CFP: rt5640->master[dai->id] = 1; break; - case SND_SOC_DAIFMT_CBS_CFS: + case SND_SOC_DAIFMT_CBC_CFC: reg_val |= RT5640_I2S_MS_S; rt5640->master[dai->id] = 0; break; @@ -2999,19 +2999,19 @@ MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id); static const struct of_device_id rt5640_of_match[] = { { .compatible = "realtek,rt5639", }, { .compatible = "realtek,rt5640", }, - {}, + { } }; MODULE_DEVICE_TABLE(of, rt5640_of_match); #endif #ifdef CONFIG_ACPI static const struct acpi_device_id rt5640_acpi_match[] = { - { "INT33CA", 0 }, - { "10EC3276", 0 }, - { "10EC5640", 0 }, - { "10EC5642", 0 }, - { "INTCCFFD", 0 }, - { }, + { "10EC3276" }, + { "10EC5640" }, + { "10EC5642" }, + { "INT33CA" }, + { "INTCCFFD" }, + { } }; MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match); #endif