Skip to content

Commit 425c5fc

Browse files
lvzhaoxiongbroonie
authored andcommitted
ASoC: qcom: Add support for ALC5682I-VS codec
Qcom machine driver adds rt5682s support in this patch. Card name can be specified from dts by model property, and driver makes use of the name to distinguish which headset codec is on the board. Signed-off-by: lvzhaoxiong <lvzhaoxiong@huaqin.corp-partner.google.com> Link: https://lore.kernel.org/r/20211123024329.21998-1-lvzhaoxiong@huaqin.corp-partner.google.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fd03cf7 commit 425c5fc

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

sound/soc/qcom/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ config SND_SOC_SC7180
169169
select SND_SOC_LPASS_SC7180
170170
select SND_SOC_MAX98357A
171171
select SND_SOC_RT5682_I2C
172+
select SND_SOC_RT5682S
172173
select SND_SOC_ADAU7002
173174
help
174175
To add support for audio on Qualcomm Technologies Inc.

sound/soc/qcom/sc7180.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <uapi/linux/input-event-codes.h>
1818

1919
#include "../codecs/rt5682.h"
20+
#include "../codecs/rt5682s.h"
2021
#include "common.h"
2122
#include "lpass.h"
2223

@@ -128,7 +129,21 @@ static int sc7180_snd_startup(struct snd_pcm_substream *substream)
128129
struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card);
129130
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
130131
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
131-
int ret;
132+
int pll_id, pll_source, pll_in, pll_out, clk_id, ret;
133+
134+
if (!(strcmp(card->name, "sc7180-rt5682-max98357a-1mic"))) {
135+
pll_source = RT5682_PLL1_S_MCLK;
136+
pll_id = 0;
137+
clk_id = RT5682_SCLK_S_PLL1;
138+
pll_out = RT5682_PLL1_FREQ;
139+
pll_in = DEFAULT_MCLK_RATE;
140+
} else if (!(strcmp(card->name, "sc7180-rt5682s-max98357a-1mic"))) {
141+
pll_source = RT5682S_PLL_S_MCLK;
142+
pll_id = RT5682S_PLL2;
143+
clk_id = RT5682S_SCLK_S_PLL2;
144+
pll_out = RT5682_PLL1_FREQ;
145+
pll_in = DEFAULT_MCLK_RATE;
146+
}
132147

133148
switch (cpu_dai->id) {
134149
case MI2S_PRIMARY:
@@ -145,16 +160,15 @@ static int sc7180_snd_startup(struct snd_pcm_substream *substream)
145160
SND_SOC_DAIFMT_I2S);
146161

147162
/* Configure PLL1 for codec */
148-
ret = snd_soc_dai_set_pll(codec_dai, 0, RT5682_PLL1_S_MCLK,
149-
DEFAULT_MCLK_RATE, RT5682_PLL1_FREQ);
163+
ret = snd_soc_dai_set_pll(codec_dai, pll_id, pll_source,
164+
pll_in, pll_out);
150165
if (ret) {
151166
dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
152167
return ret;
153168
}
154169

155170
/* Configure sysclk for codec */
156-
ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1,
157-
RT5682_PLL1_FREQ,
171+
ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, pll_out,
158172
SND_SOC_CLOCK_IN);
159173
if (ret)
160174
dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n",

0 commit comments

Comments
 (0)