openwrt/target/linux/bcm27xx/patches-6.6/950-1264-ASoC-add-HiFiBerry-ADC8x-8-channel-ADC-to-simple-car.patch

89 lines
3.1 KiB
Diff
Raw Normal View History

From 4d2eaa194d77588fa42567ba174c3c14c5798027 Mon Sep 17 00:00:00 2001
From: j-schambacher <joerg@hifiberry.com>
Date: Thu, 12 Sep 2024 17:42:13 +0200
Subject: [PATCH 1264/1350] ASoC: add HiFiBerry ADC8x 8-channel ADC to
simple-card-driver
Definitions for the 8 channel ADC card. The card uses only
HW-controlled devices which allows the uses of the 'dummy-dai'.
It will run only on a PI5 as it requires the designware I2S0 module.
The necessary output lanes I2S0_DI[0..3] are claimed from within the
DT overlay.
Signed-off-by: j-schambacher <joerg@hifiberry.com>
---
sound/soc/bcm/Kconfig | 7 ++++++
sound/soc/bcm/rpi-simple-soundcard.c | 37 ++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
--- a/sound/soc/bcm/Kconfig
+++ b/sound/soc/bcm/Kconfig
@@ -47,6 +47,13 @@ config SND_BCM2708_SOC_HIFIBERRY_ADC
Say Y or M if you want to add support for HifiBerry ADC.
Use this module for HiFiBerry's ADC-only sound cards
+config SND_BCM2708_SOC_HIFIBERRY_ADC8X
+ tristate "Support for HifiBerry ADC8X"
+ select SND_RPI_SIMPLE_SOUNDCARD
+ help
+ Say Y or M if you want to add support for HifiBerry ADC8X.
+ Note: ADC8X only works on PI5
+
config SND_BCM2708_SOC_HIFIBERRY_DAC
tristate "Support for HifiBerry DAC and DAC8X"
select SND_SOC_PCM5102A
--- a/sound/soc/bcm/rpi-simple-soundcard.c
+++ b/sound/soc/bcm/rpi-simple-soundcard.c
@@ -254,6 +254,41 @@ static struct snd_rpi_simple_drvdata drv
.dai = snd_hifiberrydacplusdsp_soundcard_dai,
};
+SND_SOC_DAILINK_DEFS(hifiberry_adc,
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
+ DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
+
+static int hifiberry_adc8x_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+
+ /* set limits of 8 channels and 192ksps sample rate
+ */
+ codec_dai->driver->capture.channels_max = 8;
+ codec_dai->driver->capture.rates = SNDRV_PCM_RATE_8000_192000;
+
+ return 0;
+}
+
+static struct snd_soc_dai_link snd_hifiberry_adc8x_dai[] = {
+ {
+ .name = "HifiBerry ADC8x",
+ .stream_name = "HifiBerry ADC8x HiFi",
+ .dai_fmt = SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBS_CFS,
+ .init = hifiberry_adc8x_init,
+ SND_SOC_DAILINK_REG(hifiberry_adc),
+ },
+};
+
+static struct snd_rpi_simple_drvdata drvdata_hifiberry_adc8x = {
+ .card_name = "snd_rpi_hifiberry_adc8x",
+ .dai = snd_hifiberry_adc8x_dai,
+ .fixed_bclk_ratio = 64,
+};
+
SND_SOC_DAILINK_DEFS(hifiberry_amp,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_CODEC("tas5713.1-001b", "tas5713-hifi")),
@@ -445,6 +480,8 @@ static const struct of_device_id snd_rpi
.data = (void *) &drvdata_googlevoicehat },
{ .compatible = "hifiberrydacplusdsp,hifiberrydacplusdsp-soundcard",
.data = (void *) &drvdata_hifiberrydacplusdsp },
+ { .compatible = "hifiberry,hifiberry-adc8x",
+ .data = (void *) &drvdata_hifiberry_adc8x },
{ .compatible = "hifiberry,hifiberry-amp",
.data = (void *) &drvdata_hifiberry_amp },
{ .compatible = "hifiberry,hifiberry-amp3",