Skip to content

Commit 33ada14

Browse files
Bard Liaobroonie
authored andcommitted
ASoC: add rt5665 codec driver
This is the initial codec driver for rt5665. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 134340b commit 33ada14

File tree

6 files changed

+6988
-0
lines changed

6 files changed

+6988
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
RT5665/RT5666/RT5668 audio CODEC
2+
3+
This device supports I2C only.
4+
5+
Required properties:
6+
7+
- compatible : One of "realtek,rt5665", "realtek,rt5666" or "realtek,rt5668".
8+
9+
- reg : The I2C address of the device.
10+
11+
- interrupts : The CODEC's interrupt output.
12+
13+
Optional properties:
14+
15+
- realtek,in1-differential
16+
- realtek,in2-differential
17+
- realtek,in3-differential
18+
- realtek,in4-differential
19+
Boolean. Indicate MIC1/2/3/4 input are differential, rather than single-ended.
20+
21+
- realtek,dmic1-data-pin
22+
0: dmic1 is not used
23+
1: using GPIO4 pin as dmic1 data pin
24+
2: using IN2N pin as dmic2 data pin
25+
26+
- realtek,dmic2-data-pin
27+
0: dmic2 is not used
28+
1: using GPIO5 pin as dmic2 data pin
29+
2: using IN2P pin as dmic2 data pin
30+
31+
- realtek,jd-src
32+
0: No JD is used
33+
1: using JD1 as JD source
34+
35+
- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
36+
37+
Pins on the device (for linking into audio routes) for RT5659/RT5658:
38+
39+
* DMIC L1
40+
* DMIC R1
41+
* DMIC L2
42+
* DMIC R2
43+
* IN1P
44+
* IN1N
45+
* IN2P
46+
* IN2N
47+
* IN3P
48+
* IN3N
49+
* IN4P
50+
* IN4N
51+
* HPOL
52+
* HPOR
53+
* LOUTL
54+
* LOUTR
55+
* MONOOUT
56+
* PDML
57+
* PDMR
58+
59+
Example:
60+
61+
rt5659 {
62+
compatible = "realtek,rt5665";
63+
reg = <0x1b>;
64+
interrupt-parent = <&gpio>;
65+
interrupts = <TEGRA_GPIO(W, 3) GPIO_ACTIVE_HIGH>;
66+
realtek,ldo1-en-gpios =
67+
<&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
68+
};

include/sound/rt5665.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* linux/sound/rt5665.h -- Platform data for RT5665
3+
*
4+
* Copyright 2016 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_RT5665_H
12+
#define __LINUX_SND_RT5665_H
13+
14+
enum rt5665_dmic1_data_pin {
15+
RT5665_DMIC1_NULL,
16+
RT5665_DMIC1_DATA_GPIO4,
17+
RT5665_DMIC1_DATA_IN2N,
18+
};
19+
20+
enum rt5665_dmic2_data_pin {
21+
RT5665_DMIC2_NULL,
22+
RT5665_DMIC2_DATA_GPIO5,
23+
RT5665_DMIC2_DATA_IN2P,
24+
};
25+
26+
enum rt5665_jd_src {
27+
RT5665_JD_NULL,
28+
RT5665_JD1,
29+
};
30+
31+
struct rt5665_platform_data {
32+
bool in1_diff;
33+
bool in2_diff;
34+
bool in3_diff;
35+
bool in4_diff;
36+
37+
int ldo1_en; /* GPIO for LDO1_EN */
38+
39+
enum rt5665_dmic1_data_pin dmic1_data_pin;
40+
enum rt5665_dmic2_data_pin dmic2_data_pin;
41+
enum rt5665_jd_src jd_src;
42+
43+
unsigned int sar_hs_type;
44+
};
45+
46+
#endif
47+

sound/soc/codecs/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ config SND_SOC_ALL_CODECS
114114
select SND_SOC_RT5651 if I2C
115115
select SND_SOC_RT5659 if I2C
116116
select SND_SOC_RT5660 if I2C
117+
select SND_SOC_RT5665 if I2C
117118
select SND_SOC_RT5663 if I2C
118119
select SND_SOC_RT5670 if I2C
119120
select SND_SOC_RT5677 if I2C && SPI_MASTER
@@ -649,6 +650,7 @@ config SND_SOC_RL6231
649650
default y if SND_SOC_RT5651=y
650651
default y if SND_SOC_RT5659=y
651652
default y if SND_SOC_RT5660=y
653+
default y if SND_SOC_RT5665=y
652654
default y if SND_SOC_RT5663=y
653655
default y if SND_SOC_RT5670=y
654656
default y if SND_SOC_RT5677=y
@@ -659,6 +661,7 @@ config SND_SOC_RL6231
659661
default m if SND_SOC_RT5651=m
660662
default m if SND_SOC_RT5659=m
661663
default m if SND_SOC_RT5660=m
664+
default m if SND_SOC_RT5665=m
662665
default m if SND_SOC_RT5663=m
663666
default m if SND_SOC_RT5670=m
664667
default m if SND_SOC_RT5677=m
@@ -708,6 +711,9 @@ config SND_SOC_RT5659
708711
config SND_SOC_RT5660
709712
tristate
710713

714+
config SND_SOC_RT5665
715+
tristate
716+
711717
config SND_SOC_RT5663
712718
tristate
713719

sound/soc/codecs/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ snd-soc-rt5645-objs := rt5645.o
114114
snd-soc-rt5651-objs := rt5651.o
115115
snd-soc-rt5659-objs := rt5659.o
116116
snd-soc-rt5660-objs := rt5660.o
117+
snd-soc-rt5665-objs := rt5665.o
117118
snd-soc-rt5663-objs := rt5663.o
118119
snd-soc-rt5670-objs := rt5670.o
119120
snd-soc-rt5677-objs := rt5677.o
@@ -338,6 +339,7 @@ obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o
338339
obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o
339340
obj-$(CONFIG_SND_SOC_RT5659) += snd-soc-rt5659.o
340341
obj-$(CONFIG_SND_SOC_RT5660) += snd-soc-rt5660.o
342+
obj-$(CONFIG_SND_SOC_RT5665) += snd-soc-rt5665.o
341343
obj-$(CONFIG_SND_SOC_RT5663) += snd-soc-rt5663.o
342344
obj-$(CONFIG_SND_SOC_RT5670) += snd-soc-rt5670.o
343345
obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o

0 commit comments

Comments
 (0)