Skip to content

Commit 0ddce71

Browse files
Bard Liaobroonie
authored andcommitted
ASoC: rt5682: add rt5682 codec driver
This is the initial codec driver for rt5682. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 53af408 commit 0ddce71

File tree

6 files changed

+4104
-0
lines changed

6 files changed

+4104
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
RT5682 audio CODEC
2+
3+
This device supports I2C only.
4+
5+
Required properties:
6+
7+
- compatible : "realtek,rt5682" or "realtek,rt5682i"
8+
9+
- reg : The I2C address of the device.
10+
11+
Optional properties:
12+
13+
- interrupts : The CODEC's interrupt output.
14+
15+
- realtek,dmic1-data-pin
16+
0: dmic1 is not used
17+
1: using GPIO2 pin as dmic1 data pin
18+
2: using GPIO5 pin as dmic1 data pin
19+
20+
- realtek,dmic1-clk-pin
21+
0: using GPIO1 pin as dmic1 clock pin
22+
1: using GPIO3 pin as dmic1 clock pin
23+
24+
- realtek,jd-src
25+
0: No JD is used
26+
1: using JD1 as JD source
27+
28+
- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
29+
30+
Pins on the device (for linking into audio routes) for RT5682:
31+
32+
* DMIC L1
33+
* DMIC R1
34+
* IN1P
35+
* HPOL
36+
* HPOR
37+
38+
Example:
39+
40+
rt5682 {
41+
compatible = "realtek,rt5682i";
42+
reg = <0x1a>;
43+
interrupt-parent = <&gpio>;
44+
interrupts = <TEGRA_GPIO(U, 6) GPIO_ACTIVE_HIGH>;
45+
realtek,ldo1-en-gpios =
46+
<&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_HIGH>;
47+
realtek,dmic1-data-pin = <1>;
48+
realtek,dmic1-clk-pin = <1>;
49+
realtek,jd-src = <1>;
50+
};

include/sound/rt5682.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* linux/sound/rt5682.h -- Platform data for RT5682
3+
*
4+
* Copyright 2018 Realtek Microelectronics
5+
*
6+
* This program is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License version 2 as
8+
* published by the Free Software Foundation.
9+
*/
10+
11+
#ifndef __LINUX_SND_RT5682_H
12+
#define __LINUX_SND_RT5682_H
13+
14+
enum rt5682_dmic1_data_pin {
15+
RT5682_DMIC1_NULL,
16+
RT5682_DMIC1_DATA_GPIO2,
17+
RT5682_DMIC1_DATA_GPIO5,
18+
};
19+
20+
enum rt5682_dmic1_clk_pin {
21+
RT5682_DMIC1_CLK_GPIO1,
22+
RT5682_DMIC1_CLK_GPIO3,
23+
};
24+
25+
enum rt5682_jd_src {
26+
RT5682_JD_NULL,
27+
RT5682_JD1,
28+
};
29+
30+
struct rt5682_platform_data {
31+
32+
int ldo1_en; /* GPIO for LDO1_EN */
33+
34+
enum rt5682_dmic1_data_pin dmic1_data_pin;
35+
enum rt5682_dmic1_clk_pin dmic1_clk_pin;
36+
enum rt5682_jd_src jd_src;
37+
};
38+
39+
#endif
40+

sound/soc/codecs/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ config SND_SOC_ALL_CODECS
141141
select SND_SOC_RT5668 if I2C
142142
select SND_SOC_RT5670 if I2C
143143
select SND_SOC_RT5677 if I2C && SPI_MASTER
144+
select SND_SOC_RT5682 if I2C
144145
select SND_SOC_SGTL5000 if I2C
145146
select SND_SOC_SI476X if MFD_SI476X_CORE
146147
select SND_SOC_SIRF_AUDIO_CODEC
@@ -778,6 +779,7 @@ config SND_SOC_RL6231
778779
default y if SND_SOC_RT5668=y
779780
default y if SND_SOC_RT5670=y
780781
default y if SND_SOC_RT5677=y
782+
default y if SND_SOC_RT5682=y
781783
default y if SND_SOC_RT1305=y
782784
default m if SND_SOC_RT5514=m
783785
default m if SND_SOC_RT5616=m
@@ -791,6 +793,7 @@ config SND_SOC_RL6231
791793
default m if SND_SOC_RT5668=m
792794
default m if SND_SOC_RT5670=m
793795
default m if SND_SOC_RT5677=m
796+
default m if SND_SOC_RT5682=m
794797
default m if SND_SOC_RT1305=m
795798

796799
config SND_SOC_RL6347A
@@ -871,6 +874,9 @@ config SND_SOC_RT5677_SPI
871874
tristate
872875
default SND_SOC_RT5677 && SPI
873876

877+
config SND_SOC_RT5682
878+
tristate
879+
874880
#Freescale sgtl5000 codec
875881
config SND_SOC_SGTL5000
876882
tristate "Freescale SGTL5000 CODEC"

sound/soc/codecs/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ snd-soc-rt5668-objs := rt5668.o
146146
snd-soc-rt5670-objs := rt5670.o
147147
snd-soc-rt5677-objs := rt5677.o
148148
snd-soc-rt5677-spi-objs := rt5677-spi.o
149+
snd-soc-rt5682-objs := rt5682.o
149150
snd-soc-sgtl5000-objs := sgtl5000.o
150151
snd-soc-alc5623-objs := alc5623.o
151152
snd-soc-alc5632-objs := alc5632.o
@@ -405,6 +406,7 @@ obj-$(CONFIG_SND_SOC_RT5668) += snd-soc-rt5668.o
405406
obj-$(CONFIG_SND_SOC_RT5670) += snd-soc-rt5670.o
406407
obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o
407408
obj-$(CONFIG_SND_SOC_RT5677_SPI) += snd-soc-rt5677-spi.o
409+
obj-$(CONFIG_SND_SOC_RT5682) += snd-soc-rt5682.o
408410
obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
409411
obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
410412
obj-$(CONFIG_SND_SOC_SIGMADSP_I2C) += snd-soc-sigmadsp-i2c.o

0 commit comments

Comments
 (0)