-
Notifications
You must be signed in to change notification settings - Fork 139
Audio DSP power gating and clock gating enable #247
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,13 @@ | |
| #define PCI_TCSEL 0x44 | ||
| #define PCI_CGCTL 0x48 | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to correct naming of these 2 registers: |
||
| /* PCI_TVSEL bits */ | ||
| #define PCI_TCSEL_ADSPPGD BIT(2) | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename this to PCI_PGCTL_ADSPPGD |
||
| /* PCI_CGCTL bits */ | ||
| #define PCI_CGCTL_MISCBDCGE_MASK BIT(6) | ||
| #define PCI_CGCTL_LSRMD_MASK BIT(4) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this bit should be PGCTL one, rename and move it to group /* PCI_PGCTL bits */
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, that will avoid confusion! |
||
| #define PCI_CGCTL_ADSPDCGE BIT(1) | ||
|
|
||
| /* Legacy HDA registers and bits used - widths are variable */ | ||
| #define SOF_HDA_GCAP 0x0 | ||
|
|
@@ -32,6 +36,7 @@ | |
| #define SOF_HDA_WAKESTS 0x0E | ||
| #define SOF_HDA_WAKESTS_INT_MASK ((1 << 8) - 1) | ||
| #define SOF_HDA_RIRBSTS 0x5d | ||
| #define SOF_HDA_VS_EM2_L1SEN BIT(13) | ||
|
|
||
| /* SOF_HDA_GCTL register bist */ | ||
| #define SOF_HDA_GCTL_RESET BIT(0) | ||
|
|
@@ -490,6 +495,7 @@ int hda_dsp_cl_boot_firmware_skl(struct snd_sof_dev *sdev); | |
| int hda_dsp_ctrl_get_caps(struct snd_sof_dev *sdev); | ||
| int hda_dsp_ctrl_link_reset(struct snd_sof_dev *sdev); | ||
| void hda_dsp_ctrl_misc_clock_gating(struct snd_sof_dev *sdev, bool enable); | ||
| void hda_dsp_ctrl_clock_power_gating(struct snd_sof_dev *sdev, bool enable); | ||
| int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev, bool full_reset); | ||
|
|
||
| /* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,7 @@ struct snd_sof_dsp_ops { | |
| int (*resume)(struct snd_sof_dev *sof_dev); | ||
| int (*runtime_suspend)(struct snd_sof_dev *sof_dev, int state); | ||
| int (*runtime_resume)(struct snd_sof_dev *sof_dev); | ||
| void (*clock_power_gating)(struct snd_sof_dev *sof_dev, bool enable); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should name this a little more generic so we can handle more than just clocks. It does look like here we are entering an idle state ? If so snd_sof_dsp_idle(sdev, bool idle) . Please also don't name the variable
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood we are enabling clock gating and power for the audio DSP here i.e. the HW can power gate when it is idle. So calling it idle would be misleading as typically in the context of power management, idle would indicate we are decrementing the ref count.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranj063 is the DSP HW in D3 state here when we gate the clocks ?If so, shouldn't this be part of suspend/resume calls at the HW abstraction level.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranj063 I am also not clear on the DSP state. If you do power gating why do you need clock gating? Isn't it more when you are in D0 (or D0ix) that you allow the clocks to be gated to allow parts of the hardware to save power?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@lgirdwood the HW is not in D3 here. And we not performing power gating or clock gating here either. We are just enabling them meaning that we are indicating to the HW that if the audio dsp is idle, it should be clocked gated and power gated. When the audio device is idle and in D3, these bits will enable the HW to power gate/clock gate. Before we boot the firmware, we disable power gating during dsp probe. So if we dont re-enable it, I think we will never be able to power gate the audio dsp.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@plbossart we are just enabling the HW to be able to do clock gating and power gating here. The dsp is not in D3 after these bits are set. But when an opportunity arises the HW will do the needful if these bits are set.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood @plbossart btw i didnt invent anything new here. I just copied it from the skylake driver. We seem to have missed this sequence earlier.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranj063 ok, so setting these bits allows the HW to opportunistically gate clocks/PM resources when the FW is idle after boot is complete ? If so, should probably be part of the existing HW abstraction ops for fw ready and boot ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood thats correct. I think it makes sense to make it part of the "run" ops. Let me make the change. |
||
|
|
||
| /* DSP clocking */ | ||
| int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq); | ||
|
|
||
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 think this is opposite for PCI_TCSEL_ADSPPGD?
Be careful that some bits are gating disable(e.g. ADSPPGD), some others are gating enable(e.g. PCI_CGCTL_ADSPDCGE), we need to handle them carefully.
Uh oh!
There was an error while loading. Please reload this page.
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.
@keyonjie yes, but the code does the right thing here. When we want to enable clock and power gating we write 1 to PCI_CGCTL_ADSPDCGE in CGCTL and write 0 to PCI_PGCTL BIT(2).