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

ASoC: use sof_sdw as default Intel SOF SDW machine

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Currently, we create a ACPI mach table for every new audio
configuration. And all Intel SOF SoundWire configurations point to the
same sof_sdw machine driver. Also, we don't need a specific topology for
a coufguration, we can use the function topology instead. That give us a
change to generate an ACPI mach table based on the SoundWire codec
information reported by the ACPI table and use the sof_sdw machine
driver as the default machine driver.
This will reduce the effort to support a new Intel SOF SoundWire audio
configuration.
parents 0b0eb770 97973292
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ struct snd_soc_acpi_endpoint {
 * @name_prefix: string used for codec controls
 */
struct snd_soc_acpi_adr_device {
	const u64 adr;
	const u8 num_endpoints;
	u64 adr;
	u8 num_endpoints;
	const struct snd_soc_acpi_endpoint *endpoints;
	const char *name_prefix;
};
@@ -131,8 +131,8 @@ struct snd_soc_acpi_adr_device {
 */

struct snd_soc_acpi_link_adr {
	const u32 mask;
	const u32 num_adr;
	u32 mask;
	u32 num_adr;
	const struct snd_soc_acpi_adr_device *adr_d;
};

+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ struct asoc_sdw_codec_info {
	const int part_id;
	const int version_id;
	const char *codec_name;
	const char *name_prefix;
	int amp_num;
	const u8 acpi_id[ACPI_ID_LEN];
	const bool ignore_internal_dmic;
@@ -168,6 +169,7 @@ int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int *

struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks,
					       const struct snd_soc_acpi_endpoint *new);
int asoc_sdw_get_dai_type(u32 type);

int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
				 struct asoc_sdw_dailink *soc_dais,
+6 −2
Original line number Diff line number Diff line
@@ -126,11 +126,15 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
		if (!ret) {
			release_firmware(fw);
		} else {
			dev_dbg(card->dev, "Failed to open topology file: %s\n", (*tplg_files)[i]);
			dev_warn(card->dev,
				 "Failed to open topology file: %s, you might need to\n",
				 (*tplg_files)[i]);
			dev_warn(card->dev,
				 "download it from https://github.com/thesofproject/sof-bin/\n");
			return 0;
		}
	}

	return tplg_num;
}
EXPORT_SYMBOL_GPL(sof_sdw_get_tplg_files);
+29 −1
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x700,
		.name_prefix = "rt700",
		.dais = {
			{
				.direction = {true, true},
@@ -95,6 +96,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x711,
		.name_prefix = "rt711",
		.version_id = 3,
		.dais = {
			{
@@ -115,6 +117,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x711,
		.name_prefix = "rt711",
		.version_id = 2,
		.dais = {
			{
@@ -135,6 +138,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x712,
		.name_prefix = "rt712",
		.version_id = 3,
		.dais =	{
			{
@@ -176,6 +180,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x1712,
		.name_prefix = "rt712-dmic",
		.version_id = 3,
		.dais =	{
			{
@@ -190,6 +195,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x713,
		.name_prefix = "rt713",
		.version_id = 3,
		.dais =	{
			{
@@ -217,6 +223,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x1713,
		.name_prefix = "rt713-dmic",
		.version_id = 3,
		.dais =	{
			{
@@ -231,6 +238,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x1308,
		.name_prefix = "rt1308",
		.acpi_id = "10EC1308",
		.dais = {
			{
@@ -253,6 +261,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x1316,
		.name_prefix = "rt1316",
		.dais = {
			{
				.direction = {true, true},
@@ -273,6 +282,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x1318,
		.name_prefix = "rt1318",
		.dais = {
			{
				.direction = {true, true},
@@ -293,6 +303,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x1320,
		.name_prefix = "rt1320",
		.dais = {
			{
				.direction = {true, false},
@@ -313,6 +324,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x714,
		.name_prefix = "rt714",
		.version_id = 3,
		.ignore_internal_dmic = true,
		.dais = {
@@ -328,6 +340,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x715,
		.name_prefix = "rt715",
		.version_id = 3,
		.ignore_internal_dmic = true,
		.dais = {
@@ -343,6 +356,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x714,
		.name_prefix = "rt714",
		.version_id = 2,
		.ignore_internal_dmic = true,
		.dais = {
@@ -358,6 +372,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x715,
		.name_prefix = "rt715",
		.version_id = 2,
		.ignore_internal_dmic = true,
		.dais = {
@@ -373,6 +388,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x721,
		.name_prefix = "rt721",
		.version_id = 3,
		.dais = {
			{
@@ -415,6 +431,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x722,
		.name_prefix = "rt722",
		.version_id = 3,
		.dais = {
			{
@@ -459,6 +476,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x8373,
		.name_prefix = "Left",
		.dais = {
			{
				.direction = {true, true},
@@ -478,6 +496,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x8363,
		.name_prefix = "Left",
		.dais = {
			{
				.direction = {true, false},
@@ -497,6 +516,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x5682,
		.name_prefix = "rt5682",
		.dais = {
			{
				.direction = {true, true},
@@ -514,6 +534,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x3556,
		.name_prefix = "AMP",
		.dais = {
			{
				.direction = {true, false},
@@ -566,6 +587,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x4242,
		.name_prefix = "cs42l42",
		.dais = {
			{
				.direction = {true, true},
@@ -583,6 +605,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x4243,
		.name_prefix = "cs42l43",
		.codec_name = "cs42l43-codec",
		.count_sidecar = asoc_sdw_bridge_cs35l56_count_sidecar,
		.add_sidecar = asoc_sdw_bridge_cs35l56_add_sidecar,
@@ -634,6 +657,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0xaaaa, /* generic codec mockup */
		.name_prefix = "sdw_mockup_mmulti-function",
		.version_id = 0,
		.dais = {
			{
@@ -659,6 +683,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0xaa55, /* headset codec mockup */
		.name_prefix = "sdw_mockup_headset0",
		.version_id = 0,
		.dais = {
			{
@@ -672,6 +697,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x55aa, /* amplifier mockup */
		.name_prefix = "sdw_mockup_amp1",
		.version_id = 0,
		.dais = {
			{
@@ -685,6 +711,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
	},
	{
		.part_id = 0x5555,
		.name_prefix = "sdw_mockup_mic0",
		.version_id = 0,
		.dais = {
			{
@@ -1212,7 +1239,7 @@ struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks
}
EXPORT_SYMBOL_NS(asoc_sdw_find_dailink, "SND_SOC_SDW_UTILS");

static int asoc_sdw_get_dai_type(u32 type)
int asoc_sdw_get_dai_type(u32 type)
{
	switch (type) {
	case SDCA_FUNCTION_TYPE_SMART_AMP:
@@ -1230,6 +1257,7 @@ static int asoc_sdw_get_dai_type(u32 type)
		return -EINVAL;
	}
}
EXPORT_SYMBOL_NS(asoc_sdw_get_dai_type, "SND_SOC_SDW_UTILS");

/*
 * Check if the SDCA endpoint is present by the SDW peripheral
+11 −1
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ static int sof_test_topology_file(struct device *dev,
	if (!profile->tplg_path || !profile->tplg_name)
		return 0;

	/* Dummy topology does not exist and should not be used */
	if (strstr(profile->tplg_name, "dummy"))
		return 0;

	tplg_filename = kasprintf(GFP_KERNEL, "%s/%s", profile->tplg_path,
				  profile->tplg_name);
	if (!tplg_filename)
@@ -266,6 +270,7 @@ static void sof_print_profile_info(struct snd_sof_dev *sdev,
				   enum sof_ipc_type ipc_type,
				   struct sof_loadable_file_profile *profile)
{
	struct snd_sof_pdata *plat_data = sdev->pdata;
	struct device *dev = sdev->dev;

	if (ipc_type != profile->ipc_type)
@@ -282,7 +287,12 @@ static void sof_print_profile_info(struct snd_sof_dev *sdev,

	if (profile->fw_lib_path)
		dev_info(dev, " Firmware lib path: %s\n", profile->fw_lib_path);
	dev_info(dev, " Topology file:     %s/%s\n", profile->tplg_path, profile->tplg_name);

	if (plat_data->machine->get_function_tplg_files && !plat_data->disable_function_topology)
		dev_info(dev, " Topology file:     function topologies\n");
	else
		dev_info(dev, " Topology file:     %s/%s\n",
			 profile->tplg_path, profile->tplg_name);
}

int sof_create_ipc_file_profile(struct snd_sof_dev *sdev,
Loading