Unverified Commit 3d2cdb85 authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "ASoC: Intel: add SoundWire machine driver" from Pierre-Louis...

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

To handle multiple hardware combinations, this patchset suggests a
single machine driver which will create and initialize dailinks
dynamically. This allows us to support new configurations easily, as
shown with the TigerLake rt5682 example.

Each configuration updates the card component string, and UCM can test
for the presence of components to configure them as needed.

Since we use a single the machine driver name, all previous ACPI
tables need to be updated. That should have no impact since the
machine drivers listed at the time were not upstreamed and are no
longer maintained.

Naveen Manohar (2):
  ASoC: Intel: common: add match table for TGL RT5682 SoundWire driver
  ASoC: Intel: sof_sdw: Add Volteer support with RT5682 SNDW helper
    function

Pierre-Louis Bossart (1):
  ASoC: Intel: boards: add sof_sdw machine driver

Rander Wang (1):
  ASoC: Intel: soc-acpi: update topology and driver name for SoundWire
    platforms

 sound/soc/intel/boards/Kconfig                |  24 +
 sound/soc/intel/boards/Makefile               |   8 +-
 sound/soc/intel/boards/sof_sdw.c              | 962 ++++++++++++++++++
 sound/soc/intel/boards/sof_sdw_common.h       | 114 +++
 sound/soc/intel/boards/sof_sdw_dmic.c         |  42 +
 sound/soc/intel/boards/sof_sdw_hdmi.c         |  97 ++
 sound/soc/intel/boards/sof_sdw_rt1308.c       | 151 +++
 sound/soc/intel/boards/sof_sdw_rt5682.c       | 126 +++
 sound/soc/intel/boards/sof_sdw_rt700.c        | 125 +++
 sound/soc/intel/boards/sof_sdw_rt711.c        | 156 +++
 sound/soc/intel/boards/sof_sdw_rt715.c        |  42 +
 .../intel/common/soc-acpi-intel-cml-match.c   |  24 +-
 .../intel/common/soc-acpi-intel-icl-match.c   |   6 +-
 .../intel/common/soc-acpi-intel-tgl-match.c   |  30 +-
 14 files changed, 1896 insertions(+), 11 deletions(-)
 create mode 100644 sound/soc/intel/boards/sof_sdw.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_common.h
 create mode 100644 sound/soc/intel/boards/sof_sdw_dmic.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_hdmi.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_rt1308.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_rt5682.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_rt700.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_rt711.c
 create mode 100644 sound/soc/intel/boards/sof_sdw_rt715.c

--
2.20.1
parents acd4946f 798313f2
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -524,4 +524,28 @@ config SND_SOC_INTEL_SOF_DA7219_MAX98373_MACH

endif ## SND_SOC_SOF_JASPERLAKE

if SND_SOC_SOF_INTEL_SOUNDWIRE

config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
	tristate "SoundWire generic machine driver"
	depends on I2C && ACPI
	depends on MFD_INTEL_LPSS || COMPILE_TEST
	depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST
	depends on SOUNDWIRE
	depends on SND_HDA_CODEC_HDMI
	select SND_SOC_RT700_SDW
	select SND_SOC_RT711_SDW
	select SND_SOC_RT1308_SDW
	select SND_SOC_RT1308
	select SND_SOC_RT715_SDW
	select SND_SOC_RT5682_SDW
	select SND_SOC_DMIC
        help
	  Add support for Intel SoundWire-based platforms connected to
	  RT700, RT711, RT1308 and RT715
	  If unsure select "N".

endif


endif ## SND_SOC_INTEL_MACH
+6 −2
Original line number Diff line number Diff line
@@ -31,7 +31,11 @@ snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o hda_dsp_c
snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
snd-soc-sof_da7219_max98373-objs := sof_da7219_max98373.o hda_dsp_common.o

snd-soc-sof-sdw-objs += sof_sdw.o				\
			sof_sdw_rt711.o sof_sdw_rt700.o		\
			sof_sdw_rt1308.o sof_sdw_rt715.o	\
			sof_sdw_rt5682.o			\
			sof_sdw_dmic.o sof_sdw_hdmi.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
obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
@@ -64,4 +68,4 @@ obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max9
obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH) += snd-soc-skl_hda_dsp.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_DA7219_MAX98373_MACH) += snd-soc-sof_da7219_max98373.o
obj-$(CONFIG_SND_SOC_INTEL_SOUNDWIRE_SOF_MACH) += snd-soc-sof-sdw.o
+962 −0

File added.

Preview size limit exceeded, changes collapsed.

+114 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0
 *  Copyright (c) 2020 Intel Corporation
 */

/*
 *  sof_sdw_common.h - prototypes for common helpers
 */

#ifndef SND_SOC_SOF_SDW_COMMON_H
#define SND_SOC_SOF_SDW_COMMON_H

#include <linux/bits.h>
#include <linux/types.h>

#define MAX_NO_PROPS 2
#define MAX_HDMI_NUM 4
#define SDW_DMIC_DAI_ID 4
#define SDW_MAX_CPU_DAIS 16
#define SDW_INTEL_BIDIR_PDI_BASE 2

/* 8 combinations with 4 links + unused group 0 */
#define SDW_MAX_GROUPS 9

enum {
	SOF_RT711_JD_SRC_JD1 = 1,
	SOF_RT711_JD_SRC_JD2 = 2,
};

enum {
	SOF_PRE_TGL_HDMI_COUNT = 3,
	SOF_TGL_HDMI_COUNT = 4,
};

enum {
	SOF_I2S_SSP0 = BIT(0),
	SOF_I2S_SSP1 = BIT(1),
	SOF_I2S_SSP2 = BIT(2),
	SOF_I2S_SSP3 = BIT(3),
	SOF_I2S_SSP4 = BIT(4),
	SOF_I2S_SSP5 = BIT(5),
};

#define SOF_RT711_JDSRC(quirk)		((quirk) & GENMASK(1, 0))
#define SOF_SDW_FOUR_SPK		BIT(2)
#define SOF_SDW_TGL_HDMI		BIT(3)
#define SOF_SDW_PCH_DMIC		BIT(4)
#define SOF_SSP_PORT(x)		(((x) & GENMASK(5, 0)) << 5)
#define SOF_SSP_GET_PORT(quirk)	(((quirk) >> 5) & GENMASK(5, 0))
#define SOF_RT715_DAI_ID_FIX		BIT(11)
#define SOF_SDW_NO_AGGREGATION		BIT(12)

struct sof_sdw_codec_info {
	const int id;
	int amp_num;
	const u8 acpi_id[ACPI_ID_LEN];
	const bool direction[2]; // playback & capture support
	const char *dai_name;
	const struct snd_soc_ops *ops;

	int  (*init)(const struct snd_soc_acpi_link_adr *link,
		     struct snd_soc_dai_link *dai_links,
		     struct sof_sdw_codec_info *info,
		     bool playback);
};

struct mc_private {
	struct list_head hdmi_pcm_list;
	bool common_hdmi_codec_drv;
	struct snd_soc_jack sdw_headset;
};

extern unsigned long sof_sdw_quirk;

/* generic HDMI support */
int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd);

int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card);

/* DMIC support */
int sof_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd);

/* RT711 support */
int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link,
		       struct snd_soc_dai_link *dai_links,
		       struct sof_sdw_codec_info *info,
		       bool playback);

/* RT700 support */
int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
		       struct snd_soc_dai_link *dai_links,
		       struct sof_sdw_codec_info *info,
		       bool playback);

/* RT1308 support */
extern struct snd_soc_ops sof_sdw_rt1308_i2s_ops;

int sof_sdw_rt1308_init(const struct snd_soc_acpi_link_adr *link,
			struct snd_soc_dai_link *dai_links,
			struct sof_sdw_codec_info *info,
			bool playback);

/* RT715 support */
int sof_sdw_rt715_init(const struct snd_soc_acpi_link_adr *link,
		       struct snd_soc_dai_link *dai_links,
		       struct sof_sdw_codec_info *info,
		       bool playback);

/* RT5682 support */
int sof_sdw_rt5682_init(const struct snd_soc_acpi_link_adr *link,
			struct snd_soc_dai_link *dai_links,
			struct sof_sdw_codec_info *info,
			bool playback);

#endif
+42 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Intel Corporation

/*
 *  sof_sdw_dmic - Helpers to handle dmic from generic machine driver
 */

#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include "sof_sdw_common.h"

static const struct snd_soc_dapm_widget dmic_widgets[] = {
	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
};

static const struct snd_soc_dapm_route dmic_map[] = {
	/* digital mics */
	{"DMic", NULL, "SoC DMIC"},
};

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

	ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
					ARRAY_SIZE(dmic_widgets));
	if (ret) {
		dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
		/* Don't need to add routes if widget addition failed */
		return ret;
	}

	ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map,
				      ARRAY_SIZE(dmic_map));

	if (ret)
		dev_err(card->dev, "DMic map addition failed: %d\n", ret);

	return ret;
}
Loading