Skip to content

Commit 4d2eaa1

Browse files
j-schambacherpelwell
authored andcommitted
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 <[email protected]>
1 parent 77773ae commit 4d2eaa1

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

sound/soc/bcm/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ config SND_BCM2708_SOC_HIFIBERRY_ADC
4747
Say Y or M if you want to add support for HifiBerry ADC.
4848
Use this module for HiFiBerry's ADC-only sound cards
4949

50+
config SND_BCM2708_SOC_HIFIBERRY_ADC8X
51+
tristate "Support for HifiBerry ADC8X"
52+
select SND_RPI_SIMPLE_SOUNDCARD
53+
help
54+
Say Y or M if you want to add support for HifiBerry ADC8X.
55+
Note: ADC8X only works on PI5
56+
5057
config SND_BCM2708_SOC_HIFIBERRY_DAC
5158
tristate "Support for HifiBerry DAC and DAC8X"
5259
select SND_SOC_PCM5102A

sound/soc/bcm/rpi-simple-soundcard.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,41 @@ static struct snd_rpi_simple_drvdata drvdata_hifiberrydacplusdsp = {
254254
.dai = snd_hifiberrydacplusdsp_soundcard_dai,
255255
};
256256

257+
SND_SOC_DAILINK_DEFS(hifiberry_adc,
258+
DAILINK_COMP_ARRAY(COMP_EMPTY()),
259+
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")),
260+
DAILINK_COMP_ARRAY(COMP_EMPTY()));
261+
262+
static int hifiberry_adc8x_init(struct snd_soc_pcm_runtime *rtd)
263+
{
264+
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
265+
266+
/* set limits of 8 channels and 192ksps sample rate
267+
*/
268+
codec_dai->driver->capture.channels_max = 8;
269+
codec_dai->driver->capture.rates = SNDRV_PCM_RATE_8000_192000;
270+
271+
return 0;
272+
}
273+
274+
static struct snd_soc_dai_link snd_hifiberry_adc8x_dai[] = {
275+
{
276+
.name = "HifiBerry ADC8x",
277+
.stream_name = "HifiBerry ADC8x HiFi",
278+
.dai_fmt = SND_SOC_DAIFMT_I2S |
279+
SND_SOC_DAIFMT_NB_NF |
280+
SND_SOC_DAIFMT_CBS_CFS,
281+
.init = hifiberry_adc8x_init,
282+
SND_SOC_DAILINK_REG(hifiberry_adc),
283+
},
284+
};
285+
286+
static struct snd_rpi_simple_drvdata drvdata_hifiberry_adc8x = {
287+
.card_name = "snd_rpi_hifiberry_adc8x",
288+
.dai = snd_hifiberry_adc8x_dai,
289+
.fixed_bclk_ratio = 64,
290+
};
291+
257292
SND_SOC_DAILINK_DEFS(hifiberry_amp,
258293
DAILINK_COMP_ARRAY(COMP_EMPTY()),
259294
DAILINK_COMP_ARRAY(COMP_CODEC("tas5713.1-001b", "tas5713-hifi")),
@@ -445,6 +480,8 @@ static const struct of_device_id snd_rpi_simple_of_match[] = {
445480
.data = (void *) &drvdata_googlevoicehat },
446481
{ .compatible = "hifiberrydacplusdsp,hifiberrydacplusdsp-soundcard",
447482
.data = (void *) &drvdata_hifiberrydacplusdsp },
483+
{ .compatible = "hifiberry,hifiberry-adc8x",
484+
.data = (void *) &drvdata_hifiberry_adc8x },
448485
{ .compatible = "hifiberry,hifiberry-amp",
449486
.data = (void *) &drvdata_hifiberry_amp },
450487
{ .compatible = "hifiberry,hifiberry-amp3",

0 commit comments

Comments
 (0)