1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
3 // This file is provided under a dual BSD/GPLv2 license. When using or
4 // redistributing this file, you may do so under either license.
6 // Copyright(c) 2018 Intel Corporation
8 // Authors: Liam Girdwood <liam.r.girdwood@linux.intel.com>
9 // Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
10 // Rander Wang <rander.wang@intel.com>
11 // Keyon Jie <yang.jie@linux.intel.com>
15 * Hardware interface for generic Intel audio DSP HDA IP
18 #include <sound/hdaudio_ext.h>
19 #include <sound/hda_register.h>
21 #include <linux/acpi.h>
22 #include <linux/debugfs.h>
23 #include <linux/module.h>
24 #include <linux/soundwire/sdw.h>
25 #include <linux/soundwire/sdw_intel.h>
26 #include <sound/intel-dsp-config.h>
27 #include <sound/intel-nhlt.h>
28 #include <sound/soc-acpi-intel-ssp-common.h>
29 #include <sound/sof.h>
30 #include <sound/sof/xtensa.h>
31 #include <sound/hda-mlink.h>
32 #include "../sof-audio.h"
33 #include "../sof-pci-dev.h"
35 #include "../ipc4-topology.h"
38 #include <trace/events/sof_intel.h>
40 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
41 #include <sound/soc-acpi-intel-match.h>
44 /* platform specific devices */
47 #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
50 * The default for SoundWire clock stop quirks is to power gate the IP
51 * and do a Bus Reset, this will need to be modified when the DSP
52 * needs to remain in D0i3 so that the Master does not lose context
53 * and enumeration is not required on clock restart
55 static int sdw_clock_stop_quirks
= SDW_INTEL_CLK_STOP_BUS_RESET
;
56 module_param(sdw_clock_stop_quirks
, int, 0444);
57 MODULE_PARM_DESC(sdw_clock_stop_quirks
, "SOF SoundWire clock stop quirks");
59 static int sdw_params_stream(struct device
*dev
,
60 struct sdw_intel_stream_params_data
*params_data
)
62 struct snd_soc_dai
*d
= params_data
->dai
;
63 struct snd_soc_dapm_widget
*w
= snd_soc_dai_get_widget(d
, params_data
->substream
->stream
);
64 struct snd_sof_dai_config_data data
= { 0 };
66 data
.dai_index
= (params_data
->link_id
<< 8) | d
->id
;
67 data
.dai_data
= params_data
->alh_stream_id
;
68 data
.dai_node_id
= data
.dai_data
;
70 return hda_dai_config(w
, SOF_DAI_CONFIG_FLAGS_HW_PARAMS
, &data
);
73 static int sdw_params_free(struct device
*dev
, struct sdw_intel_stream_free_data
*free_data
)
75 struct snd_soc_dai
*d
= free_data
->dai
;
76 struct snd_soc_dapm_widget
*w
= snd_soc_dai_get_widget(d
, free_data
->substream
->stream
);
77 struct snd_sof_dev
*sdev
= widget_to_sdev(w
);
79 if (sdev
->pdata
->ipc_type
== SOF_IPC_TYPE_4
) {
80 struct snd_sof_widget
*swidget
= w
->dobj
.private;
81 struct snd_sof_dai
*dai
= swidget
->private;
82 struct sof_ipc4_copier_data
*copier_data
;
83 struct sof_ipc4_copier
*ipc4_copier
;
85 ipc4_copier
= dai
->private;
86 ipc4_copier
->dai_index
= 0;
87 copier_data
= &ipc4_copier
->data
;
89 /* clear the node ID */
90 copier_data
->gtw_cfg
.node_id
&= ~SOF_IPC4_NODE_INDEX_MASK
;
96 struct sdw_intel_ops sdw_callback
= {
97 .params_stream
= sdw_params_stream
,
98 .free_stream
= sdw_params_free
,
101 static int sdw_ace2x_params_stream(struct device
*dev
,
102 struct sdw_intel_stream_params_data
*params_data
)
104 return sdw_hda_dai_hw_params(params_data
->substream
,
105 params_data
->hw_params
,
107 params_data
->link_id
,
108 params_data
->alh_stream_id
);
111 static int sdw_ace2x_free_stream(struct device
*dev
,
112 struct sdw_intel_stream_free_data
*free_data
)
114 return sdw_hda_dai_hw_free(free_data
->substream
,
119 static int sdw_ace2x_trigger(struct snd_pcm_substream
*substream
, int cmd
, struct snd_soc_dai
*dai
)
121 return sdw_hda_dai_trigger(substream
, cmd
, dai
);
124 static struct sdw_intel_ops sdw_ace2x_callback
= {
125 .params_stream
= sdw_ace2x_params_stream
,
126 .free_stream
= sdw_ace2x_free_stream
,
127 .trigger
= sdw_ace2x_trigger
,
130 static int hda_sdw_acpi_scan(struct snd_sof_dev
*sdev
)
132 u32 interface_mask
= hda_get_interface_mask(sdev
);
133 struct sof_intel_hda_dev
*hdev
;
137 if (!(interface_mask
& BIT(SOF_DAI_INTEL_ALH
)))
140 handle
= ACPI_HANDLE(sdev
->dev
);
142 /* save ACPI info for the probe step */
143 hdev
= sdev
->pdata
->hw_pdata
;
145 ret
= sdw_intel_acpi_scan(handle
, &hdev
->info
);
152 static int hda_sdw_probe(struct snd_sof_dev
*sdev
)
154 const struct sof_intel_dsp_desc
*chip
;
155 struct sof_intel_hda_dev
*hdev
;
156 struct sdw_intel_res res
;
159 hdev
= sdev
->pdata
->hw_pdata
;
161 memset(&res
, 0, sizeof(res
));
163 chip
= get_chip_info(sdev
->pdata
);
164 if (chip
->hw_ip_version
< SOF_INTEL_ACE_2_0
) {
165 res
.mmio_base
= sdev
->bar
[HDA_DSP_BAR
];
166 res
.hw_ops
= &sdw_intel_cnl_hw_ops
;
167 res
.shim_base
= hdev
->desc
->sdw_shim_base
;
168 res
.alh_base
= hdev
->desc
->sdw_alh_base
;
170 res
.ops
= &sdw_callback
;
173 * retrieve eml_lock needed to protect shared registers
174 * in the HDaudio multi-link areas
176 res
.eml_lock
= hdac_bus_eml_get_mutex(sof_to_bus(sdev
), true,
177 AZX_REG_ML_LEPTR_ID_SDW
);
181 res
.mmio_base
= sdev
->bar
[HDA_DSP_HDA_BAR
];
183 * the SHIM and SoundWire register offsets are link-specific
184 * and will be determined when adding auxiliary devices
186 res
.hw_ops
= &sdw_intel_lnl_hw_ops
;
188 res
.ops
= &sdw_ace2x_callback
;
191 res
.irq
= sdev
->ipc_irq
;
192 res
.handle
= hdev
->info
.handle
;
193 res
.parent
= sdev
->dev
;
196 res
.clock_stop_quirks
= sdw_clock_stop_quirks
;
197 res
.hbus
= sof_to_bus(sdev
);
200 * ops and arg fields are not populated for now,
201 * they will be needed when the DAI callbacks are
205 /* we could filter links here if needed, e.g for quirks */
206 res
.count
= hdev
->info
.count
;
207 res
.link_mask
= hdev
->info
.link_mask
;
209 sdw
= sdw_intel_probe(&res
);
211 dev_err(sdev
->dev
, "error: SoundWire probe failed\n");
221 int hda_sdw_startup(struct snd_sof_dev
*sdev
)
223 struct sof_intel_hda_dev
*hdev
;
224 struct snd_sof_pdata
*pdata
= sdev
->pdata
;
227 hdev
= sdev
->pdata
->hw_pdata
;
232 if (pdata
->machine
&& !pdata
->machine
->mach_params
.link_mask
)
235 ret
= hda_sdw_check_lcount(sdev
);
239 return sdw_intel_startup(hdev
->sdw
);
241 EXPORT_SYMBOL_NS(hda_sdw_startup
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
243 static int hda_sdw_exit(struct snd_sof_dev
*sdev
)
245 struct sof_intel_hda_dev
*hdev
;
247 hdev
= sdev
->pdata
->hw_pdata
;
250 sdw_intel_exit(hdev
->sdw
);
253 hda_sdw_int_enable(sdev
, false);
258 bool hda_common_check_sdw_irq(struct snd_sof_dev
*sdev
)
260 struct sof_intel_hda_dev
*hdev
;
264 hdev
= sdev
->pdata
->hw_pdata
;
270 irq_status
= snd_sof_dsp_read(sdev
, HDA_DSP_BAR
, HDA_DSP_REG_ADSPIS2
);
272 /* invalid message ? */
273 if (irq_status
== 0xffffffff)
277 if (irq_status
& HDA_DSP_REG_ADSPIS2_SNDW
)
283 EXPORT_SYMBOL_NS(hda_common_check_sdw_irq
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
285 static bool hda_dsp_check_sdw_irq(struct snd_sof_dev
*sdev
)
287 u32 interface_mask
= hda_get_interface_mask(sdev
);
288 const struct sof_intel_dsp_desc
*chip
;
290 if (!(interface_mask
& BIT(SOF_DAI_INTEL_ALH
)))
293 chip
= get_chip_info(sdev
->pdata
);
294 if (chip
&& chip
->check_sdw_irq
)
295 return chip
->check_sdw_irq(sdev
);
300 static irqreturn_t
hda_dsp_sdw_thread(int irq
, void *context
)
302 return sdw_intel_thread(irq
, context
);
305 bool hda_sdw_check_wakeen_irq_common(struct snd_sof_dev
*sdev
)
307 struct sof_intel_hda_dev
*hdev
;
309 hdev
= sdev
->pdata
->hw_pdata
;
311 snd_sof_dsp_read(sdev
, HDA_DSP_BAR
,
312 hdev
->desc
->sdw_shim_base
+ SDW_SHIM_WAKESTS
))
317 EXPORT_SYMBOL_NS(hda_sdw_check_wakeen_irq_common
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
319 static bool hda_sdw_check_wakeen_irq(struct snd_sof_dev
*sdev
)
321 u32 interface_mask
= hda_get_interface_mask(sdev
);
322 const struct sof_intel_dsp_desc
*chip
;
324 if (!(interface_mask
& BIT(SOF_DAI_INTEL_ALH
)))
327 chip
= get_chip_info(sdev
->pdata
);
328 if (chip
&& chip
->check_sdw_wakeen_irq
)
329 return chip
->check_sdw_wakeen_irq(sdev
);
334 void hda_sdw_process_wakeen_common(struct snd_sof_dev
*sdev
)
336 u32 interface_mask
= hda_get_interface_mask(sdev
);
337 struct sof_intel_hda_dev
*hdev
;
339 if (!(interface_mask
& BIT(SOF_DAI_INTEL_ALH
)))
342 hdev
= sdev
->pdata
->hw_pdata
;
346 sdw_intel_process_wakeen_event(hdev
->sdw
);
348 EXPORT_SYMBOL_NS(hda_sdw_process_wakeen_common
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
350 #else /* IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) */
351 static inline int hda_sdw_acpi_scan(struct snd_sof_dev
*sdev
)
356 static inline int hda_sdw_probe(struct snd_sof_dev
*sdev
)
361 static inline int hda_sdw_exit(struct snd_sof_dev
*sdev
)
366 static inline bool hda_dsp_check_sdw_irq(struct snd_sof_dev
*sdev
)
371 static inline irqreturn_t
hda_dsp_sdw_thread(int irq
, void *context
)
376 static inline bool hda_sdw_check_wakeen_irq(struct snd_sof_dev
*sdev
)
381 #endif /* IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) */
383 /* pre fw run operations */
384 int hda_dsp_pre_fw_run(struct snd_sof_dev
*sdev
)
386 /* disable clock gating and power gating */
387 return hda_dsp_ctrl_clock_power_gating(sdev
, false);
390 /* post fw run operations */
391 int hda_dsp_post_fw_run(struct snd_sof_dev
*sdev
)
395 if (sdev
->first_boot
) {
396 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
398 ret
= hda_sdw_startup(sdev
);
401 "error: could not startup SoundWire links\n");
405 /* Check if IMR boot is usable */
406 if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT
) &&
407 (sdev
->fw_ready
.flags
& SOF_IPC_INFO_D3_PERSISTENT
||
408 sdev
->pdata
->ipc_type
== SOF_IPC_TYPE_4
)) {
409 hdev
->imrboot_supported
= true;
410 debugfs_create_bool("skip_imr_boot",
411 0644, sdev
->debugfs_root
,
412 &hdev
->skip_imr_boot
);
416 hda_sdw_int_enable(sdev
, true);
418 /* re-enable clock gating and power gating */
419 return hda_dsp_ctrl_clock_power_gating(sdev
, true);
421 EXPORT_SYMBOL_NS(hda_dsp_post_fw_run
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
427 #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG)
428 static bool hda_use_msi
= true;
429 module_param_named(use_msi
, hda_use_msi
, bool, 0444);
430 MODULE_PARM_DESC(use_msi
, "SOF HDA use PCI MSI mode");
432 #define hda_use_msi (1)
435 static char *hda_model
;
436 module_param(hda_model
, charp
, 0444);
437 MODULE_PARM_DESC(hda_model
, "Use the given HDA board model.");
439 static int dmic_num_override
= -1;
440 module_param_named(dmic_num
, dmic_num_override
, int, 0444);
441 MODULE_PARM_DESC(dmic_num
, "SOF HDA DMIC number");
443 static int mclk_id_override
= -1;
444 module_param_named(mclk_id
, mclk_id_override
, int, 0444);
445 MODULE_PARM_DESC(mclk_id
, "SOF SSP mclk_id");
447 static int bt_link_mask_override
;
448 module_param_named(bt_link_mask
, bt_link_mask_override
, int, 0444);
449 MODULE_PARM_DESC(bt_link_mask
, "SOF BT offload link mask");
451 static int hda_init(struct snd_sof_dev
*sdev
)
453 struct hda_bus
*hbus
;
454 struct hdac_bus
*bus
;
455 struct pci_dev
*pci
= to_pci_dev(sdev
->dev
);
458 hbus
= sof_to_hbus(sdev
);
459 bus
= sof_to_bus(sdev
);
462 sof_hda_bus_init(sdev
, &pci
->dev
);
464 if (sof_hda_position_quirk
== SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTERS
)
468 bus
->bdl_pos_adj
= 0;
471 mutex_init(&hbus
->prepare_mutex
);
473 hbus
->mixer_assigned
= -1;
474 hbus
->modelname
= hda_model
;
476 /* initialise hdac bus */
477 bus
->addr
= pci_resource_start(pci
, 0);
478 bus
->remap_addr
= pci_ioremap_bar(pci
, 0);
479 if (!bus
->remap_addr
) {
480 dev_err(bus
->dev
, "error: ioremap error\n");
485 sdev
->bar
[HDA_DSP_HDA_BAR
] = bus
->remap_addr
;
487 /* init i915 and HDMI codecs */
488 ret
= hda_codec_i915_init(sdev
);
489 if (ret
< 0 && ret
!= -ENODEV
) {
490 dev_err_probe(sdev
->dev
, ret
, "init of i915 and HDMI codec failed\n");
494 /* get controller capabilities */
495 ret
= hda_dsp_ctrl_get_caps(sdev
);
497 dev_err(sdev
->dev
, "error: get caps error\n");
498 hda_codec_i915_exit(sdev
);
503 iounmap(sof_to_bus(sdev
)->remap_addr
);
508 static int check_dmic_num(struct snd_sof_dev
*sdev
)
510 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
511 struct nhlt_acpi_table
*nhlt
;
516 dmic_num
= intel_nhlt_get_dmic_geo(sdev
->dev
, nhlt
);
518 dev_info(sdev
->dev
, "DMICs detected in NHLT tables: %d\n", dmic_num
);
520 /* allow for module parameter override */
521 if (dmic_num_override
!= -1) {
523 "overriding DMICs detected in NHLT tables %d by kernel param %d\n",
524 dmic_num
, dmic_num_override
);
525 dmic_num
= dmic_num_override
;
528 if (dmic_num
< 0 || dmic_num
> 4) {
529 dev_dbg(sdev
->dev
, "invalid dmic_number %d\n", dmic_num
);
536 static int check_nhlt_ssp_mask(struct snd_sof_dev
*sdev
, u8 device_type
)
538 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
539 struct nhlt_acpi_table
*nhlt
;
546 if (intel_nhlt_has_endpoint_type(nhlt
, NHLT_LINK_SSP
)) {
547 ssp_mask
= intel_nhlt_ssp_endpoint_mask(nhlt
, device_type
);
549 dev_info(sdev
->dev
, "NHLT device %s(%d) detected, ssp_mask %#x\n",
550 device_type
== NHLT_DEVICE_BT
? "BT" : "I2S",
551 device_type
, ssp_mask
);
557 static int check_nhlt_ssp_mclk_mask(struct snd_sof_dev
*sdev
, int ssp_num
)
559 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
560 struct nhlt_acpi_table
*nhlt
;
566 return intel_nhlt_ssp_mclk_mask(nhlt
, ssp_num
);
569 static int hda_init_caps(struct snd_sof_dev
*sdev
)
571 u32 interface_mask
= hda_get_interface_mask(sdev
);
572 struct hdac_bus
*bus
= sof_to_bus(sdev
);
573 struct snd_sof_pdata
*pdata
= sdev
->pdata
;
574 struct sof_intel_hda_dev
*hdev
= pdata
->hw_pdata
;
578 /* check if dsp is there */
580 dev_dbg(sdev
->dev
, "PP capability, will probe DSP later.\n");
582 /* Init HDA controller after i915 init */
583 ret
= hda_dsp_ctrl_init_chip(sdev
);
585 dev_err(bus
->dev
, "error: init chip failed with ret: %d\n",
590 hda_bus_ml_init(bus
);
592 /* Skip SoundWire if it is not supported */
593 if (!(interface_mask
& BIT(SOF_DAI_INTEL_ALH
)))
596 /* scan SoundWire capabilities exposed by DSDT */
597 ret
= hda_sdw_acpi_scan(sdev
);
599 dev_dbg(sdev
->dev
, "skipping SoundWire, not detected with ACPI scan\n");
603 link_mask
= hdev
->info
.link_mask
;
605 dev_dbg(sdev
->dev
, "skipping SoundWire, no links enabled\n");
610 * probe/allocate SoundWire resources.
611 * The hardware configuration takes place in hda_sdw_startup
612 * after power rails are enabled.
613 * It's entirely possible to have a mix of I2S/DMIC/SoundWire
614 * devices, so we allocate the resources in all cases.
616 ret
= hda_sdw_probe(sdev
);
618 dev_err(sdev
->dev
, "error: SoundWire probe error\n");
624 /* create codec instances */
625 hda_codec_probe_bus(sdev
);
627 if (!HDA_IDISP_CODEC(bus
->codec_mask
))
628 hda_codec_i915_display_power(sdev
, false);
630 hda_bus_ml_put_all(bus
);
635 static irqreturn_t
hda_dsp_interrupt_handler(int irq
, void *context
)
637 struct snd_sof_dev
*sdev
= context
;
640 * Get global interrupt status. It includes all hardware interrupt
641 * sources in the Intel HD Audio controller.
643 if (snd_sof_dsp_read(sdev
, HDA_DSP_HDA_BAR
, SOF_HDA_INTSTS
) &
644 SOF_HDA_INTSTS_GIS
) {
646 /* disable GIE interrupt */
647 snd_sof_dsp_update_bits(sdev
, HDA_DSP_HDA_BAR
,
649 SOF_HDA_INT_GLOBAL_EN
,
652 return IRQ_WAKE_THREAD
;
658 static irqreturn_t
hda_dsp_interrupt_thread(int irq
, void *context
)
660 struct snd_sof_dev
*sdev
= context
;
661 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
663 /* deal with streams and controller first */
664 if (hda_dsp_check_stream_irq(sdev
)) {
665 trace_sof_intel_hda_irq(sdev
, "stream");
666 hda_dsp_stream_threaded_handler(irq
, sdev
);
669 if (hda_check_ipc_irq(sdev
)) {
670 trace_sof_intel_hda_irq(sdev
, "ipc");
671 sof_ops(sdev
)->irq_thread(irq
, sdev
);
674 if (hda_dsp_check_sdw_irq(sdev
)) {
675 trace_sof_intel_hda_irq(sdev
, "sdw");
676 hda_dsp_sdw_thread(irq
, hdev
->sdw
);
679 if (hda_sdw_check_wakeen_irq(sdev
)) {
680 trace_sof_intel_hda_irq(sdev
, "wakeen");
681 hda_sdw_process_wakeen(sdev
);
684 hda_codec_check_for_state_change(sdev
);
686 /* enable GIE interrupt */
687 snd_sof_dsp_update_bits(sdev
, HDA_DSP_HDA_BAR
,
689 SOF_HDA_INT_GLOBAL_EN
,
690 SOF_HDA_INT_GLOBAL_EN
);
695 int hda_dsp_probe_early(struct snd_sof_dev
*sdev
)
697 struct pci_dev
*pci
= to_pci_dev(sdev
->dev
);
698 struct sof_intel_hda_dev
*hdev
;
699 const struct sof_intel_dsp_desc
*chip
;
702 if (!sdev
->dspless_mode_selected
) {
704 * detect DSP by checking class/subclass/prog-id information
705 * class=04 subclass 03 prog-if 00: no DSP, legacy driver is required
706 * class=04 subclass 01 prog-if 00: DSP is present
707 * (and may be required e.g. for DMIC or SSP support)
708 * class=04 subclass 03 prog-if 80: either of DSP or legacy mode works
710 if (pci
->class == 0x040300) {
711 dev_err(sdev
->dev
, "the DSP is not enabled on this platform, aborting probe\n");
713 } else if (pci
->class != 0x040100 && pci
->class != 0x040380) {
714 dev_err(sdev
->dev
, "unknown PCI class/subclass/prog-if 0x%06x found, aborting probe\n",
718 dev_info_once(sdev
->dev
, "DSP detected with PCI class/subclass/prog-if 0x%06x\n",
722 chip
= get_chip_info(sdev
->pdata
);
724 dev_err(sdev
->dev
, "error: no such device supported, chip id:%x\n",
730 sdev
->num_cores
= chip
->cores_num
;
732 hdev
= devm_kzalloc(sdev
->dev
, sizeof(*hdev
), GFP_KERNEL
);
735 sdev
->pdata
->hw_pdata
= hdev
;
737 ret
= hda_init(sdev
);
742 EXPORT_SYMBOL_NS(hda_dsp_probe_early
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
744 int hda_dsp_probe(struct snd_sof_dev
*sdev
)
746 struct pci_dev
*pci
= to_pci_dev(sdev
->dev
);
747 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
748 const struct sof_intel_dsp_desc
*chip
;
751 hdev
->dmic_dev
= platform_device_register_data(sdev
->dev
, "dmic-codec",
754 if (IS_ERR(hdev
->dmic_dev
)) {
755 dev_err(sdev
->dev
, "error: failed to create DMIC device\n");
756 return PTR_ERR(hdev
->dmic_dev
);
760 * use position update IPC if either it is forced
761 * or we don't have other choice
763 #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_FORCE_IPC_POSITION)
764 hdev
->no_ipc_position
= 0;
766 hdev
->no_ipc_position
= sof_ops(sdev
)->pcm_pointer
? 1 : 0;
769 if (sdev
->dspless_mode_selected
)
770 hdev
->no_ipc_position
= 1;
772 if (sdev
->dspless_mode_selected
)
776 sdev
->bar
[HDA_DSP_BAR
] = pci_ioremap_bar(pci
, HDA_DSP_BAR
);
777 if (!sdev
->bar
[HDA_DSP_BAR
]) {
778 dev_err(sdev
->dev
, "error: ioremap error\n");
783 sdev
->mmio_bar
= HDA_DSP_BAR
;
784 sdev
->mailbox_bar
= HDA_DSP_BAR
;
787 /* allow 64bit DMA address if supported by H/W */
788 if (dma_set_mask_and_coherent(&pci
->dev
, DMA_BIT_MASK(64))) {
789 dev_dbg(sdev
->dev
, "DMA mask is 32 bit\n");
790 dma_set_mask_and_coherent(&pci
->dev
, DMA_BIT_MASK(32));
792 dma_set_max_seg_size(&pci
->dev
, UINT_MAX
);
795 ret
= hda_dsp_stream_init(sdev
);
797 dev_err(sdev
->dev
, "error: failed to init streams\n");
799 * not all errors are due to memory issues, but trying
800 * to free everything does not harm
807 * let's try to enable msi firstly
808 * if it fails, use legacy interrupt mode
809 * TODO: support msi multiple vectors
811 if (hda_use_msi
&& pci_alloc_irq_vectors(pci
, 1, 1, PCI_IRQ_MSI
) > 0) {
812 dev_info(sdev
->dev
, "use msi interrupt mode\n");
813 sdev
->ipc_irq
= pci_irq_vector(pci
, 0);
814 /* initialised to "false" by kzalloc() */
815 sdev
->msi_enabled
= true;
818 if (!sdev
->msi_enabled
) {
819 dev_info(sdev
->dev
, "use legacy interrupt mode\n");
821 * in IO-APIC mode, hda->irq and ipc_irq are using the same
822 * irq number of pci->irq
824 sdev
->ipc_irq
= pci
->irq
;
827 dev_dbg(sdev
->dev
, "using IPC IRQ %d\n", sdev
->ipc_irq
);
828 ret
= request_threaded_irq(sdev
->ipc_irq
, hda_dsp_interrupt_handler
,
829 hda_dsp_interrupt_thread
,
830 IRQF_SHARED
, "AudioDSP", sdev
);
832 dev_err(sdev
->dev
, "error: failed to register IPC IRQ %d\n",
834 goto free_irq_vector
;
838 synchronize_irq(pci
->irq
);
841 * clear TCSEL to clear playback on some HD Audio
842 * codecs. PCI TCSEL is defined in the Intel manuals.
844 snd_sof_pci_update_bits(sdev
, PCI_TCSEL
, 0x07, 0);
846 /* init HDA capabilities */
847 ret
= hda_init_caps(sdev
);
851 if (!sdev
->dspless_mode_selected
) {
852 /* enable ppcap interrupt */
853 hda_dsp_ctrl_ppcap_enable(sdev
, true);
854 hda_dsp_ctrl_ppcap_int_enable(sdev
, true);
856 /* set default mailbox offset for FW ready message */
857 sdev
->dsp_box
.offset
= HDA_DSP_MBOX_UPLINK_OFFSET
;
859 INIT_DELAYED_WORK(&hdev
->d0i3_work
, hda_dsp_d0i3_work
);
862 chip
= get_chip_info(sdev
->pdata
);
863 if (chip
&& chip
->hw_ip_version
>= SOF_INTEL_ACE_2_0
) {
864 ret
= hda_sdw_startup(sdev
);
866 dev_err(sdev
->dev
, "could not startup SoundWire links\n");
871 init_waitqueue_head(&hdev
->waitq
);
873 hdev
->nhlt
= intel_nhlt_init(sdev
->dev
);
878 if (!sdev
->dspless_mode_selected
) {
879 hda_dsp_ctrl_ppcap_int_enable(sdev
, false);
880 hda_dsp_ctrl_ppcap_enable(sdev
, false);
883 free_irq(sdev
->ipc_irq
, sdev
);
885 if (sdev
->msi_enabled
)
886 pci_free_irq_vectors(pci
);
888 hda_dsp_stream_free(sdev
);
889 /* dsp_unmap: not currently used */
890 if (!sdev
->dspless_mode_selected
)
891 iounmap(sdev
->bar
[HDA_DSP_BAR
]);
893 platform_device_unregister(hdev
->dmic_dev
);
897 EXPORT_SYMBOL_NS(hda_dsp_probe
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
899 void hda_dsp_remove(struct snd_sof_dev
*sdev
)
901 struct sof_intel_hda_dev
*hda
= sdev
->pdata
->hw_pdata
;
902 const struct sof_intel_dsp_desc
*chip
= hda
->desc
;
903 struct pci_dev
*pci
= to_pci_dev(sdev
->dev
);
904 struct nhlt_acpi_table
*nhlt
= hda
->nhlt
;
907 intel_nhlt_free(nhlt
);
909 if (!sdev
->dspless_mode_selected
)
910 /* cancel any attempt for DSP D0I3 */
911 cancel_delayed_work_sync(&hda
->d0i3_work
);
913 hda_codec_device_remove(sdev
);
917 if (!IS_ERR_OR_NULL(hda
->dmic_dev
))
918 platform_device_unregister(hda
->dmic_dev
);
920 if (!sdev
->dspless_mode_selected
) {
921 /* disable DSP IRQ */
922 hda_dsp_ctrl_ppcap_int_enable(sdev
, false);
925 /* disable CIE and GIE interrupts */
926 snd_sof_dsp_update_bits(sdev
, HDA_DSP_HDA_BAR
, SOF_HDA_INTCTL
,
927 SOF_HDA_INT_CTRL_EN
| SOF_HDA_INT_GLOBAL_EN
, 0);
929 if (sdev
->dspless_mode_selected
)
930 goto skip_disable_dsp
;
932 /* no need to check for error as the DSP will be disabled anyway */
933 if (chip
&& chip
->power_down_dsp
)
934 chip
->power_down_dsp(sdev
);
937 hda_dsp_ctrl_ppcap_enable(sdev
, false);
939 /* Free the persistent DMA buffers used for base firmware download */
940 if (hda
->cl_dmab
.area
)
941 snd_dma_free_pages(&hda
->cl_dmab
);
942 if (hda
->iccmax_dmab
.area
)
943 snd_dma_free_pages(&hda
->iccmax_dmab
);
946 free_irq(sdev
->ipc_irq
, sdev
);
947 if (sdev
->msi_enabled
)
948 pci_free_irq_vectors(pci
);
950 hda_dsp_stream_free(sdev
);
952 hda_bus_ml_free(sof_to_bus(sdev
));
954 if (!sdev
->dspless_mode_selected
)
955 iounmap(sdev
->bar
[HDA_DSP_BAR
]);
957 EXPORT_SYMBOL_NS(hda_dsp_remove
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
959 void hda_dsp_remove_late(struct snd_sof_dev
*sdev
)
961 iounmap(sof_to_bus(sdev
)->remap_addr
);
962 sof_hda_bus_exit(sdev
);
963 hda_codec_i915_exit(sdev
);
966 int hda_power_down_dsp(struct snd_sof_dev
*sdev
)
968 struct sof_intel_hda_dev
*hda
= sdev
->pdata
->hw_pdata
;
969 const struct sof_intel_dsp_desc
*chip
= hda
->desc
;
971 return hda_dsp_core_reset_power_down(sdev
, chip
->host_managed_cores_mask
);
973 EXPORT_SYMBOL_NS(hda_power_down_dsp
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
975 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC)
976 static void hda_generic_machine_select(struct snd_sof_dev
*sdev
,
977 struct snd_soc_acpi_mach
**mach
)
979 struct hdac_bus
*bus
= sof_to_bus(sdev
);
980 struct snd_soc_acpi_mach_params
*mach_params
;
981 struct snd_soc_acpi_mach
*hda_mach
;
982 struct snd_sof_pdata
*pdata
= sdev
->pdata
;
983 const char *tplg_filename
;
987 /* codec detection */
988 if (!bus
->codec_mask
) {
989 dev_info(bus
->dev
, "no hda codecs found!\n");
991 dev_info(bus
->dev
, "hda codecs found, mask %lx\n",
994 for (i
= 0; i
< HDA_MAX_CODECS
; i
++) {
995 if (bus
->codec_mask
& (1 << i
))
1000 * If no machine driver is found, then:
1002 * generic hda machine driver can handle:
1003 * - one HDMI codec, and/or
1004 * - one external HDAudio codec
1006 if (!*mach
&& codec_num
<= 2) {
1007 bool tplg_fixup
= false;
1009 hda_mach
= snd_soc_acpi_intel_hda_machines
;
1011 dev_info(bus
->dev
, "using HDA machine driver %s now\n",
1012 hda_mach
->drv_name
);
1015 * topology: use the info from hda_machines since tplg file name
1016 * is not overwritten
1018 if (!pdata
->tplg_filename
)
1022 codec_num
== 1 && HDA_IDISP_CODEC(bus
->codec_mask
)) {
1023 tplg_filename
= devm_kasprintf(sdev
->dev
, GFP_KERNEL
,
1025 hda_mach
->sof_tplg_filename
);
1029 hda_mach
->sof_tplg_filename
= tplg_filename
;
1032 if (codec_num
== 2 ||
1033 (codec_num
== 1 && !HDA_IDISP_CODEC(bus
->codec_mask
))) {
1035 * Prevent SoundWire links from starting when an external
1036 * HDaudio codec is used
1038 hda_mach
->mach_params
.link_mask
= 0;
1041 * Allow SoundWire links to start when no external HDaudio codec
1042 * was detected. This will not create a SoundWire card but
1043 * will help detect if any SoundWire codec reports as ATTACHED.
1045 struct sof_intel_hda_dev
*hdev
= sdev
->pdata
->hw_pdata
;
1047 hda_mach
->mach_params
.link_mask
= hdev
->info
.link_mask
;
1054 /* used by hda machine driver to create dai links */
1056 mach_params
= &(*mach
)->mach_params
;
1057 mach_params
->codec_mask
= bus
->codec_mask
;
1061 static void hda_generic_machine_select(struct snd_sof_dev
*sdev
,
1062 struct snd_soc_acpi_mach
**mach
)
1067 #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
1069 static struct snd_soc_acpi_mach
*hda_sdw_machine_select(struct snd_sof_dev
*sdev
)
1071 struct snd_sof_pdata
*pdata
= sdev
->pdata
;
1072 const struct snd_soc_acpi_link_adr
*link
;
1073 struct sdw_peripherals
*peripherals
;
1074 struct snd_soc_acpi_mach
*mach
;
1075 struct sof_intel_hda_dev
*hdev
;
1079 hdev
= pdata
->hw_pdata
;
1080 link_mask
= hdev
->info
.link_mask
;
1083 dev_info(sdev
->dev
, "SoundWire links not enabled\n");
1088 dev_dbg(sdev
->dev
, "SoundWire context not allocated\n");
1092 if (!hdev
->sdw
->peripherals
|| !hdev
->sdw
->peripherals
->num_peripherals
) {
1093 dev_warn(sdev
->dev
, "No SoundWire peripheral detected in ACPI tables\n");
1098 * Select SoundWire machine driver if needed using the
1099 * alternate tables. This case deals with SoundWire-only
1100 * machines, for mixed cases with I2C/I2S the detection relies
1103 for (mach
= pdata
->desc
->alt_machines
;
1104 mach
&& mach
->link_mask
; mach
++) {
1106 * On some platforms such as Up Extreme all links
1107 * are enabled but only one link can be used by
1108 * external codec. Instead of exact match of two masks,
1109 * first check whether link_mask of mach is subset of
1110 * link_mask supported by hw and then go on searching
1113 if (~link_mask
& mach
->link_mask
)
1116 /* No need to match adr if there is no links defined */
1121 for (i
= 0; i
< hdev
->info
.count
&& link
->num_adr
;
1124 * Try next machine if any expected Slaves
1125 * are not found on this link.
1127 if (!snd_soc_acpi_sdw_link_slaves_found(sdev
->dev
, link
,
1128 hdev
->sdw
->peripherals
))
1131 /* Found if all Slaves are checked */
1132 if (i
== hdev
->info
.count
|| !link
->num_adr
)
1133 if (!mach
->machine_check
|| mach
->machine_check(hdev
->sdw
))
1136 if (mach
&& mach
->link_mask
) {
1137 mach
->mach_params
.links
= mach
->links
;
1138 mach
->mach_params
.link_mask
= mach
->link_mask
;
1139 mach
->mach_params
.platform
= dev_name(sdev
->dev
);
1144 dev_info(sdev
->dev
, "No SoundWire machine driver found for the ACPI-reported configuration:\n");
1145 peripherals
= hdev
->sdw
->peripherals
;
1146 for (i
= 0; i
< peripherals
->num_peripherals
; i
++)
1147 dev_info(sdev
->dev
, "link %d mfg_id 0x%04x part_id 0x%04x version %#x\n",
1148 peripherals
->array
[i
]->bus
->link_id
,
1149 peripherals
->array
[i
]->id
.mfg_id
,
1150 peripherals
->array
[i
]->id
.part_id
,
1151 peripherals
->array
[i
]->id
.sdw_version
);
1156 static struct snd_soc_acpi_mach
*hda_sdw_machine_select(struct snd_sof_dev
*sdev
)
1162 void hda_set_mach_params(struct snd_soc_acpi_mach
*mach
,
1163 struct snd_sof_dev
*sdev
)
1165 struct snd_sof_pdata
*pdata
= sdev
->pdata
;
1166 const struct sof_dev_desc
*desc
= pdata
->desc
;
1167 struct snd_soc_acpi_mach_params
*mach_params
;
1169 mach_params
= &mach
->mach_params
;
1170 mach_params
->platform
= dev_name(sdev
->dev
);
1171 if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT
) &&
1172 sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC
))
1173 mach_params
->num_dai_drivers
= SOF_SKL_NUM_DAIS_NOCODEC
;
1175 mach_params
->num_dai_drivers
= desc
->ops
->num_drv
;
1176 mach_params
->dai_drivers
= desc
->ops
->drv
;
1179 static int check_tplg_quirk_mask(struct snd_soc_acpi_mach
*mach
)
1182 u32 codec_amp_name_quirk
;
1185 * In current implementation dmic and ssp quirks are designed for es8336
1186 * machine driver and could not be mixed with codec name and amp name
1189 dmic_ssp_quirk
= mach
->tplg_quirk_mask
&
1190 (SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER
| SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER
);
1191 codec_amp_name_quirk
= mach
->tplg_quirk_mask
&
1192 (SND_SOC_ACPI_TPLG_INTEL_AMP_NAME
| SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME
);
1194 if (dmic_ssp_quirk
&& codec_amp_name_quirk
)
1200 static char *remove_file_ext(const char *tplg_filename
)
1202 char *filename
, *tmp
;
1204 filename
= kstrdup(tplg_filename
, GFP_KERNEL
);
1208 /* remove file extension if exist */
1210 return strsep(&tmp
, ".");
1213 struct snd_soc_acpi_mach
*hda_machine_select(struct snd_sof_dev
*sdev
)
1215 u32 interface_mask
= hda_get_interface_mask(sdev
);
1216 struct snd_sof_pdata
*sof_pdata
= sdev
->pdata
;
1217 const struct sof_dev_desc
*desc
= sof_pdata
->desc
;
1218 struct hdac_bus
*bus
= sof_to_bus(sdev
);
1219 struct snd_soc_acpi_mach
*mach
= NULL
;
1220 enum snd_soc_acpi_intel_codec codec_type
, amp_type
;
1221 const char *tplg_filename
;
1222 const char *tplg_suffix
;
1223 bool amp_name_valid
;
1224 bool i2s_mach_found
= false;
1225 bool sdw_mach_found
= false;
1227 /* Try I2S or DMIC if it is supported */
1228 if (interface_mask
& (BIT(SOF_DAI_INTEL_SSP
) | BIT(SOF_DAI_INTEL_DMIC
))) {
1229 mach
= snd_soc_acpi_find_machine(desc
->machines
);
1231 i2s_mach_found
= true;
1235 * If I2S fails and no external HDaudio codec is detected,
1236 * try SoundWire if it is supported
1238 if (!mach
&& !HDA_EXT_CODEC(bus
->codec_mask
) &&
1239 (interface_mask
& BIT(SOF_DAI_INTEL_ALH
))) {
1240 mach
= hda_sdw_machine_select(sdev
);
1242 sdw_mach_found
= true;
1246 * Choose HDA generic machine driver if mach is NULL.
1247 * Otherwise, set certain mach params.
1249 hda_generic_machine_select(sdev
, &mach
);
1251 dev_warn(sdev
->dev
, "warning: No matching ASoC machine driver found\n");
1255 /* report BT offload link mask to machine driver */
1256 mach
->mach_params
.bt_link_mask
= check_nhlt_ssp_mask(sdev
, NHLT_DEVICE_BT
);
1258 dev_info(sdev
->dev
, "BT link detected in NHLT tables: %#x\n",
1259 mach
->mach_params
.bt_link_mask
);
1261 /* allow for module parameter override */
1262 if (bt_link_mask_override
) {
1263 dev_dbg(sdev
->dev
, "overriding BT link detected in NHLT tables %#x by kernel param %#x\n",
1264 mach
->mach_params
.bt_link_mask
, bt_link_mask_override
);
1265 mach
->mach_params
.bt_link_mask
= bt_link_mask_override
;
1268 if (hweight_long(mach
->mach_params
.bt_link_mask
) > 1) {
1269 dev_warn(sdev
->dev
, "invalid BT link mask %#x found, reset the mask\n",
1270 mach
->mach_params
.bt_link_mask
);
1271 mach
->mach_params
.bt_link_mask
= 0;
1275 * Fixup tplg file name by appending dmic num, ssp num, codec/amplifier
1276 * name string if quirk flag is set.
1279 bool tplg_fixup
= false;
1280 bool dmic_fixup
= false;
1283 * If tplg file name is overridden, use it instead of
1284 * the one set in mach table
1286 if (!sof_pdata
->tplg_filename
) {
1287 /* remove file extension if it exists */
1288 tplg_filename
= remove_file_ext(mach
->sof_tplg_filename
);
1292 sof_pdata
->tplg_filename
= tplg_filename
;
1297 * Checking quirk mask integrity; some quirk flags could not be
1301 check_tplg_quirk_mask(mach
)) {
1302 dev_err(sdev
->dev
, "Invalid tplg quirk mask 0x%x\n",
1303 mach
->tplg_quirk_mask
);
1307 /* report to machine driver if any DMICs are found */
1308 mach
->mach_params
.dmic_num
= check_dmic_num(sdev
);
1310 if (sdw_mach_found
) {
1312 * DMICs use up to 4 pins and are typically pin-muxed with SoundWire
1313 * link 2 and 3, or link 1 and 2, thus we only try to enable dmics
1314 * if all conditions are true:
1315 * a) 2 or fewer links are used by SoundWire
1316 * b) the NHLT table reports the presence of microphones
1318 if (hweight_long(mach
->link_mask
) <= 2)
1321 mach
->mach_params
.dmic_num
= 0;
1323 if (mach
->tplg_quirk_mask
& SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER
)
1329 mach
->mach_params
.dmic_num
) {
1330 tplg_filename
= devm_kasprintf(sdev
->dev
, GFP_KERNEL
,
1332 sof_pdata
->tplg_filename
,
1333 i2s_mach_found
? "-dmic" : "-",
1334 mach
->mach_params
.dmic_num
,
1339 sof_pdata
->tplg_filename
= tplg_filename
;
1342 if (mach
->link_mask
) {
1343 mach
->mach_params
.links
= mach
->links
;
1344 mach
->mach_params
.link_mask
= mach
->link_mask
;
1347 /* report SSP link mask to machine driver */
1348 mach
->mach_params
.i2s_link_mask
= check_nhlt_ssp_mask(sdev
, NHLT_DEVICE_I2S
);
1351 mach
->tplg_quirk_mask
& SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER
&&
1352 mach
->mach_params
.i2s_link_mask
) {
1353 const struct sof_intel_dsp_desc
*chip
= get_chip_info(sdev
->pdata
);
1357 if (hweight_long(mach
->mach_params
.i2s_link_mask
) > 1 &&
1358 !(mach
->tplg_quirk_mask
& SND_SOC_ACPI_TPLG_INTEL_SSP_MSB
))
1359 dev_warn(sdev
->dev
, "More than one SSP exposed by NHLT, choosing MSB\n");
1361 /* fls returns 1-based results, SSPs indices are 0-based */
1362 ssp_num
= fls(mach
->mach_params
.i2s_link_mask
) - 1;
1364 if (ssp_num
>= chip
->ssp_count
) {
1365 dev_err(sdev
->dev
, "Invalid SSP %d, max on this platform is %d\n",
1366 ssp_num
, chip
->ssp_count
);
1370 tplg_filename
= devm_kasprintf(sdev
->dev
, GFP_KERNEL
,
1372 sof_pdata
->tplg_filename
,
1378 sof_pdata
->tplg_filename
= tplg_filename
;
1380 mclk_mask
= check_nhlt_ssp_mclk_mask(sdev
, ssp_num
);
1382 if (mclk_mask
< 0) {
1383 dev_err(sdev
->dev
, "Invalid MCLK configuration\n");
1387 dev_dbg(sdev
->dev
, "MCLK mask %#x found in NHLT\n", mclk_mask
);
1390 dev_info(sdev
->dev
, "Overriding topology with MCLK mask %#x from NHLT\n", mclk_mask
);
1391 sdev
->mclk_id_override
= true;
1392 sdev
->mclk_id_quirk
= (mclk_mask
& BIT(0)) ? 0 : 1;
1396 amp_type
= snd_soc_acpi_intel_detect_amp_type(sdev
->dev
);
1397 codec_type
= snd_soc_acpi_intel_detect_codec_type(sdev
->dev
);
1398 amp_name_valid
= amp_type
!= CODEC_NONE
&& amp_type
!= codec_type
;
1400 if (tplg_fixup
&& amp_name_valid
&&
1401 mach
->tplg_quirk_mask
& SND_SOC_ACPI_TPLG_INTEL_AMP_NAME
) {
1402 tplg_suffix
= snd_soc_acpi_intel_get_amp_tplg_suffix(amp_type
);
1404 dev_err(sdev
->dev
, "no tplg suffix found, amp %d\n",
1409 tplg_filename
= devm_kasprintf(sdev
->dev
, GFP_KERNEL
,
1411 sof_pdata
->tplg_filename
,
1416 sof_pdata
->tplg_filename
= tplg_filename
;
1421 mach
->tplg_quirk_mask
& SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME
&&
1422 codec_type
!= CODEC_NONE
) {
1423 tplg_suffix
= snd_soc_acpi_intel_get_codec_tplg_suffix(codec_type
);
1425 dev_err(sdev
->dev
, "no tplg suffix found, codec %d\n",
1430 tplg_filename
= devm_kasprintf(sdev
->dev
, GFP_KERNEL
,
1432 sof_pdata
->tplg_filename
,
1437 sof_pdata
->tplg_filename
= tplg_filename
;
1441 tplg_filename
= devm_kasprintf(sdev
->dev
, GFP_KERNEL
,
1443 sof_pdata
->tplg_filename
,
1448 sof_pdata
->tplg_filename
= tplg_filename
;
1451 /* check if mclk_id should be modified from topology defaults */
1452 if (mclk_id_override
>= 0) {
1453 dev_info(sdev
->dev
, "Overriding topology with MCLK %d from kernel_parameter\n", mclk_id_override
);
1454 sdev
->mclk_id_override
= true;
1455 sdev
->mclk_id_quirk
= mclk_id_override
;
1462 int hda_pci_intel_probe(struct pci_dev
*pci
, const struct pci_device_id
*pci_id
)
1466 ret
= snd_intel_dsp_driver_probe(pci
);
1467 if (ret
!= SND_INTEL_DSP_DRIVER_ANY
&& ret
!= SND_INTEL_DSP_DRIVER_SOF
) {
1468 dev_dbg(&pci
->dev
, "SOF PCI driver not selected, aborting probe\n");
1472 return sof_pci_probe(pci
, pci_id
);
1474 EXPORT_SYMBOL_NS(hda_pci_intel_probe
, "SND_SOC_SOF_INTEL_HDA_GENERIC");
1476 int hda_register_clients(struct snd_sof_dev
*sdev
)
1478 return hda_probes_register(sdev
);
1481 void hda_unregister_clients(struct snd_sof_dev
*sdev
)
1483 hda_probes_unregister(sdev
);
1486 MODULE_LICENSE("Dual BSD/GPL");
1487 MODULE_DESCRIPTION("SOF support for HDaudio platforms");
1488 MODULE_IMPORT_NS("SND_SOC_SOF_PCI_DEV");
1489 MODULE_IMPORT_NS("SND_SOC_SOF_HDA_AUDIO_CODEC");
1490 MODULE_IMPORT_NS("SND_SOC_SOF_HDA_AUDIO_CODEC_I915");
1491 MODULE_IMPORT_NS("SND_SOC_SOF_XTENSA");
1492 MODULE_IMPORT_NS("SND_INTEL_SOUNDWIRE_ACPI");
1493 MODULE_IMPORT_NS("SOUNDWIRE_INTEL_INIT");
1494 MODULE_IMPORT_NS("SOUNDWIRE_INTEL");
1495 MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK");
1496 MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_COMMON");
1497 MODULE_IMPORT_NS("SND_SOC_ACPI_INTEL_MATCH");