Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/sound/soc/intel/avs/tgl.c
29268 views
1
// SPDX-License-Identifier: GPL-2.0-only
2
//
3
// Copyright(c) 2021-2024 Intel Corporation
4
//
5
// Authors: Cezary Rojewski <[email protected]>
6
// Amadeusz Slawinski <[email protected]>
7
//
8
9
#include <linux/pci.h>
10
#include "avs.h"
11
#include "debug.h"
12
#include "messages.h"
13
14
#define CPUID_TSC_LEAF 0x15
15
16
static int avs_tgl_dsp_core_power(struct avs_dev *adev, u32 core_mask, bool power)
17
{
18
core_mask &= AVS_MAIN_CORE_MASK;
19
20
if (!core_mask)
21
return 0;
22
return avs_dsp_core_power(adev, core_mask, power);
23
}
24
25
static int avs_tgl_dsp_core_reset(struct avs_dev *adev, u32 core_mask, bool reset)
26
{
27
core_mask &= AVS_MAIN_CORE_MASK;
28
29
if (!core_mask)
30
return 0;
31
return avs_dsp_core_reset(adev, core_mask, reset);
32
}
33
34
static int avs_tgl_dsp_core_stall(struct avs_dev *adev, u32 core_mask, bool stall)
35
{
36
core_mask &= AVS_MAIN_CORE_MASK;
37
38
if (!core_mask)
39
return 0;
40
return avs_dsp_core_stall(adev, core_mask, stall);
41
}
42
43
static int avs_tgl_config_basefw(struct avs_dev *adev)
44
{
45
struct pci_dev *pci = adev->base.pci;
46
struct avs_bus_hwid hwid;
47
int ret;
48
#ifdef CONFIG_X86
49
unsigned int ecx;
50
51
#include <asm/cpuid/api.h>
52
ecx = cpuid_ecx(CPUID_TSC_LEAF);
53
if (ecx) {
54
ret = avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_XTAL_FREQ_HZ, sizeof(ecx), &ecx);
55
if (ret)
56
return AVS_IPC_RET(ret);
57
}
58
#endif
59
60
hwid.device = pci->device;
61
hwid.subsystem = pci->subsystem_vendor | (pci->subsystem_device << 16);
62
hwid.revision = pci->revision;
63
64
ret = avs_ipc_set_fw_config(adev, 1, AVS_FW_CFG_BUS_HARDWARE_ID, sizeof(hwid), &hwid);
65
if (ret)
66
return AVS_IPC_RET(ret);
67
68
return 0;
69
}
70
71
const struct avs_dsp_ops avs_tgl_dsp_ops = {
72
.power = avs_tgl_dsp_core_power,
73
.reset = avs_tgl_dsp_core_reset,
74
.stall = avs_tgl_dsp_core_stall,
75
.dsp_interrupt = avs_cnl_dsp_interrupt,
76
.int_control = avs_dsp_interrupt_control,
77
.load_basefw = avs_icl_load_basefw,
78
.load_lib = avs_hda_load_library,
79
.transfer_mods = avs_hda_transfer_modules,
80
.config_basefw = avs_tgl_config_basefw,
81
.log_buffer_offset = avs_icl_log_buffer_offset,
82
.log_buffer_status = avs_apl_log_buffer_status,
83
.coredump = avs_apl_coredump,
84
.d0ix_toggle = avs_icl_d0ix_toggle,
85
.set_d0ix = avs_icl_set_d0ix,
86
AVS_SET_ENABLE_LOGS_OP(icl)
87
};
88
89