From c09f5b81491ae2d1c6d41191c16ad661fa080c76 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 16 Aug 2019 13:23:11 +0300 Subject: [PATCH 1/4] ASoC: Intel: bxt_pcm512x: use snd-hda-codec-hdmi Add support for using snd-hda-codec-hdmi driver for HDMI/DP instead of ASoC hdac-hdmi. This is aligned with how other HDA codecs are already handled. Signed-off-by: Kai Vehmanen --- sound/soc/intel/boards/Makefile | 2 +- sound/soc/intel/boards/bxt_pcm512x.c | 49 +++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index c8e02f7494cb37..fb4e1b34992368 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -6,7 +6,7 @@ snd-soc-sst-bdw-rt5677-mach-objs := bdw-rt5677.o snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o hda_dsp_common.o snd-soc-sst-bxt-rt298-objs := bxt_rt298.o hda_dsp_common.o -snd-soc-sst-bxt-pcm512x-objs := bxt_pcm512x.o +snd-soc-sst-bxt-pcm512x-objs := bxt_pcm512x.o hda_dsp_common.o snd-soc-sst-bxt-wm8804-objs := bxt_wm8804.o snd-soc-sst-glk-rt5682_max98357a-objs := glk_rt5682_max98357a.o hda_dsp_common.o snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o diff --git a/sound/soc/intel/boards/bxt_pcm512x.c b/sound/soc/intel/boards/bxt_pcm512x.c index 2e3e8bee751ce4..dd30698ec462a2 100644 --- a/sound/soc/intel/boards/bxt_pcm512x.c +++ b/sound/soc/intel/boards/bxt_pcm512x.c @@ -20,15 +20,20 @@ #include #include #include -#include "../../codecs/hdac_hdmi.h" #include "../../codecs/pcm512x.h" -#include "../atom/sst-atom-controls.h" struct bxt_card_private { struct list_head hdmi_pcm_list; + bool common_hdmi_codec_drv; }; -#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) +#if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \ + IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) + +#include "../../codecs/hdac_hdmi.h" +#include "../atom/sst-atom-controls.h" +#include "hda_dsp_common.h" + static struct snd_soc_jack broxton_hdmi[3]; struct bxt_hdmi_pcm { @@ -57,12 +62,12 @@ static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd) } #define NAME_SIZE 32 -static int bxt_card_late_probe(struct snd_soc_card *card) +static int hdmi_jack_create_controls(struct snd_soc_card *card) { struct bxt_card_private *ctx = snd_soc_card_get_drvdata(card); struct bxt_hdmi_pcm *pcm; struct snd_soc_component *component = NULL; - int err, i = 0; + int err = 0, i = 0; char jack_name[NAME_SIZE]; list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { @@ -72,7 +77,6 @@ static int bxt_card_late_probe(struct snd_soc_card *card) err = snd_soc_card_jack_new(card, jack_name, SND_JACK_AVOUT, &broxton_hdmi[i], NULL, 0); - if (err) return err; @@ -84,9 +88,29 @@ static int bxt_card_late_probe(struct snd_soc_card *card) i++; } + return err; +} + +static int bxt_card_late_probe(struct snd_soc_card *card) +{ + struct bxt_card_private *ctx = snd_soc_card_get_drvdata(card); + struct snd_soc_component *component; + struct bxt_hdmi_pcm *pcm; + int err; + + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, + head); + component = pcm->codec_dai->component; if (!component) return -EINVAL; + if (ctx->common_hdmi_codec_drv) + return hda_dsp_hdmi_build_controls(card, component); + + err = hdmi_jack_create_controls(card); + if (err < 0) + return err; + return hdac_hdmi_jack_port_init(component, &card->dapm); } #else @@ -175,6 +199,9 @@ SND_SOC_DAILINK_DEF(ssp5_codec, SND_SOC_DAILINK_DEF(platform, DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:0e.0"))); +#if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \ + IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) + SND_SOC_DAILINK_DEF(idisp1_pin, DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin"))); SND_SOC_DAILINK_DEF(idisp1_codec, @@ -190,6 +217,8 @@ SND_SOC_DAILINK_DEF(idisp3_pin, SND_SOC_DAILINK_DEF(idisp3_codec, DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3"))); +#endif + static struct snd_soc_dai_link dailink[] = { /* CODEC<->CODEC link */ /* back ends */ @@ -206,7 +235,8 @@ static struct snd_soc_dai_link dailink[] = { .dpcm_capture = 1, SND_SOC_DAILINK_REG(ssp5_pin, ssp5_codec, platform), }, -#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) +#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) || \ + IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC) { .name = "iDisp1", .id = 1, @@ -264,7 +294,8 @@ static int bxt_pcm512x_probe(struct platform_device *pdev) if (!ctx) return -ENOMEM; - if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) + if (IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || + IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) INIT_LIST_HEAD(&ctx->hdmi_pcm_list); mach = (&pdev->dev)->platform_data; @@ -277,6 +308,8 @@ static int bxt_pcm512x_probe(struct platform_device *pdev) if (ret_val) return ret_val; + ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; + /* fix index of codec dai */ for (i = 0; i < ARRAY_SIZE(dailink); i++) { if (!strcmp(dailink[i].codecs->name, "i2c-104C5122:00")) { From 5595c85faecd2e0bf931d76da26f664e1eb7dc13 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 1 Nov 2019 15:59:24 +0200 Subject: [PATCH 2/4] ASoC: Intel: cml_rt1011_rt5682: fix bug in Makefile Fix incorrect use of the intermediate variable snd-soc-cml_rt1011_rt5682-objs in Makefile. Signed-off-by: Kai Vehmanen --- sound/soc/intel/boards/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index fb4e1b34992368..5ffa9b2bfb928f 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -53,7 +53,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_CX2072X_MACH) += snd-soc-sst-byt-cht-cx2072x. obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH) += snd-soc-sst-byt-cht-es8316.o obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) += snd-soc-sst-byt-cht-nocodec.o -obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH) += cml_rt1011_rt5682.o +obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH) += snd-soc-cml_rt1011_rt5682.o obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH) += snd-soc-kbl_da7219_max98357a.o obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98927_MACH) += snd-soc-kbl_da7219_max98927.o obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH) += snd-soc-kbl_rt5663_max98927.o From 1d1d039719645849395efd1979562d3d1e52a57f Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 1 Nov 2019 12:40:38 +0200 Subject: [PATCH 3/4] ASoC: Intel: cml_rt1011_rt5682: common hdmi codec support Add support for using snd-hda-codec-hdmi driver for HDMI/DP instead of ASoC hdac-hdmi. This is aligned with how other HDA codecs are already handled. Signed-off-by: Kai Vehmanen --- sound/soc/intel/boards/Makefile | 2 +- sound/soc/intel/boards/cml_rt1011_rt5682.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index 5ffa9b2bfb928f..28acd6ed292a0d 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -20,7 +20,7 @@ snd-soc-sst-byt-cht-da7213-objs := bytcht_da7213.o snd-soc-sst-byt-cht-es8316-objs := bytcht_es8316.o snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o snd-soc-sof_rt5682-objs := sof_rt5682.o hda_dsp_common.o -snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o +snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o hda_dsp_common.o snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o diff --git a/sound/soc/intel/boards/cml_rt1011_rt5682.c b/sound/soc/intel/boards/cml_rt1011_rt5682.c index f2837a20834199..a22f9723420117 100644 --- a/sound/soc/intel/boards/cml_rt1011_rt5682.c +++ b/sound/soc/intel/boards/cml_rt1011_rt5682.c @@ -23,6 +23,7 @@ #include "../../codecs/rt1011.h" #include "../../codecs/rt5682.h" #include "../../codecs/hdac_hdmi.h" +#include "hda_dsp_common.h" /* The platform clock outputs 24Mhz clock to codec as I2S MCLK */ #define CML_PLAT_CLK 24000000 @@ -42,6 +43,7 @@ struct card_private { char codec_name[SND_ACPI_I2C_ID_LEN]; struct snd_soc_jack headset; struct list_head hdmi_pcm_list; + bool common_hdmi_codec_drv; }; static const struct snd_kcontrol_new cml_controls[] = { @@ -240,6 +242,13 @@ static int sof_card_late_probe(struct snd_soc_card *card) struct hdmi_pcm *pcm; int ret, i = 0; + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, + head); + component = pcm->codec_dai->component; + + if (ctx->common_hdmi_codec_drv) + return hda_dsp_hdmi_build_controls(card, component); + list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { component = pcm->codec_dai->component; snprintf(jack_name, sizeof(jack_name), @@ -452,6 +461,9 @@ static int snd_cml_rt1011_probe(struct platform_device *pdev) platform_name); if (ret) return ret; + + ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; + snd_soc_card_set_drvdata(&snd_soc_card_cml, ctx); return devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cml); From 0766a154c980111ee9c73ac462faade591bcaef5 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 1 Nov 2019 12:44:38 +0200 Subject: [PATCH 4/4] ASoC: Intel: tgl_rt1308: common hdmi codec support Add support for using snd-hda-codec-hdmi driver for HDMI/DP instead of ASoC hdac-hdmi. This is aligned with how other HDA codecs are already handled. Signed-off-by: Kai Vehmanen --- sound/soc/intel/boards/Makefile | 2 +- sound/soc/intel/boards/tgl_rt1308.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index 28acd6ed292a0d..9bab36acf2d232 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -30,7 +30,7 @@ snd-soc-skl_rt286-objs := skl_rt286.o snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o hda_dsp_common.o snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o -snd-soc-tgl-rt1308-objs := tgl_rt1308.o +snd-soc-tgl-rt1308-objs := tgl_rt1308.o hda_dsp_common.o obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o diff --git a/sound/soc/intel/boards/tgl_rt1308.c b/sound/soc/intel/boards/tgl_rt1308.c index c6b6e4a5215a82..c9e3c479b27cd6 100644 --- a/sound/soc/intel/boards/tgl_rt1308.c +++ b/sound/soc/intel/boards/tgl_rt1308.c @@ -21,9 +21,11 @@ #include "../../codecs/rt1308.h" #include "../../codecs/hdac_hdmi.h" +#include "hda_dsp_common.h" struct tgl_card_private { struct list_head hdmi_pcm_list; + bool common_hdmi_codec_drv; }; #if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI) @@ -63,6 +65,13 @@ static int tgl_card_late_probe(struct snd_soc_card *card) int err, i = 0; char jack_name[NAME_SIZE]; + pcm = list_first_entry(&ctx->hdmi_pcm_list, struct tgl_hdmi_pcm, + head); + component = pcm->codec_dai->component; + + if (ctx->common_hdmi_codec_drv) + return hda_dsp_hdmi_build_controls(card, component); + list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { component = pcm->codec_dai->component; snprintf(jack_name, sizeof(jack_name), @@ -284,6 +293,8 @@ static int tgl_rt1308_probe(struct platform_device *pdev) if (ret) return ret; + ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; + snd_soc_card_set_drvdata(card, ctx); return devm_snd_soc_register_card(&pdev->dev, card);