bcm27xx: update 6.1 patches from RPi foundation
[openwrt/staging/xback.git] / target / linux / bcm27xx / patches-6.1 / 950-1282-ASOc-Add-HiFiBerry-DAC8X-to-the-simple-card-driver.patch
1 From d4acd8b7ea890c01453cdcf9b04a999ca04dfd2a Mon Sep 17 00:00:00 2001
2 From: j-schambacher <joerg@hifiberry.com>
3 Date: Wed, 28 Feb 2024 11:25:14 +0100
4 Subject: [PATCH 1282/1295] ASOc: Add HiFiBerry DAC8X to the simple card driver
5
6 Defines the settings for the 8 channel version of the standard
7 DAC by overwriting the number of channels in the DAI defs.
8 It can run in 8ch mode only on PI5 using the 4 lane data output
9 of the designware I2S0 module.
10
11 Signed-off-by: j-schambacher <joerg@hifiberry.com>
12 ---
13 sound/soc/bcm/Kconfig | 5 +++--
14 sound/soc/bcm/rpi-simple-soundcard.c | 33 ++++++++++++++++++++++++++++
15 2 files changed, 36 insertions(+), 2 deletions(-)
16
17 --- a/sound/soc/bcm/Kconfig
18 +++ b/sound/soc/bcm/Kconfig
19 @@ -40,11 +40,12 @@ config SND_BCM2708_SOC_GOOGLEVOICEHAT_SO
20 Say Y or M if you want to add support for voiceHAT soundcard.
21
22 config SND_BCM2708_SOC_HIFIBERRY_DAC
23 - tristate "Support for HifiBerry DAC"
24 + tristate "Support for HifiBerry DAC and DAC8X"
25 select SND_SOC_PCM5102A
26 select SND_RPI_SIMPLE_SOUNDCARD
27 help
28 - Say Y or M if you want to add support for HifiBerry DAC.
29 + Say Y or M if you want to add support for HifiBerry DAC and DAC8X.
30 + Note: DAC8X only works on PI5
31
32 config SND_BCM2708_SOC_HIFIBERRY_DACPLUS
33 tristate "Support for HifiBerry DAC+"
34 --- a/sound/soc/bcm/rpi-simple-soundcard.c
35 +++ b/sound/soc/bcm/rpi-simple-soundcard.c
36 @@ -316,6 +316,37 @@ static struct snd_rpi_simple_drvdata drv
37 .dai = snd_hifiberry_dac_dai,
38 };
39
40 +static int hifiberry_dac8x_init(struct snd_soc_pcm_runtime *rtd)
41 +{
42 + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
43 +
44 + /* override the defaults to reflect 4 x PCM5102A on the card
45 + * and limit the sample rate to 192ksps
46 + */
47 + codec_dai->driver->playback.channels_max = 8;
48 + codec_dai->driver->playback.rates = SNDRV_PCM_RATE_8000_192000;
49 +
50 + return 0;
51 +}
52 +
53 +static struct snd_soc_dai_link snd_hifiberry_dac8x_dai[] = {
54 + {
55 + .name = "HifiBerry DAC8x",
56 + .stream_name = "HifiBerry DAC8x HiFi",
57 + .dai_fmt = SND_SOC_DAIFMT_I2S |
58 + SND_SOC_DAIFMT_NB_NF |
59 + SND_SOC_DAIFMT_CBS_CFS,
60 + .init = hifiberry_dac8x_init,
61 + SND_SOC_DAILINK_REG(hifiberry_dac),
62 + },
63 +};
64 +
65 +static struct snd_rpi_simple_drvdata drvdata_hifiberry_dac8x = {
66 + .card_name = "snd_rpi_hifiberry_dac8x",
67 + .dai = snd_hifiberry_dac8x_dai,
68 + .fixed_bclk_ratio = 64,
69 +};
70 +
71 SND_SOC_DAILINK_DEFS(dionaudio_kiwi,
72 DAILINK_COMP_ARRAY(COMP_EMPTY()),
73 DAILINK_COMP_ARRAY(COMP_CODEC("pcm1794a-codec", "pcm1794a-hifi")),
74 @@ -417,6 +448,8 @@ static const struct of_device_id snd_rpi
75 .data = (void *) &drvdata_hifiberry_amp3 },
76 { .compatible = "hifiberry,hifiberry-dac",
77 .data = (void *) &drvdata_hifiberry_dac },
78 + { .compatible = "hifiberry,hifiberry-dac8x",
79 + .data = (void *) &drvdata_hifiberry_dac8x },
80 { .compatible = "dionaudio,dionaudio-kiwi",
81 .data = (void *) &drvdata_dionaudio_kiwi },
82 { .compatible = "rpi,rpi-dac", &drvdata_rpi_dac},