Skip to content

Commit a477636

Browse files
authored
Merge pull request #4227 from plbossart/lnl/initial-support
ALSA/ASoC: Add initial LunarLake support
2 parents be29680 + ec663a8 commit a477636

File tree

12 files changed

+255
-7
lines changed

12 files changed

+255
-7
lines changed

include/sound/soc-acpi-intel-match.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[];
3131
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[];
3232
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[];
3333
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[];
34+
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[];
3435

3536
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[];
3637
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_sdw_machines[];
@@ -40,6 +41,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[];
4041
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[];
4142
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[];
4243
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[];
44+
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[];
4345

4446
/*
4547
* generic table used for HDA codec-based platforms, possibly with

sound/pci/hda/hda_intel.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,6 +2527,9 @@ static const struct pci_device_id azx_ids[] = {
25272527
/* Meteorlake-P */
25282528
{ PCI_DEVICE(0x8086, 0x7e28),
25292529
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2530+
/* Lunarlake-P */
2531+
{ PCI_DEVICE(0x8086, 0xa828),
2532+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
25302533
/* Broxton-P(Apollolake) */
25312534
{ PCI_DEVICE(0x8086, 0x5a98),
25322535
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },

sound/soc/intel/common/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m
1010
soc-acpi-intel-tgl-match.o soc-acpi-intel-ehl-match.o \
1111
soc-acpi-intel-jsl-match.o soc-acpi-intel-adl-match.o \
1212
soc-acpi-intel-rpl-match.o soc-acpi-intel-mtl-match.o \
13+
soc-acpi-intel-lnl-match.o \
1314
soc-acpi-intel-hda-match.o \
1415
soc-acpi-intel-sdw-mockup-match.o
1516

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* soc-acpi-intel-lnl-match.c - tables and support for LNL ACPI enumeration.
4+
*
5+
* Copyright (c) 2023, Intel Corporation. All rights reserved.
6+
*
7+
*/
8+
9+
#include <sound/soc-acpi.h>
10+
#include <sound/soc-acpi-intel-match.h>
11+
#include "soc-acpi-intel-sdw-mockup-match.h"
12+
13+
struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[] = {
14+
{},
15+
};
16+
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_machines);
17+
18+
/* this table is used when there is no I2S codec present */
19+
struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = {
20+
/* mockup tests need to be first */
21+
{
22+
.link_mask = GENMASK(3, 0),
23+
.links = sdw_mockup_headset_2amps_mic,
24+
.drv_name = "sof_sdw",
25+
.sof_tplg_filename = "sof-lnl-rt711-rt1308-rt715.tplg",
26+
},
27+
{
28+
.link_mask = BIT(0) | BIT(1) | BIT(3),
29+
.links = sdw_mockup_headset_1amp_mic,
30+
.drv_name = "sof_sdw",
31+
.sof_tplg_filename = "sof-lnl-rt711-rt1308-mono-rt715.tplg",
32+
},
33+
{
34+
.link_mask = GENMASK(2, 0),
35+
.links = sdw_mockup_mic_headset_1amp,
36+
.drv_name = "sof_sdw",
37+
.sof_tplg_filename = "sof-lnl-rt715-rt711-rt1308-mono.tplg",
38+
},
39+
{},
40+
};
41+
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_sdw_machines);

sound/soc/sof/intel/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,22 @@ config SND_SOC_SOF_METEORLAKE
262262
Say Y if you have such a device.
263263
If unsure select "N".
264264

265+
config SND_SOC_SOF_INTEL_LNL
266+
tristate
267+
select SND_SOC_SOF_HDA_COMMON
268+
select SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
269+
select SND_SOC_SOF_INTEL_IPC4
270+
271+
config SND_SOC_SOF_LUNARLAKE
272+
tristate "SOF support for Lunarlake"
273+
default SND_SOC_SOF_PCI
274+
select SND_SOC_SOF_INTEL_LNL
275+
help
276+
This adds support for Sound Open Firmware for Intel(R) platforms
277+
using the Lunarlake processors.
278+
Say Y if you have such a device.
279+
If unsure select "N".
280+
265281
config SND_SOC_SOF_HDA_COMMON
266282
tristate
267283
select SND_SOC_SOF_INTEL_COMMON

sound/soc/sof/intel/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \
77
hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \
88
hda-dai.o hda-dai-ops.o hda-bus.o \
99
skl.o hda-loader-skl.o \
10-
apl.o cnl.o tgl.o icl.o mtl.o hda-common-ops.o
10+
apl.o cnl.o tgl.o icl.o mtl.o lnl.o hda-common-ops.o
1111

1212
snd-sof-intel-hda-mlink-objs := hda-mlink.o
1313

@@ -31,6 +31,7 @@ snd-sof-pci-intel-cnl-objs := pci-cnl.o
3131
snd-sof-pci-intel-icl-objs := pci-icl.o
3232
snd-sof-pci-intel-tgl-objs := pci-tgl.o
3333
snd-sof-pci-intel-mtl-objs := pci-mtl.o
34+
snd-sof-pci-intel-lnl-objs := pci-lnl.o
3435

3536
obj-$(CONFIG_SND_SOC_SOF_MERRIFIELD) += snd-sof-pci-intel-tng.o
3637
obj-$(CONFIG_SND_SOC_SOF_INTEL_SKL) += snd-sof-pci-intel-skl.o
@@ -39,3 +40,4 @@ obj-$(CONFIG_SND_SOC_SOF_INTEL_CNL) += snd-sof-pci-intel-cnl.o
3940
obj-$(CONFIG_SND_SOC_SOF_INTEL_ICL) += snd-sof-pci-intel-icl.o
4041
obj-$(CONFIG_SND_SOC_SOF_INTEL_TGL) += snd-sof-pci-intel-tgl.o
4142
obj-$(CONFIG_SND_SOC_SOF_INTEL_MTL) += snd-sof-pci-intel-mtl.o
43+
obj-$(CONFIG_SND_SOC_SOF_INTEL_LNL) += snd-sof-pci-intel-lnl.o

sound/soc/sof/intel/hda.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ static u32 hda_get_interface_mask(struct snd_sof_dev *sdev)
7171
BIT(SOF_DAI_INTEL_HDA) | BIT(SOF_DAI_INTEL_ALH);
7272
interface_mask[1] = BIT(SOF_DAI_INTEL_HDA);
7373
break;
74+
case SOF_INTEL_ACE_2_0:
75+
interface_mask[0] = BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC) |
76+
BIT(SOF_DAI_INTEL_HDA) | BIT(SOF_DAI_INTEL_ALH);
77+
interface_mask[1] = interface_mask[0]; /* all interfaces accessible without DSP */
78+
break;
7479
default:
7580
break;
7681
}
@@ -245,6 +250,31 @@ int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev)
245250
return 0;
246251
}
247252

253+
int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev)
254+
{
255+
struct sof_intel_hda_dev *hdev;
256+
struct sdw_intel_ctx *ctx;
257+
struct hdac_bus *bus;
258+
u32 slcount;
259+
260+
bus = sof_to_bus(sdev);
261+
262+
hdev = sdev->pdata->hw_pdata;
263+
ctx = hdev->sdw;
264+
265+
slcount = hdac_bus_eml_get_count(bus, true, AZX_REG_ML_LEPTR_ID_SDW);
266+
267+
/* Check HW supported vs property value */
268+
if (slcount < ctx->count) {
269+
dev_err(sdev->dev,
270+
"%s: BIOS master count %d is larger than hardware capabilities %d\n",
271+
__func__, ctx->count, slcount);
272+
return -EINVAL;
273+
}
274+
275+
return 0;
276+
}
277+
248278
static int hda_sdw_check_lcount(struct snd_sof_dev *sdev)
249279
{
250280
const struct sof_intel_dsp_desc *chip;

sound/soc/sof/intel/hda.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);
777777
#if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
778778

779779
int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev);
780+
int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev);
780781
int hda_sdw_startup(struct snd_sof_dev *sdev);
781782
void hda_common_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable);
782783
void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable);
@@ -790,6 +791,11 @@ static inline int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev)
790791
return 0;
791792
}
792793

794+
static inline int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev)
795+
{
796+
return 0;
797+
}
798+
793799
static inline int hda_sdw_startup(struct snd_sof_dev *sdev)
794800
{
795801
return 0;
@@ -846,6 +852,7 @@ extern const struct sof_intel_dsp_desc ehl_chip_info;
846852
extern const struct sof_intel_dsp_desc jsl_chip_info;
847853
extern const struct sof_intel_dsp_desc adls_chip_info;
848854
extern const struct sof_intel_dsp_desc mtl_chip_info;
855+
extern const struct sof_intel_dsp_desc lnl_chip_info;
849856

850857
/* Probes support */
851858
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)

sound/soc/sof/intel/lnl.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2+
//
3+
// Copyright(c) 2023 Intel Corporation. All rights reserved.
4+
5+
/*
6+
* Hardware interface for audio DSP on LunarLake.
7+
*/
8+
9+
#include <linux/firmware.h>
10+
#include <sound/hda_register.h>
11+
#include <sound/sof/ipc4/header.h>
12+
#include <trace/events/sof_intel.h>
13+
#include "../ipc4-priv.h"
14+
#include "../ops.h"
15+
#include "hda.h"
16+
#include "hda-ipc.h"
17+
#include "../sof-audio.h"
18+
#include "mtl.h"
19+
#include "hda.h"
20+
#include <sound/hda-mlink.h>
21+
22+
/* Check if an SDW IRQ occurred */
23+
static bool lnl_dsp_check_sdw_irq(struct snd_sof_dev *sdev)
24+
{
25+
struct hdac_bus *bus = sof_to_bus(sdev);
26+
27+
return hdac_bus_eml_check_interrupt(bus, true, AZX_REG_ML_LEPTR_ID_SDW);
28+
}
29+
30+
static void lnl_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable)
31+
{
32+
struct hdac_bus *bus = sof_to_bus(sdev);
33+
34+
hdac_bus_eml_enable_interrupt(bus, true, AZX_REG_ML_LEPTR_ID_SDW, enable);
35+
}
36+
37+
static int lnl_dsp_disable_interrupts(struct snd_sof_dev *sdev)
38+
{
39+
lnl_enable_sdw_irq(sdev, false);
40+
mtl_disable_ipc_interrupts(sdev);
41+
return mtl_enable_interrupts(sdev, false);
42+
}
43+
44+
const struct sof_intel_dsp_desc lnl_chip_info = {
45+
.cores_num = 4,
46+
.init_core_mask = BIT(0),
47+
.host_managed_cores_mask = BIT(0),
48+
.ipc_req = MTL_DSP_REG_HFIPCXIDR,
49+
.ipc_req_mask = MTL_DSP_REG_HFIPCXIDR_BUSY,
50+
.ipc_ack = MTL_DSP_REG_HFIPCXIDA,
51+
.ipc_ack_mask = MTL_DSP_REG_HFIPCXIDA_DONE,
52+
.ipc_ctl = MTL_DSP_REG_HFIPCXCTL,
53+
.rom_status_reg = MTL_DSP_ROM_STS,
54+
.rom_init_timeout = 300,
55+
.ssp_count = MTL_SSP_COUNT,
56+
.d0i3_offset = MTL_HDA_VS_D0I3C,
57+
.read_sdw_lcount = hda_sdw_check_lcount_ext,
58+
.enable_sdw_irq = lnl_enable_sdw_irq,
59+
.check_sdw_irq = lnl_dsp_check_sdw_irq,
60+
.check_ipc_irq = mtl_dsp_check_ipc_irq,
61+
.cl_init = mtl_dsp_cl_init,
62+
.power_down_dsp = mtl_power_down_dsp,
63+
.disable_interrupts = lnl_dsp_disable_interrupts,
64+
.hw_ip_version = SOF_INTEL_ACE_2_0,
65+
};
66+
EXPORT_SYMBOL_NS(lnl_chip_info, SND_SOC_SOF_INTEL_HDA_COMMON);

sound/soc/sof/intel/mtl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void mtl_ipc_dsp_done(struct snd_sof_dev *sdev)
5555
}
5656

5757
/* Check if an IPC IRQ occurred */
58-
static bool mtl_dsp_check_ipc_irq(struct snd_sof_dev *sdev)
58+
bool mtl_dsp_check_ipc_irq(struct snd_sof_dev *sdev)
5959
{
6060
u32 irq_status;
6161
u32 hfintipptr;
@@ -115,7 +115,7 @@ static int mtl_ipc_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *ms
115115
return 0;
116116
}
117117

118-
static void mtl_enable_ipc_interrupts(struct snd_sof_dev *sdev)
118+
void mtl_enable_ipc_interrupts(struct snd_sof_dev *sdev)
119119
{
120120
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
121121
const struct sof_intel_dsp_desc *chip = hda->desc;
@@ -126,7 +126,7 @@ static void mtl_enable_ipc_interrupts(struct snd_sof_dev *sdev)
126126
MTL_DSP_REG_HFIPCXCTL_BUSY | MTL_DSP_REG_HFIPCXCTL_DONE);
127127
}
128128

129-
static void mtl_disable_ipc_interrupts(struct snd_sof_dev *sdev)
129+
void mtl_disable_ipc_interrupts(struct snd_sof_dev *sdev)
130130
{
131131
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
132132
const struct sof_intel_dsp_desc *chip = hda->desc;
@@ -161,7 +161,7 @@ static void mtl_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable)
161161
enable ? "enable" : "disable");
162162
}
163163

164-
static int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable)
164+
int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable)
165165
{
166166
u32 hfintipptr;
167167
u32 irqinten;
@@ -382,7 +382,7 @@ static int mtl_dsp_core_power_down(struct snd_sof_dev *sdev, int core)
382382
return ret;
383383
}
384384

385-
static int mtl_power_down_dsp(struct snd_sof_dev *sdev)
385+
int mtl_power_down_dsp(struct snd_sof_dev *sdev)
386386
{
387387
u32 dsphfdsscs, cpa;
388388
int ret;
@@ -409,7 +409,7 @@ static int mtl_power_down_dsp(struct snd_sof_dev *sdev)
409409
HDA_DSP_RESET_TIMEOUT_US);
410410
}
411411

412-
static int mtl_dsp_cl_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot)
412+
int mtl_dsp_cl_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot)
413413
{
414414
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
415415
const struct sof_intel_dsp_desc *chip = hda->desc;

0 commit comments

Comments
 (0)