0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-22 04:56:15 +00:00
openwrt/target/linux/bcm27xx/patches-6.6/950-0915-ASOc-Add-HiFiBerry-DAC8X-to-the-simple-card-driver.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

83 lines
3.0 KiB
Diff

From 797e559bc4f5b66c9b2e324a8a612a9fd6805aa1 Mon Sep 17 00:00:00 2001
From: j-schambacher <joerg@hifiberry.com>
Date: Wed, 28 Feb 2024 11:25:14 +0100
Subject: [PATCH 0915/1085] ASOc: Add HiFiBerry DAC8X to the simple card driver
Defines the settings for the 8 channel version of the standard
DAC by overwriting the number of channels in the DAI defs.
It can run in 8ch mode only on PI5 using the 4 lane data output
of the designware I2S0 module.
Signed-off-by: j-schambacher <joerg@hifiberry.com>
---
sound/soc/bcm/Kconfig | 5 +++--
sound/soc/bcm/rpi-simple-soundcard.c | 33 ++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
--- a/sound/soc/bcm/Kconfig
+++ b/sound/soc/bcm/Kconfig
@@ -40,11 +40,12 @@ config SND_BCM2708_SOC_GOOGLEVOICEHAT_SO
Say Y or M if you want to add support for voiceHAT soundcard.
config SND_BCM2708_SOC_HIFIBERRY_DAC
- tristate "Support for HifiBerry DAC"
+ tristate "Support for HifiBerry DAC and DAC8X"
select SND_SOC_PCM5102A
select SND_RPI_SIMPLE_SOUNDCARD
help
- Say Y or M if you want to add support for HifiBerry DAC.
+ Say Y or M if you want to add support for HifiBerry DAC and DAC8X.
+ Note: DAC8X only works on PI5
config SND_BCM2708_SOC_HIFIBERRY_DACPLUS
tristate "Support for HifiBerry DAC+"
--- a/sound/soc/bcm/rpi-simple-soundcard.c
+++ b/sound/soc/bcm/rpi-simple-soundcard.c
@@ -316,6 +316,37 @@ static struct snd_rpi_simple_drvdata drv
.dai = snd_hifiberry_dac_dai,
};
+static int hifiberry_dac8x_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+
+ /* override the defaults to reflect 4 x PCM5102A on the card
+ * and limit the sample rate to 192ksps
+ */
+ codec_dai->driver->playback.channels_max = 8;
+ codec_dai->driver->playback.rates = SNDRV_PCM_RATE_8000_192000;
+
+ return 0;
+}
+
+static struct snd_soc_dai_link snd_hifiberry_dac8x_dai[] = {
+ {
+ .name = "HifiBerry DAC8x",
+ .stream_name = "HifiBerry DAC8x HiFi",
+ .dai_fmt = SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBS_CFS,
+ .init = hifiberry_dac8x_init,
+ SND_SOC_DAILINK_REG(hifiberry_dac),
+ },
+};
+
+static struct snd_rpi_simple_drvdata drvdata_hifiberry_dac8x = {
+ .card_name = "snd_rpi_hifiberry_dac8x",
+ .dai = snd_hifiberry_dac8x_dai,
+ .fixed_bclk_ratio = 64,
+};
+
SND_SOC_DAILINK_DEFS(dionaudio_kiwi,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_CODEC("pcm1794a-codec", "pcm1794a-hifi")),
@@ -417,6 +448,8 @@ static const struct of_device_id snd_rpi
.data = (void *) &drvdata_hifiberry_amp3 },
{ .compatible = "hifiberry,hifiberry-dac",
.data = (void *) &drvdata_hifiberry_dac },
+ { .compatible = "hifiberry,hifiberry-dac8x",
+ .data = (void *) &drvdata_hifiberry_dac8x },
{ .compatible = "dionaudio,dionaudio-kiwi",
.data = (void *) &drvdata_dionaudio_kiwi },
{ .compatible = "rpi,rpi-dac", &drvdata_rpi_dac},