sound/soc/intel/avs/mtl.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/mtl.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/mtl.c- Extension
.c- Size
- 6279 bytes
- Lines
- 202
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sound/hdaudio_ext.havs.hdebug.hregisters.htrace.h
Detected Declarations
function Copyrightfunction avs_mtl_core_power_offfunction avs_mtl_core_powerfunction avs_mtl_core_resetfunction avs_mtl_core_stallfunction avs_mtl_ipc_interruptfunction avs_mtl_dsp_interruptfunction avs_mtl_interrupt_control
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright(c) 2021-2025 Intel Corporation
*
* Authors: Cezary Rojewski <cezary.rojewski@intel.com>
* Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
*/
#include <sound/hdaudio_ext.h>
#include "avs.h"
#include "debug.h"
#include "registers.h"
#include "trace.h"
#define MTL_HfDSSGBL_BASE 0x1000
#define MTL_REG_HfDSSCS (MTL_HfDSSGBL_BASE + 0x0)
#define MTL_HfDSSCS_SPA BIT(16)
#define MTL_HfDSSCS_CPA BIT(24)
#define MTL_DSPCS_BASE 0x178D00
#define MTL_REG_DSPCCTL (MTL_DSPCS_BASE + 0x4)
#define MTL_DSPCCTL_SPA BIT(0)
#define MTL_DSPCCTL_CPA BIT(8)
#define MTL_DSPCCTL_OSEL GENMASK(25, 24)
#define MTL_DSPCCTL_OSEL_HOST BIT(25)
#define MTL_HfINT_BASE 0x1100
#define MTL_REG_HfINTIPPTR (MTL_HfINT_BASE + 0x8)
#define MTL_REG_HfHIPCIE (MTL_HfINT_BASE + 0x40)
#define MTL_HfINTIPPTR_PTR GENMASK(20, 0)
#define MTL_HfHIPCIE_IE BIT(0)
#define MTL_DWICTL_INTENL_IE BIT(0)
#define MTL_DWICTL_FINALSTATUSL_IPC BIT(0) /* same as ADSPIS_IPC */
static int avs_mtl_core_power_on(struct avs_dev *adev)
{
u32 reg;
int ret;
/* Power up DSP domain. */
snd_hdac_adsp_updatel(adev, MTL_REG_HfDSSCS, MTL_HfDSSCS_SPA, MTL_HfDSSCS_SPA);
trace_avs_dsp_core_op(1, AVS_MAIN_CORE_MASK, "power dsp", true);
ret = snd_hdac_adsp_readl_poll(adev, MTL_REG_HfDSSCS, reg,
(reg & MTL_HfDSSCS_CPA) == MTL_HfDSSCS_CPA,
AVS_ADSPCS_INTERVAL_US, AVS_ADSPCS_TIMEOUT_US);
if (ret) {
dev_err(adev->dev, "power on domain dsp failed: %d\n", ret);
return ret;
}
/* Prevent power gating of DSP domain. */
snd_hdac_adsp_updatel(adev, MTL_REG_HfPWRCTL, MTL_HfPWRCTL_WPDSPHPxPG,
MTL_HfPWRCTL_WPDSPHPxPG);
trace_avs_dsp_core_op(1, AVS_MAIN_CORE_MASK, "prevent dsp PG", true);
ret = snd_hdac_adsp_readl_poll(adev, MTL_REG_HfPWRSTS, reg,
(reg & MTL_HfPWRSTS_DSPHPxPGS) == MTL_HfPWRSTS_DSPHPxPGS,
AVS_ADSPCS_INTERVAL_US, AVS_ADSPCS_TIMEOUT_US);
/* Set ownership to HOST. */
snd_hdac_adsp_updatel(adev, MTL_REG_DSPCCTL, MTL_DSPCCTL_OSEL, MTL_DSPCCTL_OSEL_HOST);
return ret;
}
static int avs_mtl_core_power_off(struct avs_dev *adev)
{
u32 reg;
/* Allow power gating of DSP domain. No STS polling as HOST is only one of its users. */
snd_hdac_adsp_updatel(adev, MTL_REG_HfPWRCTL, MTL_HfPWRCTL_WPDSPHPxPG, 0);
trace_avs_dsp_core_op(0, AVS_MAIN_CORE_MASK, "allow dsp pg", false);
/* Power down DSP domain. */
snd_hdac_adsp_updatel(adev, MTL_REG_HfDSSCS, MTL_HfDSSCS_SPA, 0);
trace_avs_dsp_core_op(0, AVS_MAIN_CORE_MASK, "power dsp", false);
return snd_hdac_adsp_readl_poll(adev, MTL_REG_HfDSSCS, reg,
(reg & MTL_HfDSSCS_CPA) == 0,
AVS_ADSPCS_INTERVAL_US, AVS_ADSPCS_TIMEOUT_US);
}
int avs_mtl_core_power(struct avs_dev *adev, u32 core_mask, bool power)
{
core_mask &= AVS_MAIN_CORE_MASK;
if (!core_mask)
return 0;
if (power)
Annotation
- Immediate include surface: `sound/hdaudio_ext.h`, `avs.h`, `debug.h`, `registers.h`, `trace.h`.
- Detected declarations: `function Copyright`, `function avs_mtl_core_power_off`, `function avs_mtl_core_power`, `function avs_mtl_core_reset`, `function avs_mtl_core_stall`, `function avs_mtl_ipc_interrupt`, `function avs_mtl_dsp_interrupt`, `function avs_mtl_interrupt_control`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.