Skip to content

Conversation

@RanderWang
Copy link

Add support of d0i3 setting for ipc4

Tested on ADL and MTL RVP, IPC msg was successful and no error was found. To fully validate d0i3 effect we need to prepare a mature environment to check power state

@RanderWang RanderWang force-pushed the ipc4_d0i3_setting branch 2 times, most recently from 6169058 to 294ce04 Compare October 14, 2022 12:15
@RanderWang RanderWang force-pushed the ipc4_d0i3_setting branch 2 times, most recently from 3c657d9 to 5de3e7a Compare October 17, 2022 07:12
@RanderWang
Copy link
Author

SOFCI TEST

@RanderWang RanderWang requested a review from ujfalusi October 19, 2022 08:31
@RanderWang
Copy link
Author

@plbossart @ujfalusi @ranj063 could you help to review this PR ? Thanks!

@RanderWang RanderWang force-pushed the ipc4_d0i3_setting branch 2 times, most recently from f9595ee to c714320 Compare October 24, 2022 08:06
@RanderWang
Copy link
Author

@ujfalusi @bardliao updated, thanks for your comments!

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.

The order of patches doesn't seem quite right, the logic of the D0i3 streaming is still odd to me, and last I don't get what the D0I3C/IPC order should be.

@plbossart
Copy link
Member

plbossart commented Nov 3, 2022 via email

ranj063
ranj063 previously approved these changes Nov 4, 2022
Copy link
Collaborator

@ranj063 ranj063 left a comment

Choose a reason for hiding this comment

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

Thanks @RanderWang . Just a word of caution that if #3986 gets merged first which it looks it will, you will have to use the new ops lookup function that @ujfalusi has introduced in this PR after the rebase.

@RanderWang
Copy link
Author

Thanks @RanderWang . Just a word of caution that if #3986 gets merged first which it looks it will, you will have to use the new ops lookup function that @ujfalusi has introduced in this PR after the rebase.

sure, thanks!

bardliao
bardliao previously approved these changes Nov 4, 2022
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is "pm gate"?

Copy link
Author

Choose a reason for hiding this comment

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

I don't know the exactly meaning. It is used for a long time

static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
{
	struct sof_ipc_pm_gate pm_gate;
	struct sof_ipc_reply reply;

	memset(&pm_gate, 0, sizeof(pm_gate));

	/* configure pm_gate ipc message */
	pm_gate.hdr.size = sizeof(pm_gate);
	pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
	pm_gate.flags = flags;

	/* send pm_gate ipc to dsp */
	return sof_ipc_tx_message_no_pm(sdev->ipc, &pm_gate, sizeof(pm_gate),
					&reply, sizeof(reply));
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

The terminology comes form the firmware which uses the flags to determine which SRAMS to pwoer gate or not depending on whats active

ujfalusi
ujfalusi previously approved these changes Nov 4, 2022
Copy link
Collaborator

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

@RanderWang, tentatively approved.
Can you answer the hda_dsp_d0i3_streaming_applicable() vs snd_sof_dsp_only_d0i3_compatible_stream_active()

What is the expectation if we have a single d0i3 compatible capture running without any playback? Does that should be allowed?

@RanderWang
Copy link
Author

@RanderWang, tentatively approved. Can you answer the hda_dsp_d0i3_streaming_applicable() vs snd_sof_dsp_only_d0i3_compatible_stream_active()

What is the expectation if we have a single d0i3 compatible capture running without any playback? Does that should be allowed?

we have D0i3-hotwording (capture), which works WITHOUT any host DMA transfers while in D0i3, and D0i3-streaming (playback with deep buffer) which requires host DMA transfers to work in D0i3 - albeit in bursts. They share the pm setting except host dma . snd_sof_dsp_only_d0i3_compatible_stream_active is to check whether audio hardware can enter d0i3 state, hda_dsp_d0i3_streaming_applicable is checking whether audio hardware can enter d0i3 state with host dma enabled.

we can have a single d0i3 compatible capture without playback, keyword detection. This is a feature enabled on TGL.

Set_pm_gate depends on ipc version. This patch defines
the ops for both IPC3 and IPC4.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Use set_pm_gate to unify pm gate setting for different
ipc version.

Signed-off-by: Rander Wang <rander.wang@intel.com>
The driver shall update the power state to D0i0 before sending
a generic IPC. Power-related IPCs are the exception to the rule,
they may be sent even when the power-state is D0i3

Signed-off-by: Rander Wang <rander.wang@intel.com>
Schedule a delayed work for d0i3 entry after every non-pm ipc msg.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Enable d0i3 streaming if all the active streams can
work in d0i3 state and playback is enabled.

Signed-off-by: Rander Wang <rander.wang@intel.com>
@RanderWang RanderWang dismissed stale reviews from ujfalusi, bardliao, and ranj063 via 30189ab November 7, 2022 05:50
@RanderWang
Copy link
Author

updated to use new sof_ipc_get_ops() to get pm ops

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.

only 2 comments, which can both be addressed with a fixup! PR. I think it's good enough for now.

return sof_ipc3_ctx_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
}

static int sof_ipc3_set_pm_gate(struct snd_sof_dev *sdev, u32 flags)
Copy link
Member

Choose a reason for hiding this comment

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

maybe rename to 'set_pm_gate_flags' - which seems to be a better definition of what the functions actually do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It does a bit more than setting flags, it sends the message to firmware to set the 'pm_gate' and the state is described by the 'flags' parameter.
It is more like 'pm_gate_params' if we want to be so generic.

@plbossart
Copy link
Member

@ujfalusi any comments?

return sof_ipc3_ctx_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
}

static int sof_ipc3_set_pm_gate(struct snd_sof_dev *sdev, u32 flags)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It does a bit more than setting flags, it sends the message to firmware to set the 'pm_gate' and the state is described by the 'flags' parameter.
It is more like 'pm_gate_params' if we want to be so generic.

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.

5 participants