Skip to content

Commit efb9a96

Browse files
Angus_Wangjamess-huang
authored andcommitted
Support some HiFiBerry and IQAudIO external sound cards.
Support List: HiFiBerry DAC+ Light HiFiBerry DAC+ Standard(RCA) HiFiBerry AMP+ IQAudIO Pi-DAC+ IQAudio Pi-DAC Pro IQAudIO Pi-DigiAMP+ IQAudIO is default set to auto-mute-amp. Change-Id: I8721403d797971ccc01f870c5b5efa5c64cfdd48 Reviewed-on: https://tp-biosrd-v02/gerrit/80741 Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com> Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
1 parent 4eb7b05 commit efb9a96

19 files changed

+1800
-17
lines changed

arch/arm/boot/dts/overlays/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Overlays for the Tinker board platform
22

33
dtbo-$(CONFIG_ARCH_ROCKCHIP) += \
4-
hifiberry-dac-amp.dtbo \
4+
hifiberry-amp.dtbo \
5+
hifiberry-dac.dtbo \
6+
hifiberry-dacplus.dtbo \
7+
iqaudio-dacplus.dtbo \
58
waveshare35a-tinker.dtbo \
69
waveshare32b-tinker.dtbo \
710

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
/ {
5+
compatible = "rockchip,rk3288";
6+
7+
fragment@0 {
8+
target-path ="/sound-simple-card";
9+
__overlay__ {
10+
status = "disabled";
11+
};
12+
};
13+
14+
fragment@1 {
15+
target = <&i2s>;
16+
__overlay__ {
17+
rockchip,xfer-mode = <1>;
18+
};
19+
};
20+
21+
fragment@2 {
22+
target = <&i2c1>;
23+
__overlay__ {
24+
tas5713@1b {
25+
#sound-dai-cells = <0>;
26+
compatible = "ti,tas5713";
27+
reg = <0x1b>;
28+
status = "okay";
29+
};
30+
};
31+
};
32+
33+
fragment@3 {
34+
target-path = "/sound-ext-card";
35+
__overlay__ {
36+
compatible = "hifiberry,hifiberry-amp";
37+
i2s-controller = <&i2s>;
38+
status = "okay";
39+
};
40+
};
41+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
/ {
5+
compatible = "rockchip,rk3288";
6+
7+
fragment@0 {
8+
target-path ="/sound-simple-card";
9+
__overlay__ {
10+
status = "disabled";
11+
};
12+
};
13+
14+
fragment@1 {
15+
target = <&i2s>;
16+
__overlay__ {
17+
rockchip,xfer-mode = <1>;
18+
};
19+
};
20+
21+
fragment@2 {
22+
target-path = "/";
23+
__overlay__ {
24+
pcm5102a-codec {
25+
#sound-dai-cells = <0>;
26+
compatible = "ti,pcm5102a";
27+
status = "okay";
28+
};
29+
};
30+
};
31+
32+
fragment@3 {
33+
target-path = "/sound-ext-card";
34+
__overlay__ {
35+
compatible = "hifiberry,hifiberry-dac";
36+
i2s-controller = <&i2s>;
37+
status = "okay";
38+
};
39+
};
40+
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
/ {
5+
compatible = "rockchip,rk3288";
6+
7+
fragment@0 {
8+
target-path ="/sound-simple-card";
9+
__overlay__ {
10+
status = "disabled";
11+
};
12+
};
13+
14+
fragment@1 {
15+
target = <&i2s>;
16+
__overlay__ {
17+
rockchip,xfer-mode = <1>;
18+
};
19+
};
20+
21+
fragment@2 {
22+
target = <&i2c1>;
23+
__overlay__ {
24+
pcm5122@4d {
25+
#sound-dai-cells = <0>;
26+
compatible = "ti,pcm5122";
27+
reg = <0x4d>;
28+
status = "okay";
29+
};
30+
};
31+
};
32+
33+
fragment@3 {
34+
target-path = "/sound-ext-card";
35+
hifiberry_dacplus: __overlay__ {
36+
compatible = "hifiberry,hifiberry-dacplus";
37+
i2s-controller = <&i2s>;
38+
status = "okay";
39+
};
40+
};
41+
42+
__overrides__ {
43+
24db_digital_gain =
44+
<&hifiberry_dacplus>,"hifiberry,24db_digital_gain?";
45+
slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?";
46+
};
47+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
/ {
5+
compatible = "rockchip,rk3288";
6+
7+
fragment@0 {
8+
target-path ="/sound-simple-card";
9+
__overlay__ {
10+
status = "disabled";
11+
};
12+
};
13+
14+
fragment@1 {
15+
target = <&i2s>;
16+
__overlay__ {
17+
rockchip,xfer-mode = <1>;
18+
};
19+
};
20+
21+
fragment@2 {
22+
target = <&i2c1>;
23+
__overlay__ {
24+
pcm5122@4c {
25+
#sound-dai-cells = <0>;
26+
compatible = "ti,pcm5122";
27+
reg = <0x4c>;
28+
status = "okay";
29+
};
30+
};
31+
};
32+
33+
fragment@3 {
34+
target-path = "/sound-ext-card";
35+
iqaudio_dac: __overlay__ {
36+
compatible = "iqaudio,iqaudio-dac";
37+
i2s-controller = <&i2s>;
38+
mute-gpios = <&gpio5 15 0>;
39+
iqaudio-dac,auto-mute-amp;
40+
status = "okay";
41+
};
42+
};
43+
44+
__overrides__ {
45+
24db_digital_gain = <&iqaudio_dac>,"iqaudio,24db_digital_gain?";
46+
auto_mute_amp = <&iqaudio_dac>,"iqaudio-dac,auto-mute-amp?";
47+
unmute_amp = <&iqaudio_dac>,"iqaudio-dac,unmute-amp?";
48+
};
49+
};

arch/arm/boot/dts/rk3288-miniarm.dts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@
189189
};
190190
};
191191

192+
sound-ext-card {
193+
status = "disabled";
194+
};
195+
192196
vcc_sys: vsys-regulator {
193197
compatible = "regulator-fixed";
194198
regulator-name = "vcc_sys";
@@ -589,13 +593,6 @@
589593

590594
&i2c1 {
591595
status = "okay";
592-
593-
pcm5122: pcm5122@4c {
594-
#sound-dai-cells = <0>;
595-
compatible = "ti,pcm5122";
596-
reg = <0x4c>;
597-
status = "disabled";
598-
};
599596
};
600597

601598
&i2c3 {

arch/arm/configs/miniarm-rk3288_defconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,11 @@ CONFIG_SND_DYNAMIC_MINORS=y
543543
# CONFIG_SND_ARM is not set
544544
# CONFIG_SND_SPI is not set
545545
CONFIG_SND_USB_AUDIO=y
546-
CONFIG_SND_SOC_PCM512x=y
547-
CONFIG_SND_SOC_PCM512x_I2C=y
548546
CONFIG_SND_SOC=y
547+
CONFIG_SND_SOC_HIFIBERRY_AMP=y
548+
CONFIG_SND_SOC_HIFIBERRY_DAC=y
549+
CONFIG_SND_SOC_HIFIBERRY_DACPLUS=y
550+
CONFIG_SND_SOC_IQAUDIO_DAC=y
549551
CONFIG_SND_SOC_ROCKCHIP=y
550552
CONFIG_SND_SOC_ROCKCHIP_SPDIF=y
551553
CONFIG_SND_SOC_ROCKCHIP_MAX98090=y

sound/soc/codecs/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ config SND_SOC_ALL_CODECS
8989
select SND_SOC_PCM1681 if I2C
9090
select SND_SOC_PCM1792A if SPI_MASTER
9191
select SND_SOC_PCM3008
92+
select SND_SOC_PCM5102A
9293
select SND_SOC_PCM512x_I2C if I2C
9394
select SND_SOC_PCM512x_SPI if SPI_MASTER
9495
select SND_SOC_RK3328
@@ -117,6 +118,7 @@ config SND_SOC_ALL_CODECS
117118
select SND_SOC_STI_SAS
118119
select SND_SOC_TAS2552 if I2C
119120
select SND_SOC_TAS5086 if I2C
121+
select SND_SOC_TAS5713 if I2C
120122
select SND_SOC_TAS571X if I2C
121123
select SND_SOC_TFA9879 if I2C
122124
select SND_SOC_TLV320AIC23_I2C if I2C
@@ -534,6 +536,9 @@ config SND_SOC_PCM1792A
534536
config SND_SOC_PCM3008
535537
tristate
536538

539+
config SND_SOC_PCM5102A
540+
tristate
541+
537542
config SND_SOC_PCM512x
538543
tristate
539544

@@ -690,6 +695,9 @@ config SND_SOC_TAS5086
690695
tristate "Texas Instruments TAS5086 speaker amplifier"
691696
depends on I2C
692697

698+
config SND_SOC_TAS5713
699+
tristate
700+
693701
config SND_SOC_TAS571X
694702
tristate "Texas Instruments TAS5711/TAS5717/TAS5719 power amplifiers"
695703
depends on I2C

sound/soc/codecs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ snd-soc-hdmi-codec-objs := hdmi-codec.o
8383
snd-soc-pcm1681-objs := pcm1681.o
8484
snd-soc-pcm1792a-codec-objs := pcm1792a.o
8585
snd-soc-pcm3008-objs := pcm3008.o
86+
snd-soc-pcm5102a-objs := pcm5102a.o
8687
snd-soc-pcm512x-objs := pcm512x.o
8788
snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
8889
snd-soc-pcm512x-spi-objs := pcm512x-spi.o
@@ -121,6 +122,7 @@ snd-soc-sta529-objs := sta529.o
121122
snd-soc-stac9766-objs := stac9766.o
122123
snd-soc-sti-sas-objs := sti-sas.o
123124
snd-soc-tas5086-objs := tas5086.o
125+
snd-soc-tas5713-objs := tas5713.o
124126
snd-soc-tas571x-objs := tas571x.o
125127
snd-soc-tc358749x-objs := tc358749x.o
126128
snd-soc-tfa9879-objs := tfa9879.o
@@ -286,6 +288,7 @@ obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
286288
obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o
287289
obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
288290
obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
291+
obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o
289292
obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
290293
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
291294
obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
@@ -321,6 +324,7 @@ obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o
321324
obj-$(CONFIG_SND_SOC_STI_SAS) += snd-soc-sti-sas.o
322325
obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o
323326
obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o
327+
obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o
324328
obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o
325329
obj-$(CONFIG_SND_SOC_TC358749X) += snd-soc-tc358749x.o
326330
obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o

sound/soc/codecs/pcm5102a.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Driver for the PCM5102A codec
3+
*
4+
* Author: Florian Meier <florian.meier@koalo.de>
5+
* Copyright 2013
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* version 2 as published by the Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful, but
12+
* WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* General Public License for more details.
15+
*/
16+
17+
#include <linux/init.h>
18+
#include <linux/module.h>
19+
#include <linux/platform_device.h>
20+
21+
#include <sound/soc.h>
22+
23+
static struct snd_soc_dai_driver pcm5102a_dai = {
24+
.name = "pcm5102a-hifi",
25+
.playback = {
26+
.channels_min = 2,
27+
.channels_max = 2,
28+
.rates = SNDRV_PCM_RATE_8000_192000,
29+
.formats = SNDRV_PCM_FMTBIT_S16_LE |
30+
SNDRV_PCM_FMTBIT_S24_LE |
31+
SNDRV_PCM_FMTBIT_S32_LE
32+
},
33+
};
34+
35+
static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
36+
37+
static int pcm5102a_probe(struct platform_device *pdev)
38+
{
39+
return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
40+
&pcm5102a_dai, 1);
41+
}
42+
43+
static int pcm5102a_remove(struct platform_device *pdev)
44+
{
45+
snd_soc_unregister_codec(&pdev->dev);
46+
return 0;
47+
}
48+
49+
static const struct of_device_id pcm5102a_of_match[] = {
50+
{ .compatible = "ti,pcm5102a", },
51+
{ }
52+
};
53+
MODULE_DEVICE_TABLE(of, pcm5102a_of_match);
54+
55+
static struct platform_driver pcm5102a_codec_driver = {
56+
.probe = pcm5102a_probe,
57+
.remove = pcm5102a_remove,
58+
.driver = {
59+
.name = "pcm5102a-codec",
60+
.of_match_table = pcm5102a_of_match,
61+
},
62+
};
63+
64+
module_platform_driver(pcm5102a_codec_driver);
65+
66+
MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
67+
MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
68+
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)