Skip to content

Commit 8088a46

Browse files
committed
ASOC: SOF: set clock and power gating ops for SKL+ platforms
Set ops for audio dsp clock and power gating for SKL+ platforms. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent cc636d3 commit 8088a46

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

sound/soc/sof/intel/apl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,6 @@ struct snd_sof_dsp_ops sof_apl_ops = {
103103
.resume = hda_dsp_resume,
104104
.runtime_suspend = hda_dsp_runtime_suspend,
105105
.runtime_resume = hda_dsp_runtime_resume,
106+
.clock_power_gating = hda_dsp_ctrl_clock_power_gating,
106107
};
107108
EXPORT_SYMBOL(sof_apl_ops);

sound/soc/sof/intel/hda-ctrl.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <sound/sof.h>
3030
#include <sound/pcm_params.h>
3131
#include <linux/pm_runtime.h>
32+
#include <sound/hda_register.h>
3233

3334
#include "../sof-priv.h"
3435
#include "../ops.h"
@@ -148,6 +149,24 @@ void hda_dsp_ctrl_misc_clock_gating(struct snd_sof_dev *sdev, bool enable)
148149
snd_sof_pci_update_bits(sdev, PCI_CGCTL, PCI_CGCTL_MISCBDCGE_MASK, val);
149150
}
150151

152+
void hda_dsp_ctrl_clock_power_gating(struct snd_sof_dev *sdev, bool enable)
153+
{
154+
struct hdac_bus *bus = sof_to_bus(sdev);
155+
u32 val;
156+
157+
/* Update PDCGE bit of CGCTL register */
158+
val = enable ? PCI_CGCTL_ADSPDCGE : 0;
159+
snd_sof_pci_update_bits(sdev, PCI_CGCTL, PCI_CGCTL_ADSPDCGE, val);
160+
161+
/* Update L1SEN bit of EM2 register */
162+
val = enable ? SOF_HDA_VS_EM2_L1SEN : 0;
163+
snd_hdac_chip_updatel(bus, VS_EM2, SOF_HDA_VS_EM2_L1SEN, val);
164+
165+
/* Update ADSPPGD bit of PGCTL register */
166+
val = enable ? 0 : PCI_TCSEL_ADSPPGD;
167+
snd_sof_pci_update_bits(sdev, PCI_TCSEL, PCI_TCSEL_ADSPPGD, val);
168+
}
169+
151170
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
152171
/*
153172
* While performing reset, controller may not come back properly and causing

sound/soc/sof/intel/hda.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
#define PCI_TCSEL 0x44
1818
#define PCI_CGCTL 0x48
1919

20+
/* PCI_TVSEL bits */
21+
#define PCI_TCSEL_ADSPPGD BIT(2)
22+
2023
/* PCI_CGCTL bits */
2124
#define PCI_CGCTL_MISCBDCGE_MASK BIT(6)
2225
#define PCI_CGCTL_LSRMD_MASK BIT(4)
26+
#define PCI_CGCTL_ADSPDCGE BIT(1)
2327

2428
/* Legacy HDA registers and bits used - widths are variable */
2529
#define SOF_HDA_GCAP 0x0
@@ -32,6 +36,7 @@
3236
#define SOF_HDA_WAKESTS 0x0E
3337
#define SOF_HDA_WAKESTS_INT_MASK ((1 << 8) - 1)
3438
#define SOF_HDA_RIRBSTS 0x5d
39+
#define SOF_HDA_VS_EM2_L1SEN BIT(13)
3540

3641
/* SOF_HDA_GCTL register bist */
3742
#define SOF_HDA_GCTL_RESET BIT(0)
@@ -490,6 +495,7 @@ int hda_dsp_cl_boot_firmware_skl(struct snd_sof_dev *sdev);
490495
int hda_dsp_ctrl_get_caps(struct snd_sof_dev *sdev);
491496
int hda_dsp_ctrl_link_reset(struct snd_sof_dev *sdev);
492497
void hda_dsp_ctrl_misc_clock_gating(struct snd_sof_dev *sdev, bool enable);
498+
void hda_dsp_ctrl_clock_power_gating(struct snd_sof_dev *sdev, bool enable);
493499
int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev, bool full_reset);
494500

495501
/*

0 commit comments

Comments
 (0)