87d523e2a6b29df6e8c487a3cfde49a7ccbce782
[openwrt/staging/linusw.git] /
1 From 4d2eaa194d77588fa42567ba174c3c14c5798027 Mon Sep 17 00:00:00 2001
2 From: j-schambacher <joerg@hifiberry.com>
3 Date: Thu, 12 Sep 2024 17:42:13 +0200
4 Subject: [PATCH 1264/1350] ASoC: add HiFiBerry ADC8x 8-channel ADC to
5 simple-card-driver
6
7 Definitions for the 8 channel ADC card. The card uses only
8 HW-controlled devices which allows the uses of the 'dummy-dai'.
9 It will run only on a PI5 as it requires the designware I2S0 module.
10
11 The necessary output lanes I2S0_DI[0..3] are claimed from within the
12 DT overlay.
13
14 Signed-off-by: j-schambacher <joerg@hifiberry.com>
15 ---
16 sound/soc/bcm/Kconfig | 7 ++++++
17 sound/soc/bcm/rpi-simple-soundcard.c | 37 ++++++++++++++++++++++++++++
18 2 files changed, 44 insertions(+)
19
20 --- a/sound/soc/bcm/Kconfig
21 +++ b/sound/soc/bcm/Kconfig
22 @@ -47,6 +47,13 @@ config SND_BCM2708_SOC_HIFIBERRY_ADC
23 Say Y or M if you want to add support for HifiBerry ADC.
24 Use this module for HiFiBerry's ADC-only sound cards
25
26 +config SND_BCM2708_SOC_HIFIBERRY_ADC8X
27 + tristate "Support for HifiBerry ADC8X"
28 + select SND_RPI_SIMPLE_SOUNDCARD
29 + help
30 + Say Y or M if you want to add support for HifiBerry ADC8X.
31 + Note: ADC8X only works on PI5
32 +
33 config SND_BCM2708_SOC_HIFIBERRY_DAC
34 tristate "Support for HifiBerry DAC and DAC8X"
35 select SND_SOC_PCM5102A
36 --- a/sound/soc/bcm/rpi-simple-soundcard.c
37 +++ b/sound/soc/bcm/rpi-simple-soundcard.c
38 @@ -254,6 +254,41 @@ static struct snd_rpi_simple_drvdata drv
39 .dai = snd_hifiberrydacplusdsp_soundcard_dai,
40 };
41
42 +SND_SOC_DAILINK_DEFS(hifiberry_adc,
43 + DAILINK_COMP_ARRAY(COMP_EMPTY()),
44 + DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
45 + DAILINK_COMP_ARRAY(COMP_EMPTY()));
46 +
47 +static int hifiberry_adc8x_init(struct snd_soc_pcm_runtime *rtd)
48 +{
49 + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
50 +
51 + /* set limits of 8 channels and 192ksps sample rate
52 + */
53 + codec_dai->driver->capture.channels_max = 8;
54 + codec_dai->driver->capture.rates = SNDRV_PCM_RATE_8000_192000;
55 +
56 + return 0;
57 +}
58 +
59 +static struct snd_soc_dai_link snd_hifiberry_adc8x_dai[] = {
60 + {
61 + .name = "HifiBerry ADC8x",
62 + .stream_name = "HifiBerry ADC8x HiFi",
63 + .dai_fmt = SND_SOC_DAIFMT_I2S |
64 + SND_SOC_DAIFMT_NB_NF |
65 + SND_SOC_DAIFMT_CBS_CFS,
66 + .init = hifiberry_adc8x_init,
67 + SND_SOC_DAILINK_REG(hifiberry_adc),
68 + },
69 +};
70 +
71 +static struct snd_rpi_simple_drvdata drvdata_hifiberry_adc8x = {
72 + .card_name = "snd_rpi_hifiberry_adc8x",
73 + .dai = snd_hifiberry_adc8x_dai,
74 + .fixed_bclk_ratio = 64,
75 +};
76 +
77 SND_SOC_DAILINK_DEFS(hifiberry_amp,
78 DAILINK_COMP_ARRAY(COMP_EMPTY()),
79 DAILINK_COMP_ARRAY(COMP_CODEC("tas5713.1-001b", "tas5713-hifi")),
80 @@ -445,6 +480,8 @@ static const struct of_device_id snd_rpi
81 .data = (void *) &drvdata_googlevoicehat },
82 { .compatible = "hifiberrydacplusdsp,hifiberrydacplusdsp-soundcard",
83 .data = (void *) &drvdata_hifiberrydacplusdsp },
84 + { .compatible = "hifiberry,hifiberry-adc8x",
85 + .data = (void *) &drvdata_hifiberry_adc8x },
86 { .compatible = "hifiberry,hifiberry-amp",
87 .data = (void *) &drvdata_hifiberry_amp },
88 { .compatible = "hifiberry,hifiberry-amp3",