Skip to content

Conversation

@ujfalusi
Copy link
Collaborator

Hi,

this PR contains
#4331
and
#4382

On top of these it implements support for different file layouts per IPC type (for IPC4 to be specific):

/**
 * enum sof_fw_layout_type - pre-defined file-layout for loadable fw files
 * @SOF_FW_LAYOUT_IPC3_SOF:
 *	firmware path:		<vendor>/sof</fw_path_postfix>
 *	firmware name:		sof-<platform>.ri
 *	topology path:		<vendor>/sof-tplg/
 * @SOF_FW_LAYOUT_IPC4_SOF:
 *	firmware path:		<vendor>/sof-ipc4/<platform></fw_path_postfix>
 *	firmware name:		sof-<platform>.ri
 *	firmware lib path:	<vendor>/sof-ipc4-lib/<platform></fw_path_postfix>
 *      topology path:		<vendor>/sof-ipc4-tplg/
 * @SOF_FW_LAYOUT_IPC4_INTEL_ACE:
 *	firmware path:		intel/sof-ipc4/<platform></fw_path_postfix>
 *	firmware name:		sof-<platform>.ri
 *	firmware lib path:	intel/sof-ipc4-lib/<platform></fw_path_postfix>
 *	topology path:		intel/sof-ace-tplg/
 * @SOF_FW_LAYOUT_IPC4_INTEL_AVS:
 *	firmware path:		intel/avs/<platform></fw_path_postfix>
 *	firmware name:		dsp_basefw.bin
 *	firmware lib path:	intel/avs/<platform></fw_path_postfix>
 *	topology path:		intel/avs-tplg/
 */

If IPC4 is selected then the kernel will test the profiles and picks the one which has all the files needed for the board.

on TGL these are the paths:

sof-audio-pci-intel-tgl 0000:00:1f.3: Supported default profiles
sof-audio-pci-intel-tgl 0000:00:1f.3: - ipc type 0 (Fallback):
sof-audio-pci-intel-tgl 0000:00:1f.3:  Firmware layout: SOF IPC3
sof-audio-pci-intel-tgl 0000:00:1f.3:   Firmware file: intel/sof/community/sof-tgl.ri
sof-audio-pci-intel-tgl 0000:00:1f.3:   Topology file: intel/sof-tplg/sof-hda-generic.tplg
sof-audio-pci-intel-tgl 0000:00:1f.3: - ipc type 1 (Requested):
sof-audio-pci-intel-tgl 0000:00:1f.3:  Firmware layout: SOF IPC4
sof-audio-pci-intel-tgl 0000:00:1f.3:   Firmware file: intel/sof-ipc4/tgl/community/sof-tgl.ri
sof-audio-pci-intel-tgl 0000:00:1f.3:   Topology file: intel/sof-ipc4-tplg/sof-hda-generic.tplg
sof-audio-pci-intel-tgl 0000:00:1f.3:  Firmware layout: SOF IPC4 for Intel ACE platforms
sof-audio-pci-intel-tgl 0000:00:1f.3:   Firmware file: intel/sof-ipc4/tgl/community/sof-tgl.ri
sof-audio-pci-intel-tgl 0000:00:1f.3:   Topology file: intel/sof-ace-tplg/sof-hda-generic.tplg
sof-audio-pci-intel-tgl 0000:00:1f.3:  Firmware layout: Intel AVS IPC4
sof-audio-pci-intel-tgl 0000:00:1f.3:   Firmware file: intel/avs/tgl/community/dsp_basefw.bin
sof-audio-pci-intel-tgl 0000:00:1f.3:   Topology file: intel/avs-tplg/sof-hda-generic.tplg

Move the sof_of_machine_select() function to sof-of-dev.c file and provide
an inline stub in case of non OF builds.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Relocate the machine handling functions from sof-audio.c to core.c to
maintain code separation.

While doing the move, drop the redundant
IS_ERR_OR_NULL(plat_data->pdev_mach) check from
sof_machine_unregister()

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add a struct sof_loadable_file_profile which can be filled by platforms
(sof-acpi-dev.c, sof-of-dev.c and sof-acpi-dev.c) to be able to use common,
generic code to handle path customization.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Store the default IPC type and the firmware and topology path overrides to
ipc_file_profile_base

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Store the default IPC type and the firmware and topology path overrides to
ipc_file_profile_base

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Store the default IPC type and the overrides to ipc_file_profile_base

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Use the information stored in ipc_file_profile_base by platforms to
construct the paths, filenames that are going to be used to load the
firmware and topology files.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The core is now using the information from ipc_file_profile_base to create
the paths for the loadable files, no need to set it in here anymore.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The core is now using the information from ipc_file_profile_base to create
the paths for the loadable files, no need to set it in here anymore.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The core is now using the information from ipc_file_profile_base to create
the paths for the loadable files, no need to set it in here anymore.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add sof_init_environment() as a helper function to contain path and ops
initialization.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
… missing

If a firmware file is missing for the selected IPC type then try to switch
to other supported IPC type and check if that one can be used instead.

If for example a platform is changed to IPC4 as default version but the
given machine does not yet have the needed topology file created then we
will fall back to IPC3 which should have all the needed files.

Relocate the sof_init_environment() to be done at a later phase, in
sof_probe_continue().

This will only have changes in behavior if
CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE is enabled (Intel HDA platforms) by
not failing the module probe, but it is not going to be different case
compared to for example failed firmware booting or topology loading error.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Manage the ipc4_data allocation in code instead of devm since the ops_init
might be called more than once due to IPC type fallback.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…4_data

Manage the ipc4_data allocation in code instead of devm since the ops_init
might be called more than once due to IPC type fallback.

This needs to be squashed for upstreaming if the ipc type fallback is
sent earlier.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…ions

With the SND_SOC_SOF_ALLOW_FALLBACK_TO_NEWER_IPC_VERSION the IPC version
fallback behavior can be modified.
If it is not enabled (default) then the fallback only considers older and
supported IPC version
If it is enabled then all supported IPC version (even newer ones) will be
tested and if conditions met, will be selected.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The currently used paths and firmware name reflects the reference firmware
convention:

default_fw_path:     intel/avs/{platform_name}
default_lib_path:    intel/avs-lib/{platform_name}
default_tplg_path:   intel/avs-tplg
default_fw_filename: dsp_basefw.bin

The SOF supports building the firmware for cAVS2.5 platforms using IPC4 and
it is the preferred IPC4 implementation to be used on these devices.

Change the paths and firmware names to reflect this:

default_fw_path:     intel/sof-ipc4/{platform_name}
default_lib_path:    intel/sof-ipc4-lib/{platform_name}
default_tplg_path:   intel/sof-ipc4-tplg
default_fw_filename: sof-{platform_name}.ri

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
All three platform described by pci-cnl.c (CNL, CFL and CML) uses the same
firmware image (sof-cnl.ri).
Packaging is handling the different file names by using symbolic links:
sof-cfl.ri -> sof-cnl.ri
sof-cml.ri -> sof-cnl.ri

For IPC4 the firmware and lib path should be:
intel/avs/cfl -> intel/avs/cnl
intel/avs-lib/cfl -> intel/avs-lib/cnl

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add two identification strings to the device descriptor:
name of the vendor (amd, imx, intel, mediatek),
name of the platform (apl, tgl, rmb, imx8, mt8188, etc).

These strings will be used to construct the paths and file names to be
used for loading firmware files (DSP firmware, topologies, firmware
libraries).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Set the vendor and platform names in sof_dev_desc, which will be used to
create the default firmware layout profile paths and firmware name.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Set the vendor and platform names in sof_dev_desc, which will be used to
create the default firmware layout profile paths and firmware name.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Set the vendor and platform names in sof_dev_desc, which will be used to
create the default firmware layout profile paths and firmware name.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…tors

Set the vendor and platform names in sof_dev_desc, which will be used to
create the default firmware layout profile paths and firmware name.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The current way of setting the default paths and file names for firmware
files are to have strings in the sof_dev_desc struct for the each supported
IPC version and for each platform.

For IPC3 we have a standard pattern among vendors and platforms:
firmware path:		<vendor>/sof</fw_path_postfix>
firmware name:		sof-<platform>.ri
topology path:		<vendor>/sof-tplg/

With IPC4 we have three pattern variations:
SOF generic:
firmware path:		<vendor>/sof-ipc4/<platform></fw_path_postfix>
firmware name:		sof-<platform>.ri
firmware lib path:	<vendor>/sof-ipc4-lib/<platform></fw_path_postfix>
topology path:		<vendor>/sof-ipc4-tplg/

SOF for Intel ACE platforms:
firmware path:		intel/sof-ipc4/<platform></fw_path_postfix>
firmware name:		sof-<platform>.ri
firmware lib path:	intel/sof-ipc4-lib/<platform></fw_path_postfix>
topology path:		intel/sof-ace-tplg/

Intel ACE firmware:
firmware path:		intel/avs/<platform></fw_path_postfix>
firmware name:		dsp_basefw.bin
firmware lib path:	intel/avs/<platform></fw_path_postfix>
topology path:		intel/avs-tplg/

With the 'vendor' and 'platform' string provided in sof_dev_desc we can
generate any of these layouts and we can even pick the one which is
available on the filesystem without a need to provide kernel parameters or
modify the kernel.

It can ease up moving to a new layout while providing backwards
compatibility with existing sof-bin packages in case of IPC4.

Moving the current Intel ACE layout to a generic IPC4 layout would be easy
since the kernel will just figure out that now the files are in a differnt
directory (the tplg files).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…descriptor

The core no longer uses the default_fw_path, default_tplg_path and
default_fw_filename.
The paths and filename is created based on the vendor and platform strings.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…descriptor

The core no longer uses the default_fw_path, default_tplg_path and
default_fw_filename.
The paths and filename is created based on the vendor and platform strings.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…m descriptor

The core no longer uses the default_fw_path, default_tplg_path and
default_fw_filename.
The paths and filename is created based on the vendor and platform strings.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…from descriptor

The core no longer uses the default_fw_path, default_tplg_path and
default_fw_filename.
The paths and filename is created based on the vendor and platform strings.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…re name

The default_fw_path, default_tplg_path, default_lib_path and
default_fw_filename are no longer used, they can be removed from
sof_dev_desc.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@plbossart
Copy link
Member

@ujfalusi do you mind closing obsolete PRs, I can't keep up with 4 PRs on the same topics. Thanks!

@ujfalusi
Copy link
Collaborator Author

@ujfalusi do you mind closing obsolete PRs, I can't keep up with 4 PRs on the same topics. Thanks!

This draft PR contains 3 topics:
#4331: IPC type fallback support - ability to switch back to IPC3 in case IPC4 files are missing
#4382: Fix the incorrect firmware and topology path/names for CAV2.5 family (the avs path is no longer valid for these)
The new patches on top of the two PRs: support for different layouts per IPC type which is mainly targeting IPC4 and it will allow the kernel to seamlessly discover the layout of the IPC4 supported machine. This is going to help a lot with CAV2.5 and ACE family.

Both of the open PRs received(ing) quite a bit of pushback, the new stuff in the draft will cause even more eyebrows to be lifted.

But, if you think that these should be combined then I can close the other two, but I would like to have the #4382 merged separately to be able to send ti upstream asap.

@plbossart
Copy link
Member

I can't review 4 PRs that look similar, it's just confusing. It was already confusing and review fatigue hit 2 months ago already.

@ujfalusi
Copy link
Collaborator Author

I can't review 4 PRs that look similar, it's just confusing. It was already confusing and review fatigue hit 2 months ago already.

OK, let me close this and I will open this when the other two is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants