Skip to content

Commit 8a6502a

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: CNL-based platforms support
Define handlers specific to cAVS 1.8 platforms, that is CNL, CFL, CML and all other variants based on this very version of AudioDSP architecture. Most operations are inherited from their predecessors. Reviewed-by: Amadeusz Sławiński <[email protected]> Signed-off-by: Cezary Rojewski <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 97bd565 commit 8a6502a

File tree

6 files changed

+119
-8
lines changed

6 files changed

+119
-8
lines changed

sound/soc/intel/avs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
snd-soc-avs-objs := dsp.o ipc.o messages.o utils.o core.o loader.o \
44
topology.o path.o pcm.o board_selection.o control.o
55
snd-soc-avs-objs += cldma.o
6-
snd-soc-avs-objs += skl.o apl.o
6+
snd-soc-avs-objs += skl.o apl.o cnl.o
77

88
snd-soc-avs-objs += trace.o
99
# tell define_trace.h where to find the trace header

sound/soc/intel/avs/apl.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#include "path.h"
1414
#include "topology.h"
1515

16-
static int __maybe_unused
17-
avs_apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period,
18-
u32 fifo_full_period, unsigned long resource_mask, u32 *priorities)
16+
#ifdef CONFIG_DEBUG_FS
17+
int avs_apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period,
18+
u32 fifo_full_period, unsigned long resource_mask, u32 *priorities)
1919
{
2020
struct avs_apl_log_state_info *info;
2121
u32 size, num_cores = adev->hw_cfg.dsp_cores;
@@ -47,8 +47,9 @@ avs_apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_
4747

4848
return 0;
4949
}
50+
#endif
5051

51-
static int avs_apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg)
52+
int avs_apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg)
5253
{
5354
struct avs_apl_log_buffer_layout layout;
5455
void __iomem *addr, *buf;
@@ -102,7 +103,7 @@ static int avs_apl_wait_log_entry(struct avs_dev *adev, u32 core,
102103
/* reads log header and tests its type */
103104
#define avs_apl_is_entry_stackdump(addr) ((readl(addr) >> 30) & 0x1)
104105

105-
static int avs_apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg)
106+
int avs_apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg)
106107
{
107108
struct avs_apl_log_buffer_layout layout;
108109
void __iomem *addr, *buf;
@@ -202,7 +203,7 @@ static bool avs_apl_lp_streaming(struct avs_dev *adev)
202203
return true;
203204
}
204205

205-
static bool avs_apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake)
206+
bool avs_apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake)
206207
{
207208
/* wake in all cases */
208209
if (wake)
@@ -219,7 +220,7 @@ static bool avs_apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bo
219220
return avs_apl_lp_streaming(adev);
220221
}
221222

222-
static int avs_apl_set_d0ix(struct avs_dev *adev, bool enable)
223+
int avs_apl_set_d0ix(struct avs_dev *adev, bool enable)
223224
{
224225
bool streaming = false;
225226
int ret;

sound/soc/intel/avs/avs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct avs_dsp_ops {
6666

6767
extern const struct avs_dsp_ops avs_skl_dsp_ops;
6868
extern const struct avs_dsp_ops avs_apl_dsp_ops;
69+
extern const struct avs_dsp_ops avs_cnl_dsp_ops;
6970

7071
#define AVS_PLATATTR_CLDMA BIT_ULL(0)
7172
#define AVS_PLATATTR_IMR BIT_ULL(1)
@@ -265,7 +266,14 @@ int avs_dsp_disable_d0ix(struct avs_dev *adev);
265266
int avs_dsp_enable_d0ix(struct avs_dev *adev);
266267

267268
irqreturn_t avs_skl_irq_thread(struct avs_dev *adev);
269+
irqreturn_t avs_cnl_irq_thread(struct avs_dev *adev);
270+
int avs_apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period,
271+
u32 fifo_full_period, unsigned long resource_mask, u32 *priorities);
268272
int avs_skl_log_buffer_offset(struct avs_dev *adev, u32 core);
273+
int avs_apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg);
274+
int avs_apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg);
275+
bool avs_apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake);
276+
int avs_apl_set_d0ix(struct avs_dev *adev, bool enable);
269277

270278
/* Firmware resources management */
271279

sound/soc/intel/avs/cnl.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
//
3+
// Copyright(c) 2021-2024 Intel Corporation. All rights reserved.
4+
//
5+
// Authors: Cezary Rojewski <[email protected]>
6+
// Amadeusz Slawinski <[email protected]>
7+
//
8+
9+
#include <sound/hdaudio_ext.h>
10+
#include "avs.h"
11+
#include "messages.h"
12+
13+
irqreturn_t avs_cnl_irq_thread(struct avs_dev *adev)
14+
{
15+
union avs_reply_msg msg;
16+
u32 hipctdr, hipctdd, hipctda;
17+
18+
hipctdr = snd_hdac_adsp_readl(adev, CNL_ADSP_REG_HIPCTDR);
19+
hipctdd = snd_hdac_adsp_readl(adev, CNL_ADSP_REG_HIPCTDD);
20+
21+
/* Ensure DSP sent new response to process. */
22+
if (!(hipctdr & CNL_ADSP_HIPCTDR_BUSY))
23+
return IRQ_NONE;
24+
25+
msg.primary = hipctdr;
26+
msg.ext.val = hipctdd;
27+
avs_dsp_process_response(adev, msg.val);
28+
29+
/* Tell DSP we accepted its message. */
30+
snd_hdac_adsp_updatel(adev, CNL_ADSP_REG_HIPCTDR,
31+
CNL_ADSP_HIPCTDR_BUSY, CNL_ADSP_HIPCTDR_BUSY);
32+
/* Ack this response. */
33+
snd_hdac_adsp_updatel(adev, CNL_ADSP_REG_HIPCTDA,
34+
CNL_ADSP_HIPCTDA_DONE, CNL_ADSP_HIPCTDA_DONE);
35+
/* HW might have been clock gated, give some time for change to propagate. */
36+
snd_hdac_adsp_readl_poll(adev, CNL_ADSP_REG_HIPCTDA, hipctda,
37+
!(hipctda & CNL_ADSP_HIPCTDA_DONE), 10, 1000);
38+
/* Unmask busy interrupt. */
39+
snd_hdac_adsp_updatel(adev, CNL_ADSP_REG_HIPCCTL,
40+
AVS_ADSP_HIPCCTL_BUSY, AVS_ADSP_HIPCCTL_BUSY);
41+
42+
return IRQ_HANDLED;
43+
}
44+
45+
const struct avs_dsp_ops avs_cnl_dsp_ops = {
46+
.power = avs_dsp_core_power,
47+
.reset = avs_dsp_core_reset,
48+
.stall = avs_dsp_core_stall,
49+
.irq_handler = avs_irq_handler,
50+
.irq_thread = avs_cnl_irq_thread,
51+
.int_control = avs_dsp_interrupt_control,
52+
.load_basefw = avs_hda_load_basefw,
53+
.load_lib = avs_hda_load_library,
54+
.transfer_mods = avs_hda_transfer_modules,
55+
.log_buffer_offset = avs_skl_log_buffer_offset,
56+
.log_buffer_status = avs_apl_log_buffer_status,
57+
.coredump = avs_apl_coredump,
58+
.d0ix_toggle = avs_apl_d0ix_toggle,
59+
.set_d0ix = avs_apl_set_d0ix,
60+
AVS_SET_ENABLE_LOGS_OP(apl)
61+
};

sound/soc/intel/avs/core.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,17 @@ static const struct avs_hipc_spec skl_hipc_spec = {
767767
.ctl_offset = SKL_ADSP_REG_HIPCCTL,
768768
};
769769

770+
static const struct avs_hipc_spec cnl_hipc_spec = {
771+
.req_offset = CNL_ADSP_REG_HIPCIDR,
772+
.req_ext_offset = CNL_ADSP_REG_HIPCIDD,
773+
.req_busy_mask = CNL_ADSP_HIPCIDR_BUSY,
774+
.ack_offset = CNL_ADSP_REG_HIPCIDA,
775+
.ack_done_mask = CNL_ADSP_HIPCIDA_DONE,
776+
.rsp_offset = CNL_ADSP_REG_HIPCTDR,
777+
.rsp_busy_mask = CNL_ADSP_HIPCTDR_BUSY,
778+
.ctl_offset = CNL_ADSP_REG_HIPCCTL,
779+
};
780+
770781
static const struct avs_spec skl_desc = {
771782
.name = "skl",
772783
.min_fw_version = { 9, 21, 0, 4732 },
@@ -787,6 +798,16 @@ static const struct avs_spec apl_desc = {
787798
.hipc = &skl_hipc_spec,
788799
};
789800

801+
static const struct avs_spec cnl_desc = {
802+
.name = "cnl",
803+
.min_fw_version = { 10, 23, 0, 5314 },
804+
.dsp_ops = &avs_cnl_dsp_ops,
805+
.core_init_mask = 1,
806+
.attributes = AVS_PLATATTR_IMR,
807+
.sram = &apl_sram_spec,
808+
.hipc = &cnl_hipc_spec,
809+
};
810+
790811
static const struct pci_device_id avs_ids[] = {
791812
{ PCI_DEVICE_DATA(INTEL, HDA_SKL_LP, &skl_desc) },
792813
{ PCI_DEVICE_DATA(INTEL, HDA_SKL, &skl_desc) },
@@ -796,6 +817,11 @@ static const struct pci_device_id avs_ids[] = {
796817
{ PCI_DEVICE_DATA(INTEL, HDA_CML_S, &skl_desc) },
797818
{ PCI_DEVICE_DATA(INTEL, HDA_APL, &apl_desc) },
798819
{ PCI_DEVICE_DATA(INTEL, HDA_GML, &apl_desc) },
820+
{ PCI_DEVICE_DATA(INTEL, HDA_CNL_LP, &cnl_desc) },
821+
{ PCI_DEVICE_DATA(INTEL, HDA_CNL_H, &cnl_desc) },
822+
{ PCI_DEVICE_DATA(INTEL, HDA_CML_LP, &cnl_desc) },
823+
{ PCI_DEVICE_DATA(INTEL, HDA_CML_H, &cnl_desc) },
824+
{ PCI_DEVICE_DATA(INTEL, HDA_RKL_S, &cnl_desc) },
799825
{ 0 }
800826
};
801827
MODULE_DEVICE_TABLE(pci, avs_ids);

sound/soc/intel/avs/registers.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@
5050
#define SKL_ADSP_HIPCIE_DONE BIT(30)
5151
#define SKL_ADSP_HIPCT_BUSY BIT(31)
5252

53+
/* CNL Intel HD Audio Inter-Processor Communication Registers */
54+
#define CNL_ADSP_IPC_BASE 0xC0
55+
#define CNL_ADSP_REG_HIPCTDR (CNL_ADSP_IPC_BASE + 0x00)
56+
#define CNL_ADSP_REG_HIPCTDA (CNL_ADSP_IPC_BASE + 0x04)
57+
#define CNL_ADSP_REG_HIPCTDD (CNL_ADSP_IPC_BASE + 0x08)
58+
#define CNL_ADSP_REG_HIPCIDR (CNL_ADSP_IPC_BASE + 0x10)
59+
#define CNL_ADSP_REG_HIPCIDA (CNL_ADSP_IPC_BASE + 0x14)
60+
#define CNL_ADSP_REG_HIPCIDD (CNL_ADSP_IPC_BASE + 0x18)
61+
#define CNL_ADSP_REG_HIPCCTL (CNL_ADSP_IPC_BASE + 0x28)
62+
63+
#define CNL_ADSP_HIPCTDR_BUSY BIT(31)
64+
#define CNL_ADSP_HIPCTDA_DONE BIT(31)
65+
#define CNL_ADSP_HIPCIDR_BUSY BIT(31)
66+
#define CNL_ADSP_HIPCIDA_DONE BIT(31)
67+
5368
/* Intel HD Audio SRAM windows base addresses */
5469
#define SKL_ADSP_SRAM_BASE_OFFSET 0x8000
5570
#define SKL_ADSP_SRAM_WINDOW_SIZE 0x2000

0 commit comments

Comments
 (0)