-
Notifications
You must be signed in to change notification settings - Fork 140
Enable ipc4 d0i3 setting #3928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable ipc4 d0i3 setting #3928
Conversation
6169058 to
294ce04
Compare
3c657d9 to
5de3e7a
Compare
|
SOFCI TEST |
|
@plbossart @ujfalusi @ranj063 could you help to review this PR ? Thanks! |
f9595ee to
c714320
Compare
plbossart
left a comment
There was a problem hiding this 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.
427bc51 to
f16a81c
Compare
|
In my test the different order get
the same result on MTL. Since pmc driver on mtl is not ready so we can't
make any conclusion. Two month ago, I discussed with keyon about d0i3
register setting in host and have a same idea that: d0i3 register is
only a notification for pmc, not a switch to enable or disable.
According to spec, the power saving is mainly done in audio hw
component, not by pmc. It is possible that the order doesn't matter even
pmc driver is ready. But the order in this PR is comfortable to me.
From what I remember of my younger days, the drivers can signal to PMC
they are 'D0i3' ready. The PMC may or may not make the transition,
depending on other factors.
If we don't have any evidence that the order matters, then we should
keep the existing code as is. "If it ain't broke don't fix it".
|
f16a81c to
a93ee35
Compare
ranj063
left a comment
There was a problem hiding this 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.
sure, thanks! |
sound/soc/sof/sof-priv.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is "pm gate"?
There was a problem hiding this comment.
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));
}There was a problem hiding this comment.
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
left a comment
There was a problem hiding this 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?
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>
30189ab
a93ee35 to
30189ab
Compare
|
updated to use new sof_ipc_get_ops() to get pm ops |
plbossart
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
@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) |
There was a problem hiding this comment.
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.
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