ASoC: Intel: sof_rt5682: add jsl_rt5650 board config
Subsystems (3)
PATCH v2 1/1 ASoC: Intel: sof_rt5682: add jsl_rt5650 board config
This configuration supports JSL boards which implement ALC5650 dual I2S interface codec. Two DAI links are added: AIF1 (on codec side) for headphone and AIF2 for speakers.
--- sound/soc/intel/boards/Kconfig | 5 +- sound/soc/intel/boards/sof_rt5682.c | 81 ++++++++++++++++++- .../intel/common/soc-acpi-intel-jsl-match.c | 12 +++ 3 files changed, 93 insertions(+), 5 deletions(-)
sound/soc/intel/boards/Kconfig +3 -2
@@ -475,7 +475,7 @@ endif ## SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC if SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL config SND_SOC_INTEL_SOF_RT5682_MACH - tristate "SOF with rt5682 codec in I2S Mode" + tristate "SOF with rt5650/rt5682 codec in I2S Mode" depends on I2C && ACPI depends on ((SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC) &&\ (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
@@ -485,6 +485,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH select SND_SOC_RT1011 select SND_SOC_RT1015 select SND_SOC_RT1015P + select SND_SOC_RT5645 select SND_SOC_RT5682_I2C select SND_SOC_RT5682S select SND_SOC_DMIC
@@ -494,7 +495,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH select SND_SOC_INTEL_SOF_REALTEK_COMMON help This adds support for ASoC machine driver for SOF platforms - with rt5682 codec. + with rt5650 or rt5682 codec. Say Y if you have such a device. If unsure select "N".
sound/soc/intel/boards/sof_rt5682.c +78 -3
170 lines not on this page · raw message
sound/soc/intel/common/soc-acpi-intel-jsl-match.c +12 -0
@@ -34,6 +34,11 @@ static const struct snd_soc_acpi_codecs mx98360a_spk = { .codecs = {"MX98360A"} }; +static struct snd_soc_acpi_codecs rt5650_spk = { + .num_codecs =1 , + .codecs = {"10EC5650" } +}; +static const struct snd_soc_acpi_codecs rt5682_rt5682s_hp = { .num_codecs =2 , .codecs = {"10EC5682" ,"RTL5682" },
@@ -98,6 +103,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = {SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, }, + { + .id = "10EC5650", + .drv_name = "jsl_rt5650", + .machine_quirk = snd_soc_acpi_codec_list, + .quirk_data = &rt5650_spk, + .sof_tplg_filename = "sof-jsl-rt5650-dual.tplg", + }, {}, };EXPORT_SYMBOL_GPL (snd_soc_acpi_intel_jsl_machines);
Signature · 1 line
2.34.1
Quoted 62 lines · Brent Lu
This configuration supports JSL boards which implement ALC5650 dual I2S interface codec. Two DAI links are added: AIF1 (on codec side) for headphone and AIF2 for speakers.
Signed-off-by Brent Lu <[email protected]>--- sound/soc/intel/boards/Kconfig | 5 +- sound/soc/intel/boards/sof_rt5682.c | 81 ++++++++++++++++++- .../intel/common/soc-acpi-intel-jsl-match.c | 12 +++ 3 files changed, 93 insertions(+), 5 deletions(-)sound/soc/intel/boards/Kconfig +3
-2@@ -475,7 +475,7 @@ endif ## SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC if SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL config SND_SOC_INTEL_SOF_RT5682_MACH - tristate "SOF with rt5682 codec in I2S Mode" + tristate "SOF with rt5650/rt5682 codec in I2S Mode" depends on I2C && ACPI depends on ((SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC) &&\ (MFD_INTEL_LPSS || COMPILE_TEST)) ||\@@ -485,6 +485,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH select SND_SOC_RT1011 select SND_SOC_RT1015 select SND_SOC_RT1015P + select SND_SOC_RT5645 select SND_SOC_RT5682_I2C select SND_SOC_RT5682S select SND_SOC_DMIC@@ -494,7 +495,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH select SND_SOC_INTEL_SOF_REALTEK_COMMON help This adds support for ASoC machine driver for SOF platforms - with rt5682 codec. + with rt5650 or rt5682 codec. Say Y if you have such a device. If unsure select "N".sound/soc/intel/boards/sof_rt5682.c +2
-0@@ -22,6 +22,7 @@#include <sound/soc-acpi.h> #include "../../codecs/rt5682.h" #include "../../codecs/rt5682s.h" +#include "../../codecs/rt5645.h" #include "../../codecs/hdac_hdmi.h" #include "../common/soc-intel-quirks.h" #include "hda_dsp_common.h" @@ -60,6 +61,7 @@#define SOF_MAX98390_SPEAKER_AMP_PRESENT BIT(24)#define SOF_MAX98390_TWEETER_SPEAKER_PRESENT BIT(25)#define SOF_RT1019_SPEAKER_AMP_PRESENT BIT(26) +#define SOF_RT5650_HEADPHONE_CODEC_PRESENT BIT(27)/* Default: MCLK on, MCLK 19.2M, SSP0 */
sound/soc/intel/boards/sof_rt5682.c static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd) · line 310
Quoted 5 lines
sound/soc/intel/boards/sof_rt5682.c +1
-1@@ -305,7 +307,7 @@ static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)struct sof_card_private *ctx =snd_soc_card_get_drvdata (rtd->card);struct snd_soc_component *component =asoc_rtd_to_codec (rtd,0 )->component;struct snd_soc_jack *jack; -int ret; +int ret, extra;
two lines, and rename to e.g. extra_jack_data
sound/soc/intel/boards/sof_rt5682.c static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd) · line 382
Quoted 3 lines
sound/soc/intel/boards/sof_rt5682.c +3
-0+if (sof_rt5682_quirk &SOF_RT5650_HEADPHONE_CODEC_PRESENT ) { + extra =SND_JACK_MICROPHONE |SND_JACK_BTN_0 ; + ret =snd_soc_component_set_jack (component, jack, &extra);
I am a bit confused on why this wasn't set for rt5682?
Quoted 34 lines
sound/soc/intel/boards/sof_rt5682.c +21
-0+ }else + ret =snd_soc_component_set_jack (component, jack,NULL ); +static const struct snd_soc_dapm_route rt5650_spk_dapm_routes[] = { +/* speaker */ + {"Left Spk" ,NULL ,"SPOL" }, + {"Right Spk" ,NULL ,"SPOR" }, +}; +static const struct snd_soc_dapm_route dmic_map[] = {/* digital mics */ {"DMic" ,NULL ,"SoC DMIC" }, }; +static int rt5650_spk_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_card *card = rtd->card; +int ret; + + ret =snd_soc_dapm_add_routes (&card->dapm, rt5650_spk_dapm_routes, +ARRAY_SIZE (rt5650_spk_dapm_routes)); +if (ret) +dev_err (rtd->dev,"fail to add dapm routes, ret=%d\n" , ret); + +return ret; +} +static int dmic_init (struct snd_soc_pcm_runtime *rtd) {struct snd_soc_card *card = rtd->card;@@ -614,6 +656,17 @@ static struct snd_soc_dai_link_component rt5682s_component[] = { } };
sound/soc/intel/boards/sof_rt5682.c static struct snd_soc_dai_link_component rt5682s_component[] = { · line 668
Quoted 10 lines
sound/soc/intel/boards/sof_rt5682.c +10
-0+static struct snd_soc_dai_link_component rt5650_components[] = { + { + .name ="i2c-10EC5650:00" , + .dai_name ="rt5645-aif1" , + }, + { + .name ="i2c-10EC5650:00" , + .dai_name ="rt5645-aif2" , + } +};
can we move these definitions to realtek_common.c, chances are other boards will also use this codec. Thanks!
Quoted 11 lines
Review
Quoted 3 lines
int
sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)(quoted diff) +0
-0struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); struct snd_soc_component *component = asoc_rtd_to_codec(rtd,0)->component;
sound/soc/intel/boards/sof_rt5682.c static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd) · line 310
Quoted 3 lines
sound/soc/intel/boards/sof_rt5682.c +1
-1struct snd_soc_jack *jack; -int ret; +int ret, extra;two lines, and rename to e.g.
extra_jack_data
Will do.
Quoted 7 lines
sound/soc/intel/boards/sof_rt5682.c static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
Quoted 3 lines
sound/soc/intel/boards/sof_rt5682.c +3
-0+if (sof_rt5682_quirk &SOF_RT5650_HEADPHONE_CODEC_PRESENT ) { + extra =SND_JACK_MICROPHONE |SND_JACK_BTN_0 ; + ret = snd_soc_component_set_jack(component, jack,&extra);
I am a bit confused on why this wasn't set for rt5682?
Rt5650's driver needs this parameter to specify whether button detection is required while rt5682's driver does not need it.
Quoted 14 lines
sound/soc/intel/boards/sof_rt5682.c static struct snd_soc_dai_link_component rt5682s_component[] = { · line 668
Quoted 11 lines
sound/soc/intel/boards/sof_rt5682.c +10
-0+static struct snd_soc_dai_link_component rt5650_components[] = { + { + .name ="i2c-10EC5650:00" , + .dai_name ="rt5645-aif1" , + }, + { + .name ="i2c-10EC5650:00" , + .dai_name ="rt5645-aif2" , + } +};can we move these definitions to
realtek_common.c, chances are other boards will also use this codec. Thanks!
Rt5650 is a all-in-one codec which supports headphone and speaker output. It's unlikely to be paired with other headphone codec. Suggest keeping it in sof_rt5682.c
Regards,
Brent