Skip to content

Commit 414e3ca

Browse files
Ravulapati Vishnu vardhan raobroonie
authored andcommitted
ASoC: amd: Adding support for ALC1015 codec in machine driver
Adding support for ALC1015 RTK codec in machine driver. Passing specific card structure based on its ACPI ID. Signed-off-by: Ravulapati Vishnu vardhan rao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 0fe4b56 commit 414e3ca

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed

sound/soc/amd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ config SND_SOC_AMD_RV_RT5682_MACH
3333
select SND_SOC_MAX98357A
3434
select SND_SOC_CROS_EC_CODEC
3535
select I2C_CROS_EC_TUNNEL
36+
select SND_SOC_RT1015
3637
depends on SND_SOC_AMD_ACP3x && I2C && CROS_EC
3738
help
3839
This option enables machine driver for RT5682 and MAX9835.

sound/soc/amd/acp3x-rt5682-max9836.c

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "raven/acp3x.h"
2323
#include "../codecs/rt5682.h"
24+
#include "../codecs/rt1015.h"
2425

2526
#define PCO_PLAT_CLK 48000000
2627
#define RT5682_PLL_FREQ (48000 * 512)
@@ -247,7 +248,18 @@ SND_SOC_DAILINK_DEF(cros_ec,
247248
SND_SOC_DAILINK_DEF(platform,
248249
DAILINK_COMP_ARRAY(COMP_PLATFORM("acp3x_rv_i2s_dma.0")));
249250

250-
static struct snd_soc_dai_link acp3x_dai_5682_98357[] = {
251+
static struct snd_soc_codec_conf rt1015_conf[] = {
252+
{
253+
.dlc = COMP_CODEC_CONF("i2c-10EC1015:00"),
254+
.name_prefix = "Left",
255+
},
256+
{
257+
.dlc = COMP_CODEC_CONF("i2c-10EC1015:01"),
258+
.name_prefix = "Right",
259+
},
260+
};
261+
262+
static struct snd_soc_dai_link acp3x_dai[] = {
251263
{
252264
.name = "acp3x-5682-play",
253265
.stream_name = "Playback",
@@ -317,8 +329,8 @@ static const struct snd_kcontrol_new acp3x_5682_mc_controls[] = {
317329
static struct snd_soc_card acp3x_5682 = {
318330
.name = "acp3xalc5682m98357",
319331
.owner = THIS_MODULE,
320-
.dai_link = acp3x_dai_5682_98357,
321-
.num_links = ARRAY_SIZE(acp3x_dai_5682_98357),
332+
.dai_link = acp3x_dai,
333+
.num_links = ARRAY_SIZE(acp3x_dai),
322334
.dapm_widgets = acp3x_5682_widgets,
323335
.num_dapm_widgets = ARRAY_SIZE(acp3x_5682_widgets),
324336
.dapm_routes = acp3x_5682_audio_route,
@@ -327,6 +339,47 @@ static struct snd_soc_card acp3x_5682 = {
327339
.num_controls = ARRAY_SIZE(acp3x_5682_mc_controls),
328340
};
329341

342+
static const struct snd_soc_dapm_widget acp3x_1015_widgets[] = {
343+
SND_SOC_DAPM_HP("Headphone Jack", NULL),
344+
SND_SOC_DAPM_MIC("Headset Mic", NULL),
345+
SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0,
346+
&acp3x_dmic_mux_control),
347+
SND_SOC_DAPM_SPK("Left Spk", NULL),
348+
SND_SOC_DAPM_SPK("Right Spk", NULL),
349+
};
350+
351+
static const struct snd_soc_dapm_route acp3x_1015_route[] = {
352+
{"Headphone Jack", NULL, "HPOL"},
353+
{"Headphone Jack", NULL, "HPOR"},
354+
{"IN1P", NULL, "Headset Mic"},
355+
{"Dmic Mux", "Front Mic", "DMIC"},
356+
{"Dmic Mux", "Rear Mic", "DMIC"},
357+
{"Left Spk", NULL, "Left SPO"},
358+
{"Right Spk", NULL, "Right SPO"},
359+
};
360+
361+
static const struct snd_kcontrol_new acp3x_mc_1015_controls[] = {
362+
SOC_DAPM_PIN_SWITCH("Headphone Jack"),
363+
SOC_DAPM_PIN_SWITCH("Headset Mic"),
364+
SOC_DAPM_PIN_SWITCH("Left Spk"),
365+
SOC_DAPM_PIN_SWITCH("Right Spk"),
366+
};
367+
368+
static struct snd_soc_card acp3x_1015 = {
369+
.name = "acp3xalc56821015",
370+
.owner = THIS_MODULE,
371+
.dai_link = acp3x_dai,
372+
.num_links = ARRAY_SIZE(acp3x_dai),
373+
.dapm_widgets = acp3x_1015_widgets,
374+
.num_dapm_widgets = ARRAY_SIZE(acp3x_1015_widgets),
375+
.dapm_routes = acp3x_1015_route,
376+
.num_dapm_routes = ARRAY_SIZE(acp3x_1015_route),
377+
.codec_conf = rt1015_conf,
378+
.num_configs = ARRAY_SIZE(rt1015_conf),
379+
.controls = acp3x_mc_1015_controls,
380+
.num_controls = ARRAY_SIZE(acp3x_mc_1015_controls),
381+
};
382+
330383
void *soc_is_rltk_max(struct device *dev)
331384
{
332385
const struct acpi_device_id *match;
@@ -375,6 +428,7 @@ static int acp3x_probe(struct platform_device *pdev)
375428

376429
static const struct acpi_device_id acp3x_audio_acpi_match[] = {
377430
{ "AMDI5682", (unsigned long)&acp3x_5682},
431+
{ "AMDI1015", (unsigned long)&acp3x_1015},
378432
{},
379433
};
380434
MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match);
@@ -391,5 +445,6 @@ static struct platform_driver acp3x_audio = {
391445
module_platform_driver(acp3x_audio);
392446

393447
MODULE_AUTHOR("[email protected]");
394-
MODULE_DESCRIPTION("ALC5682 & MAX98357 audio support");
448+
MODULE_AUTHOR("[email protected]");
449+
MODULE_DESCRIPTION("ALC5682 ALC1015 & MAX98357 audio support");
395450
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)