Skip to content

Conversation

@ujfalusi
Copy link
Collaborator

Hi,

this series will enable the use of the SOF Linux stack without DSP offloading.

In this mode no firmware loading will happen, the topology parsing is going to be reduced to only look for the DAI widget(s) and the IPC dependent callbacks are going to be ignored.

This mode can give another level of hardware verification on platforms where the DSP can be ignored and the audio interfaces can be tested directly.

On Intel platforms we can use this mode to verify programming flows against the legacy HDA stack if there is a need to debug in that level and don't have the DSP programming sequences interfering.

The use of DSPless mode is governed by the SOF_DBG_DSPLESS_MODE flag which is only going to be set if the user sets sof_debg=0x8000 and the platform advertises that the DSPless mode is supported (tested) on them.

@ujfalusi ujfalusi force-pushed the peter/sof/ipc4_work_wip branch from 6b188d7 to fdb9615 Compare October 25, 2022 11:20
@ujfalusi
Copy link
Collaborator Author

Changes since v1:

  • 32bit audio playback works correctly

@ujfalusi
Copy link
Collaborator Author

@jsarha, fyi

@ujfalusi ujfalusi force-pushed the peter/sof/ipc4_work_wip branch 2 times, most recently from 9923c1f to e51a3e2 Compare October 25, 2022 19:45
@plbossart
Copy link
Member

@ujfalusi can we remove the WIP patches?

https://github.com/thesofproject/linux/commit/5457428f0758b05ee705c79ccaaafe29bd0a4694 acpi: HACK: silence the Found %d idle state
https://github.com/thesofproject/linux/commit/bbf0d7beb26eb74c661aaf1c0c542450a65e676c [WIP] snd_soc_acpi_mach link_mask to mach_params.link_mask stuff
https://github.com/thesofproject/linux/commit/8a0c34d80583748ca29818e42c1eb413ce058738 [HACK] ASoC: SOF: ipc4-topology: Load one library for testing
https://github.com/thesofproject/linux/commit/deba7bc78f5471f94a6cc63025057d83203e520f Revert "[HACK] ASoC: SOF: ipc4-topology: Load one library for testing"
https://github.com/thesofproject/linux/commit/45c51d2770a3a49061c565c0d84bd0da5980d1d1 --- Hacks ---
https://github.com/thesofproject/linux/commit/f8679ff00cc4387f6547cc340fcdf53ad677f680 ASoC: SOF: sof-priv: Remove unused SOF_DAI_STREAM() and SOF_FORMATS
https://github.com/thesofproject/linux/commit/cfeefcdb0d6508b2a293a39e8945446abaa44f85 -- misc fixes --
https://github.com/thesofproject/linux/commit/ab2e04d8c7296f05b5150dda0f3d8972cb19332f ALSA: intel-nhlt: Change struct nhlt_acpi_table.desc struct array to u8
https://github.com/thesofproject/linux/commit/26c3ad357c7d2fb4303d5f0e0992dbceaa3f7be6 ALSA: intel-nhlt: Change struct nhlt_fmt.fmt_config struct array to u8
https://github.com/thesofproject/linux/commit/9129c00cfe4f33c825c2511cd03a0952ed484e8c ASoC: SOF: uapi: header: Convert struct sof_manifest.items[] to u8 array
https://github.com/thesofproject/linux/commit/a380f80538e965a87bb95d8ebd0aebc7d4aa1f68 ASoC: SOF: core: Print out the value of sof_debug if it is set
https://github.com/thesofproject/linux/commit/49eefb2c39981192703234182995664960d34a80 -- flex to u8 --

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @ujfalusi, set of cosmetic comments below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in commit title: prepare

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: would the code not be more readable with a boolean flag, e.g. sdev->dspless_selected. I see many many repeats of this 30-odd string, it's a bit of an eyesore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not wanted to introduce a new boolean in sdev, but the clearing of the bit in sof_core_debug might not be a nice thing?
Let me check if there is anything preventing this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment here to explain why we don't have a fixup?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: use a temp pointer and have a single call to tplg_component_load?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is clear enough, I don's see the benefit in this particular case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit message typo:
sof_debug=0x8000

not sure what "supported (tested)" means?
did you mean "the platform
advertises its ability to transfer audio without the DSP enabled" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these empty-brackets or add a comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, remained from debugging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this condition? link_prepared is always set unconditionally

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit title:spurious initial space

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let me check it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BIT(hstream->index) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a code move, but sure, let's do that.

Copy link

@RanderWang RanderWang Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this if, hdev->no_ipc_position would be 0 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably some shared code would try to send IPC? But in any case, since we don't use DSP the ipc_position is not even a possibility.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in dspless mode, which topology will be used ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the ipc_type, works with both IPC3 or IPC4 and there should not be any IPC dependency

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yes, we are loading the topology file to get the DAIs for the PCMs.

@ujfalusi
Copy link
Collaborator Author

@ujfalusi can we remove the WIP patches?

https://github.com/thesofproject/linux/commit/5457428f0758b05ee705c79ccaaafe29bd0a4694 acpi: HACK: silence the Found %d idle state
https://github.com/thesofproject/linux/commit/bbf0d7beb26eb74c661aaf1c0c542450a65e676c [WIP] snd_soc_acpi_mach link_mask to mach_params.link_mask stuff
https://github.com/thesofproject/linux/commit/8a0c34d80583748ca29818e42c1eb413ce058738 [HACK] ASoC: SOF: ipc4-topology: Load one library for testing
https://github.com/thesofproject/linux/commit/deba7bc78f5471f94a6cc63025057d83203e520f Revert "[HACK] ASoC: SOF: ipc4-topology: Load one library for testing"
https://github.com/thesofproject/linux/commit/45c51d2770a3a49061c565c0d84bd0da5980d1d1 --- Hacks ---
https://github.com/thesofproject/linux/commit/f8679ff00cc4387f6547cc340fcdf53ad677f680 ASoC: SOF: sof-priv: Remove unused SOF_DAI_STREAM() and SOF_FORMATS
https://github.com/thesofproject/linux/commit/cfeefcdb0d6508b2a293a39e8945446abaa44f85 -- misc fixes --
https://github.com/thesofproject/linux/commit/ab2e04d8c7296f05b5150dda0f3d8972cb19332f ALSA: intel-nhlt: Change struct nhlt_acpi_table.desc struct array to u8
https://github.com/thesofproject/linux/commit/26c3ad357c7d2fb4303d5f0e0992dbceaa3f7be6 ALSA: intel-nhlt: Change struct nhlt_fmt.fmt_config struct array to u8
https://github.com/thesofproject/linux/commit/9129c00cfe4f33c825c2511cd03a0952ed484e8c ASoC: SOF: uapi: header: Convert struct sof_manifest.items[] to u8 array
https://github.com/thesofproject/linux/commit/a380f80538e965a87bb95d8ebd0aebc7d4aa1f68 ASoC: SOF: core: Print out the value of sof_debug if it is set
https://github.com/thesofproject/linux/commit/49eefb2c39981192703234182995664960d34a80 -- flex to u8 --

I have not removed them??

@ujfalusi ujfalusi force-pushed the peter/sof/ipc4_work_wip branch from e51a3e2 to 3421206 Compare October 26, 2022 07:21
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
This reverts commit 343f1d36f8925206709884a4bd22fa0dabf31d5a.
The following definitions have no users: SOF_DAI_STREAM() and SOF_FORMATS,
they can be dropped from the header file.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The struct nhlt_endpoint is a flexible array, because:
struct nhlt_acpi_table {
	...
	struct nhlt_endpoint desc[] { <- This
		...
		struct nhlt_specific_cfg {
			u32 size;
			u8 caps[]; <- Because of this
		};
	};
};

This causes several notes from sparse as well:
note: in included file:
include/sound/intel-nhlt.h:83:34: warning: array of flexible structures

To help the compiler to understand this, we should convert it to u8 array.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The struct nhlt_fmt_cfg is a flexible array, because:
struct nhlt_fmt {
	...
	struct nhlt_fmt_cfg fmt_config[] { <- This
		...
		struct nhlt_specific_cfg {
			...
			u8 caps[]; <- Because of this
		};
	};
};

Strangely sparse did not complain about this, but it was misused by
drivers, treating it as a normal array and not a flexible one.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The items array member of truct sof_manifest is a flexible array, because:
struct sof_manifest {
	...
	struct sof_manifest_tlv items[] { <- This
		...
		__u8 data[]; << Because of this
	}
};

This causes notes from sparse as well:
note: in included file:
include/uapi/sound/sof/header.h:56:38: warning: array of flexible structures

To help the compiler to understand this, we should convert it to u8 array.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The sof_debug value is set by the user, developer intentionally.
To save time on figuring out what value has been passed to the kernel by
the user, developer, print it out if it is not 0.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Other topology ops have been treated as optional, including the route_free.

Handle the route_setup in a conforming way as optional callback.
Note: we do not have checks for the callbacks itself which makes them all
optional in practice.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The core treats all function pointer in sof_ipc_tplg_ops as optional.
Update the documentation to reflect this.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
In preparation to a case when the DSP is not used.
In this case the IPC communication itself has no meaning and we might
not even have sdev->ipc allocated at all.

The sof_ipc_get_ops() macro can be used to get a named IPC ops struct or
return NULL if the sdev->ipc is not allocated.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.

Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[pcm] == NULL
sdev->ipc->ops->[pcm]->ops == NULL (treated optional currently)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.

Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[tplg] == NULL
sdev->ipc->ops->[tplg]->control == NULL
sdev->ipc->ops->[tplg]->control->ops == NULL (treated optional currently)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.

Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[ops_group] == NULL
sdev->ipc->ops->[pcmops_group]->ops == NULL (treated optional currently)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
ujfalusi and others added 12 commits October 26, 2022 10:21
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.

Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[tplg] == NULL
sdev->ipc->ops->[tplg]->ops == NULL (treated optional currently)

At the same time standardize the naming of the ops pointer to tplg_ops

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.

Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[pm/tplg] == NULL (treated optional for pm currently)
sdev->ipc->ops->[pm/tplg]->ops == NULL (treated optional currently)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The code treats the fw_tracing as optional feature but the documentation
was not reflecting this.
Correct it by explicitly stating that the fw_tracing is optional.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
For the sake of safety use the sof_ipc_get_ops() to fetch the fw_tracing
ops to avoid cases when either sdev->ipc or sdev->ipc->ops might be NULL.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
If the sdev->fw_trace_is_supported is true then we must have the fw_tracing
ops set, no need to check again.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To make sure that a correct target state is determined even if the DSP
failed to boot or the firmware crashed or the suspend happens when the
fw_state is not SOF_FW_BOOT_COMPLETE we must select the correct target
state earlier.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Skip preparing/unpreparing widgets if the swidget pointer is NULL. This
will be true in the case of virtual widgets in topology that were added
for reusing the legacy HDA machine driver with SOF.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
The DSPless mode of the ASoC/SOF driver can be used for hardware
verification and debug on platforms with HDaudio codecs. The DSP mode is
still needed on existing platforms for SSP, DMIC, SoundWire interfaces
managed by the GP-DMA.

This mode is also helpful to compare the legacy HDaudio driver with the
ASoC/SOF driver wrt. codec management and handling. In theory we use the
same code but differences are sometimes seen on jack detection and event
handling.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Via the SOF_DBG_DSPLESS_MODE sof_debug flag the SOF stack can be asked to
not use the DSP for audio.

The core's support for DSPless mode is only going to be enabled if the
platform reports that it can be used without DSP.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Via the SOF_DBG_DSPLESS_MODE sof_debug flag the SOF stack can be asked to
not use the DSP for audio.

The use of DSPless mode is governed by the SOF_DBG_DSPLESS_MODE flag which
is only going to be set if the user sets sof_debg=0x8000 and the platform
advertises that the DSPless mode is supported (tested) on them.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
set the dspless_mode_supported flag to true for tgl family to allow DSPless
mode.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
set the dspless_mode_supported flag to true for apl family to allow DSPless
mode.

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

@ujfalusi can we remove the WIP patches?

https://github.com/thesofproject/linux/commit/5457428f0758b05ee705c79ccaaafe29bd0a4694 acpi: HACK: silence the Found %d idle state
https://github.com/thesofproject/linux/commit/bbf0d7beb26eb74c661aaf1c0c542450a65e676c [WIP] snd_soc_acpi_mach link_mask to mach_params.link_mask stuff
https://github.com/thesofproject/linux/commit/8a0c34d80583748ca29818e42c1eb413ce058738 [HACK] ASoC: SOF: ipc4-topology: Load one library for testing
https://github.com/thesofproject/linux/commit/deba7bc78f5471f94a6cc63025057d83203e520f Revert "[HACK] ASoC: SOF: ipc4-topology: Load one library for testing"
https://github.com/thesofproject/linux/commit/45c51d2770a3a49061c565c0d84bd0da5980d1d1 --- Hacks ---
https://github.com/thesofproject/linux/commit/f8679ff00cc4387f6547cc340fcdf53ad677f680 ASoC: SOF: sof-priv: Remove unused SOF_DAI_STREAM() and SOF_FORMATS
https://github.com/thesofproject/linux/commit/cfeefcdb0d6508b2a293a39e8945446abaa44f85 -- misc fixes --
https://github.com/thesofproject/linux/commit/ab2e04d8c7296f05b5150dda0f3d8972cb19332f ALSA: intel-nhlt: Change struct nhlt_acpi_table.desc struct array to u8
https://github.com/thesofproject/linux/commit/26c3ad357c7d2fb4303d5f0e0992dbceaa3f7be6 ALSA: intel-nhlt: Change struct nhlt_fmt.fmt_config struct array to u8
https://github.com/thesofproject/linux/commit/9129c00cfe4f33c825c2511cd03a0952ed484e8c ASoC: SOF: uapi: header: Convert struct sof_manifest.items[] to u8 array
https://github.com/thesofproject/linux/commit/a380f80538e965a87bb95d8ebd0aebc7d4aa1f68 ASoC: SOF: core: Print out the value of sof_debug if it is set
https://github.com/thesofproject/linux/commit/49eefb2c39981192703234182995664960d34a80 -- flex to u8 --

Right, I did have a clean branch, but by mistake I opened the PR on my WIP branch, I will close this and open a new one, addressing the comments so far.

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.

4 participants