Skip to content

Commit 18baa47

Browse files
committed
DMIC: Enable power for DMIC for ICL platform.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
1 parent e101263 commit 18baa47

9 files changed

Lines changed: 55 additions & 0 deletions

File tree

src/drivers/intel/cavs/dmic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,8 @@ static int dmic_probe(struct dai *dai)
14501450
if (dai_get_drvdata(dai))
14511451
return -EEXIST; /* already created */
14521452

1453+
/* Enable DMIC power */
1454+
pm_runtime_get_sync(DMIC_POW, dai->index);
14531455
/* Disable dynamic clock gating for dmic before touching any reg */
14541456
pm_runtime_get_sync(DMIC_CLK, dai->index);
14551457

@@ -1482,6 +1484,8 @@ static int dmic_remove(struct dai *dai)
14821484
interrupt_unregister(dmic_irq(dai));
14831485

14841486
pm_runtime_put_sync(DMIC_CLK, dai->index);
1487+
/* Disable DMIC power */
1488+
pm_runtime_put_sync(DMIC_POW, dai->index);
14851489

14861490
rfree(dma_get_drvdata(dai));
14871491
dai_set_drvdata(dai, NULL);

src/include/sof/pm_runtime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum pm_runtime_context {
6262
PM_RUNTIME_HOST_DMA_L1 = 0, /**< Host DMA L1 Exit */
6363
SSP_CLK, /**< SSP Clock */
6464
DMIC_CLK, /**< DMIC Clock */
65+
DMIC_POW, /**< DMIC Power */
6566
DW_DMAC_CLK /**< DW DMAC Clock */
6667
};
6768

src/platform/cannonlake/include/platform/memory.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
#define SHIM_BASE 0x00071F00
4343
#define SHIM_SIZE 0x00000100
4444

45+
/* Digital Mic Shim Registers */
46+
#define DMIC_SHIM_BASE 0x00071E80
47+
#define DMICLCTL_OFFSET 0x04
48+
#define DMICLCTL (DMIC_SHIM_BASE + DMICLCTL_OFFSET)
49+
4550
/* cmd IO to audio codecs */
4651
#define CMD_BASE 0x00001100
4752
#define CMD_SIZE 0x00000010

src/platform/cannonlake/include/platform/shim.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
#define DMWBA_ENABLE (1 << 0)
234234
#define DMWBA_READONLY (1 << 1)
235235

236+
/* DMIC power ON bit */
237+
#define DMICLCTL_SPA ((uint32_t) BIT(0))
238+
236239
#ifndef ASSEMBLY
237240

238241
static inline uint16_t shim_read16(uint16_t reg)

src/platform/icelake/include/platform/memory.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
#define SHIM_BASE 0x00071F00
4343
#define SHIM_SIZE 0x00000100
4444

45+
/* Digital Mic Shim Registers */
46+
#define DMIC_SHIM_BASE 0x00071E80
47+
#define DMICLCTL_OFFSET 0x04
48+
#define DMICLCTL (DMIC_SHIM_BASE + DMICLCTL_OFFSET)
49+
4550
/* cmd IO to audio codecs */
4651
#define CMD_BASE 0x00001100
4752
#define CMD_SIZE 0x00000010

src/platform/icelake/include/platform/shim.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
#define DMWBA_ENABLE (1 << 0)
234234
#define DMWBA_READONLY (1 << 1)
235235

236+
/* DMIC power ON bit */
237+
#define DMICLCTL_SPA ((uint32_t) BIT(0))
238+
236239
#ifndef ASSEMBLY
237240

238241
static inline uint16_t shim_read16(uint16_t reg)

src/platform/intel/cavs/pm_runtime.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,27 @@ static inline void cavs_pm_runtime_en_dmic_clk_gating(uint32_t index)
123123
index, shim_read(SHIM_CLKCTL));
124124
#endif
125125
}
126+
static inline void cavs_pm_runtime_en_dmic_power(uint32_t index)
127+
{
128+
(void) index;
129+
#if defined(CONFIG_CANNONLAKE) || defined(CONFIG_ICELAKE) \
130+
|| defined(CONFIG_SUECREEK)
131+
/* Enable DMIC power */
132+
io_reg_write(DMICLCTL,
133+
(io_reg_read(DMICLCTL) | DMICLCTL_SPA));
134+
#endif
135+
}
136+
static inline void cavs_pm_runtime_dis_dmic_power(uint32_t index)
137+
{
138+
(void) index;
139+
#if defined(CONFIG_CANNONLAKE) || defined(CONFIG_ICELAKE) \
140+
|| defined(CONFIG_SUECREEK)
141+
/* Disable DMIC power */
142+
io_reg_write(DMICLCTL,
143+
(io_reg_read(DMICLCTL) & (~DMICLCTL_SPA)));
126144
#endif
145+
}
146+
#endif /* #if defined(CONFIG_DMIC) */
127147

128148
static inline void cavs_pm_runtime_dis_dwdma_clk_gating(uint32_t index)
129149
{
@@ -171,6 +191,9 @@ void platform_pm_runtime_get(enum pm_runtime_context context, uint32_t index,
171191
case DMIC_CLK:
172192
cavs_pm_runtime_dis_dmic_clk_gating(index);
173193
break;
194+
case DMIC_POW:
195+
cavs_pm_runtime_en_dmic_power(index);
196+
break;
174197
#endif
175198
case DW_DMAC_CLK:
176199
cavs_pm_runtime_dis_dwdma_clk_gating(index);
@@ -194,6 +217,9 @@ void platform_pm_runtime_put(enum pm_runtime_context context, uint32_t index,
194217
case DMIC_CLK:
195218
cavs_pm_runtime_en_dmic_clk_gating(index);
196219
break;
220+
case DMIC_POW:
221+
cavs_pm_runtime_dis_dmic_power(index);
222+
break;
197223
#endif
198224
case DW_DMAC_CLK:
199225
cavs_pm_runtime_en_dwdma_clk_gating(index);

src/platform/suecreek/include/platform/memory.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
#define SHIM_BASE 0x00071F00
4343
#define SHIM_SIZE 0x00000100
4444

45+
/* Digital Mic Shim Registers */
46+
#define DMIC_SHIM_BASE 0x00071E80
47+
#define DMICLCTL_OFFSET 0x04
48+
#define DMICLCTL (DMIC_SHIM_BASE + DMICLCTL_OFFSET)
49+
4550
/* cmd IO to audio codecs */
4651
#define CMD_BASE 0x00001100
4752
#define CMD_SIZE 0x00000010

src/platform/suecreek/include/platform/shim.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
#define DMWBA_ENABLE (1 << 0)
234234
#define DMWBA_READONLY (1 << 1)
235235

236+
/* DMIC power ON bit */
237+
#define DMICLCTL_SPA ((uint32_t) BIT(0))
238+
236239
#ifndef ASSEMBLY
237240

238241
static inline uint16_t shim_read16(uint16_t reg)

0 commit comments

Comments
 (0)