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

ASoC: SOF: Intel/IPC4: Support for external firmware libraries

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

In IPC4 all DSP loadable executable is a 'library' containing modules. The main
or basefw is also a library which contains multiple modules.
IPC4 allows to use loadable libraries to extend the functionality of the booted
basefw.

This series adds support for loading external libraries in case they are needed
by the loaded topology file.

The libraries must be placed to a specific firmware directory (fw_lib_prefix),
which is:
intel/avs-lib|sof-ipc4-lib/ followed by the platform name and in case of
community key use a 'community' directory.

For example for upx-i11 (community key): intel/avs-lib/tgl/community is the
default path.

The name of the library should be the UUID of the module it contains since the
library loading is going to look for the file as <module_UUID>.bin
In case there is a need to bundle multiple modules into single library, symlinks
can be used to point to the file:

module_boundle.bin
<UUID1>.bin -> module_boundle.bin
<UUID2>.bin -> module_boundle.bin
<UUID3>.bin -> module_boundle.bin

But note that in this case all modules will be loaded to the DSP since only the
whole library can be loaded, not individual modules.
parents d41a7d87 73c091a2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ void asoc_simple_convert_fixup(struct asoc_simple_data *data,
				      struct snd_pcm_hw_params *params);
void asoc_simple_parse_convert(struct device_node *np, char *prefix,
			       struct asoc_simple_data *data);
bool asoc_simple_is_convert_required(const struct asoc_simple_data *data);

int asoc_simple_parse_routing(struct snd_soc_card *card,
				      char *prefix);
+5 −5
Original line number Diff line number Diff line
@@ -59,15 +59,11 @@ enum sof_ipc_type {
 * SOF Platform data.
 */
struct snd_sof_pdata {
	const struct firmware *fw;
	const char *name;
	const char *platform;

	struct device *dev;

	/* indicate how many first bytes shouldn't be loaded into DSP memory. */
	size_t fw_offset;

	/*
	 * notification callback used if the hardware initialization
	 * can take time or is handled in a workqueue. This callback
@@ -86,6 +82,9 @@ struct snd_sof_pdata {
	const char *tplg_filename_prefix;
	const char *tplg_filename;

	/* loadable external libraries available under this directory */
	const char *fw_lib_prefix;

	/* machine */
	struct platform_device *pdev_mach;
	const struct snd_soc_acpi_mach *machine;
@@ -131,8 +130,9 @@ struct sof_dev_desc {
	unsigned int ipc_supported_mask;
	enum sof_ipc_type ipc_default;

	/* defaults paths for firmware and topology files */
	/* defaults paths for firmware, library and topology files */
	const char *default_fw_path[SOF_IPC_TYPE_COUNT];
	const char *default_lib_path[SOF_IPC_TYPE_COUNT];
	const char *default_tplg_path[SOF_IPC_TYPE_COUNT];

	/* default firmware name */
+4 −0
Original line number Diff line number Diff line
@@ -185,6 +185,10 @@ enum sof_ipc4_pipeline_state {
#define SOF_IPC4_GLB_PIPE_STATE_MASK		GENMASK(15, 0)
#define SOF_IPC4_GLB_PIPE_STATE(x)		((x) << SOF_IPC4_GLB_PIPE_STATE_SHIFT)

/* load library ipc msg */
#define SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID_SHIFT	16
#define SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID(x)	((x) << SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID_SHIFT)

enum sof_ipc4_channel_config {
	/* one channel only. */
	SOF_IPC4_CHANNEL_CONFIG_MONO,
+14 −0
Original line number Diff line number Diff line
@@ -45,6 +45,20 @@ static struct snd_soc_card acp6x_card = {
};

static const struct dmi_system_id yc_acp_quirk_table[] = {
	{
		.driver_data = &acp6x_card,
		.matches = {
			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_NAME, "21D0"),
		}
	},
	{
		.driver_data = &acp6x_card,
		.matches = {
			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_NAME, "21D1"),
		}
	},
	{
		.driver_data = &acp6x_card,
		.matches = {
+1 −1
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@ static const struct snd_soc_dapm_route jz4725b_codec_dapm_routes[] = {

	{"Mixer to ADC", NULL, "Mixer"},
	{"ADC Source Capture Route", "Mixer", "Mixer to ADC"},
	{"ADC Sourc Capture Routee", "Line In", "Line In"},
	{"ADC Source Capture Route", "Line In", "Line In"},
	{"ADC Source Capture Route", "Mic 1", "Mic 1"},
	{"ADC Source Capture Route", "Mic 2", "Mic 2"},
	{"ADC", NULL, "ADC Source Capture Route"},
Loading