Unverified Commit cfc50995 authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "ASoC: Intel: machine driver updates" from Pierre-Louis Bossart...

Merge series "ASoC: Intel: machine driver updates" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

One correction for GeminiLake and 2 additional machine drivers for
Chromebooks.

Curtis Malainey (1):
  ASoC: Intel: Make glk+rt5682 echo ref dynamic

Sathyanarayana Nujella (2):
  ASoC: Intel: sof_rt5682: Add support for tgl-max98373-rt5682
  ASoC: Intel: common: Add mach table for tgl-max98373-rt5682

Yong Zhi (1):
  ASoC: intel: sof_da7219_max98373: Add speaker switch

 sound/soc/intel/boards/Kconfig                |  1 +
 sound/soc/intel/boards/Makefile               |  2 +-
 sound/soc/intel/boards/glk_rt5682_max98357a.c |  1 +
 sound/soc/intel/boards/sof_da7219_max98373.c  | 67 +++++++++-------
 sound/soc/intel/boards/sof_maxim_common.c     | 80 +++++++++++++++++++
 sound/soc/intel/boards/sof_maxim_common.h     | 24 ++++++
 sound/soc/intel/boards/sof_rt5682.c           | 21 +++++
 .../intel/common/soc-acpi-intel-tgl-match.c   | 13 +++
 8 files changed, 178 insertions(+), 31 deletions(-)
 create mode 100644 sound/soc/intel/boards/sof_maxim_common.c
 create mode 100644 sound/soc/intel/boards/sof_maxim_common.h

--
2.20.1
parents 7e37c5cf eb1006c6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -450,6 +450,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH
	depends on (SND_SOC_SOF_HDA_LINK && (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
		   (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST))
	depends on SND_HDA_CODEC_HDMI
	select SND_SOC_MAX98373
	select SND_SOC_RT1015
	select SND_SOC_RT5682
	select SND_SOC_DMIC
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ snd-soc-sst-byt-cht-cx2072x-objs := bytcht_cx2072x.o
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-sof_rt5682-objs := sof_rt5682.o hda_dsp_common.o sof_maxim_common.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
+1 −0
Original line number Diff line number Diff line
@@ -409,6 +409,7 @@ static struct snd_soc_dai_link geminilake_dais[] = {
		.init = NULL,
		.capture_only = 1,
		.nonatomic = 1,
		.dynamic = 1,
		SND_SOC_DAILINK_REG(echoref, dummy, platform),
	},
	[GLK_DPCM_AUDIO_REF_CP] = {
+37 −30
Original line number Diff line number Diff line
@@ -72,11 +72,17 @@ static const struct snd_kcontrol_new controls[] = {
static const struct snd_kcontrol_new m98360a_controls[] = {
	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
	SOC_DAPM_PIN_SWITCH("Headset Mic"),
	SOC_DAPM_PIN_SWITCH("Spk"),
};

/* For MAX98373 amp */
static const struct snd_soc_dapm_widget widgets[] = {
	SND_SOC_DAPM_HP("Headphone Jack", NULL),
	SND_SOC_DAPM_MIC("Headset Mic", NULL),

	SND_SOC_DAPM_SPK("Left Spk", NULL),
	SND_SOC_DAPM_SPK("Right Spk", NULL),

	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
			    platform_clock_control, SND_SOC_DAPM_POST_PMD |
			    SND_SOC_DAPM_PRE_PMU),
@@ -90,17 +96,33 @@ static const struct snd_soc_dapm_route audio_map[] = {

	{ "Headphone Jack", NULL, "Platform Clock" },
	{ "Headset Mic", NULL, "Platform Clock" },

	{ "Left Spk", NULL, "Left BE_OUT" },
	{ "Right Spk", NULL, "Right BE_OUT" },
};

/* For MAX98373 amp */
static const struct snd_soc_dapm_widget max98373_widgets[] = {
	SND_SOC_DAPM_SPK("Left Spk", NULL),
	SND_SOC_DAPM_SPK("Right Spk", NULL),
/* For MAX98360A amp */
static const struct snd_soc_dapm_widget max98360a_widgets[] = {
	SND_SOC_DAPM_HP("Headphone Jack", NULL),
	SND_SOC_DAPM_MIC("Headset Mic", NULL),

	SND_SOC_DAPM_SPK("Spk", NULL),

	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
			    platform_clock_control, SND_SOC_DAPM_POST_PMD |
			    SND_SOC_DAPM_PRE_PMU),
};

static const struct snd_soc_dapm_route max98373_map[] = {
	{ "Left Spk", NULL, "Left BE_OUT" },
	{ "Right Spk", NULL, "Right BE_OUT" },
static const struct snd_soc_dapm_route max98360a_map[] = {
	{ "Headphone Jack", NULL, "HPL" },
	{ "Headphone Jack", NULL, "HPR" },

	{ "MIC", NULL, "Headset Mic" },

	{ "Headphone Jack", NULL, "Platform Clock" },
	{ "Headset Mic", NULL, "Platform Clock" },

	{"Spk", NULL, "Speaker"},
};

static struct snd_soc_jack headset;
@@ -144,21 +166,6 @@ static int da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
	return ret;
}

static int speaker_amp_init(struct snd_soc_pcm_runtime *rtd)
{
	int ret;

	/* Add widgets */
	ret = snd_soc_dapm_new_controls(&rtd->card->dapm, max98373_widgets,
					ARRAY_SIZE(max98373_widgets));
	if (ret)
		return ret;

	/* Add routes */
	return snd_soc_dapm_add_routes(&rtd->card->dapm, max98373_map,
				       ARRAY_SIZE(max98373_map));
}

static int ssp1_hw_params(struct snd_pcm_substream *substream,
			      struct snd_pcm_hw_params *params)
{
@@ -249,8 +256,9 @@ SND_SOC_DAILINK_DEF(ssp1_amps,
	DAILINK_COMP_ARRAY(
	/* Left */	COMP_CODEC(MAXIM_DEV0_NAME, MAX98373_CODEC_DAI),
	/* Right */	COMP_CODEC(MAXIM_DEV1_NAME, MAX98373_CODEC_DAI)));
/* For the driver-less spk amp */
SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));

SND_SOC_DAILINK_DEF(ssp1_m98360a,
	DAILINK_COMP_ARRAY(COMP_CODEC("MX98360A:00", "HiFi")));

SND_SOC_DAILINK_DEF(dmic_pin,
	DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin")));
@@ -282,7 +290,6 @@ static struct snd_soc_dai_link dais[] = {
		.id = 0,
		.ignore_pmdown_time = 1,
		.no_pcm = 1,
		.init = speaker_amp_init,
		.dpcm_playback = 1,
		.dpcm_capture = 1, /* IV feedback */
		.ops = &ssp1_ops,
@@ -356,10 +363,10 @@ static struct snd_soc_card card_da7219_m98360a = {
	.num_links = ARRAY_SIZE(dais),
	.controls = m98360a_controls,
	.num_controls = ARRAY_SIZE(m98360a_controls),
	.dapm_widgets = widgets,
	.num_dapm_widgets = ARRAY_SIZE(widgets),
	.dapm_routes = audio_map,
	.num_dapm_routes = ARRAY_SIZE(audio_map),
	.dapm_widgets = max98360a_widgets,
	.num_dapm_widgets = ARRAY_SIZE(max98360a_widgets),
	.dapm_routes = max98360a_map,
	.num_dapm_routes = ARRAY_SIZE(max98360a_map),
	.fully_routed = true,
	.late_probe = card_late_probe,
};
@@ -383,7 +390,7 @@ static int audio_probe(struct platform_device *pdev)
			.no_pcm = 1,
			.dpcm_playback = 1,
			.ignore_pmdown_time = 1,
			SND_SOC_DAILINK_REG(ssp1_pin, dummy, platform) };
			SND_SOC_DAILINK_REG(ssp1_pin, ssp1_m98360a, platform) };
	}

	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
+80 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// Copyright(c) 2020 Intel Corporation. All rights reserved.
#include <linux/string.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include <sound/soc-dapm.h>
#include <uapi/sound/asound.h>
#include "sof_maxim_common.h"

static const struct snd_soc_dapm_route max_98373_dapm_routes[] = {
	/* speaker */
	{ "Left Spk", NULL, "Left BE_OUT" },
	{ "Right Spk", NULL, "Right BE_OUT" },
};

static struct snd_soc_codec_conf max_98373_codec_conf[] = {
	{
		.dlc = COMP_CODEC_CONF(MAX_98373_DEV0_NAME),
		.name_prefix = "Right",
	},
	{
		.dlc = COMP_CODEC_CONF(MAX_98373_DEV1_NAME),
		.name_prefix = "Left",
	},
};

struct snd_soc_dai_link_component max_98373_components[] = {
	{  /* For Left */
		.name = MAX_98373_DEV0_NAME,
		.dai_name = MAX_98373_CODEC_DAI,
	},
	{  /* For Right */
		.name = MAX_98373_DEV1_NAME,
		.dai_name = MAX_98373_CODEC_DAI,
	},
};

static int max98373_hw_params(struct snd_pcm_substream *substream,
			      struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *codec_dai;
	int j;

	for_each_rtd_codec_dais(rtd, j, codec_dai) {
		if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) {
			/* DEV0 tdm slot configuration */
			snd_soc_dai_set_tdm_slot(codec_dai, 0x30, 3, 8, 16);
		}
		if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) {
			/* DEV1 tdm slot configuration */
			snd_soc_dai_set_tdm_slot(codec_dai, 0xC0, 3, 8, 16);
		}
	}
	return 0;
}

struct snd_soc_ops max_98373_ops = {
	.hw_params = max98373_hw_params,
};

int max98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_card *card = rtd->card;
	int ret;

	ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes,
				      ARRAY_SIZE(max_98373_dapm_routes));
	if (ret)
		dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
	return ret;
}

void sof_max98373_codec_conf(struct snd_soc_card *card)
{
	card->codec_conf = max_98373_codec_conf;
	card->num_configs = ARRAY_SIZE(max_98373_codec_conf);
}
Loading