Lines Matching +full:dai +full:- +full:links
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
26 #include <sound/intel-dsp-config.h>
27 #include <sound/intel-nhlt.h>
28 #include <sound/soc-acpi-intel-ssp-common.h>
31 #include <sound/hda-mlink.h>
32 #include "../sof-audio.h"
33 #include "../sof-pci-dev.h"
35 #include "../ipc4-topology.h"
41 #include <sound/soc-acpi-intel-match.h>
62 struct snd_soc_dai *d = params_data->dai; in sdw_params_stream()
63 struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(d, params_data->substream->stream); in sdw_params_stream()
68 d->name); in sdw_params_stream()
69 return -EINVAL; in sdw_params_stream()
71 data.dai_index = (params_data->link_id << 8) | d->id; in sdw_params_stream()
72 data.dai_data = params_data->alh_stream_id; in sdw_params_stream()
80 struct snd_soc_dai *d = free_data->dai; in sdw_params_free()
81 struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(d, free_data->substream->stream); in sdw_params_free()
84 if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) { in sdw_params_free()
85 struct snd_sof_widget *swidget = w->dobj.private; in sdw_params_free()
86 struct snd_sof_dai *dai = swidget->private; in sdw_params_free() local
90 ipc4_copier = dai->private; in sdw_params_free()
91 ipc4_copier->dai_index = 0; in sdw_params_free()
92 copier_data = &ipc4_copier->data; in sdw_params_free()
95 copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK; in sdw_params_free()
109 return sdw_hda_dai_hw_params(params_data->substream, in sdw_ace2x_params_stream()
110 params_data->hw_params, in sdw_ace2x_params_stream()
111 params_data->dai, in sdw_ace2x_params_stream()
112 params_data->link_id, in sdw_ace2x_params_stream()
113 params_data->alh_stream_id); in sdw_ace2x_params_stream()
119 return sdw_hda_dai_hw_free(free_data->substream, in sdw_ace2x_free_stream()
120 free_data->dai, in sdw_ace2x_free_stream()
121 free_data->link_id); in sdw_ace2x_free_stream()
124 static int sdw_ace2x_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) in sdw_ace2x_trigger() argument
126 return sdw_hda_dai_trigger(substream, cmd, dai); in sdw_ace2x_trigger()
143 return -EINVAL; in hda_sdw_acpi_scan()
145 handle = ACPI_HANDLE(sdev->dev); in hda_sdw_acpi_scan()
148 hdev = sdev->pdata->hw_pdata; in hda_sdw_acpi_scan()
150 ret = sdw_intel_acpi_scan(handle, &hdev->info); in hda_sdw_acpi_scan()
152 return -EINVAL; in hda_sdw_acpi_scan()
164 hdev = sdev->pdata->hw_pdata; in hda_sdw_probe()
168 chip = get_chip_info(sdev->pdata); in hda_sdw_probe()
169 if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) { in hda_sdw_probe()
170 res.mmio_base = sdev->bar[HDA_DSP_BAR]; in hda_sdw_probe()
172 res.shim_base = hdev->desc->sdw_shim_base; in hda_sdw_probe()
173 res.alh_base = hdev->desc->sdw_alh_base; in hda_sdw_probe()
179 * in the HDaudio multi-link areas in hda_sdw_probe()
184 return -ENODEV; in hda_sdw_probe()
186 res.mmio_base = sdev->bar[HDA_DSP_HDA_BAR]; in hda_sdw_probe()
188 * the SHIM and SoundWire register offsets are link-specific in hda_sdw_probe()
196 res.irq = sdev->ipc_irq; in hda_sdw_probe()
197 res.handle = hdev->info.handle; in hda_sdw_probe()
198 res.parent = sdev->dev; in hda_sdw_probe()
200 res.dev = sdev->dev; in hda_sdw_probe()
206 * they will be needed when the DAI callbacks are in hda_sdw_probe()
210 /* we could filter links here if needed, e.g for quirks */ in hda_sdw_probe()
211 res.count = hdev->info.count; in hda_sdw_probe()
212 res.link_mask = hdev->info.link_mask; in hda_sdw_probe()
216 dev_err(sdev->dev, "error: SoundWire probe failed\n"); in hda_sdw_probe()
217 return -EINVAL; in hda_sdw_probe()
221 hdev->sdw = sdw; in hda_sdw_probe()
229 struct snd_sof_pdata *pdata = sdev->pdata; in hda_sdw_startup()
232 hdev = sdev->pdata->hw_pdata; in hda_sdw_startup()
234 if (!hdev->sdw) in hda_sdw_startup()
237 if (pdata->machine && !pdata->machine->mach_params.link_mask) in hda_sdw_startup()
244 return sdw_intel_startup(hdev->sdw); in hda_sdw_startup()
252 hdev = sdev->pdata->hw_pdata; in hda_sdw_exit()
254 if (hdev->sdw) in hda_sdw_exit()
255 sdw_intel_exit(hdev->sdw); in hda_sdw_exit()
256 hdev->sdw = NULL; in hda_sdw_exit()
269 hdev = sdev->pdata->hw_pdata; in hda_common_check_sdw_irq()
271 if (!hdev->sdw) in hda_common_check_sdw_irq()
298 chip = get_chip_info(sdev->pdata); in hda_dsp_check_sdw_irq()
299 if (chip && chip->check_sdw_irq) in hda_dsp_check_sdw_irq()
300 return chip->check_sdw_irq(sdev); in hda_dsp_check_sdw_irq()
314 hdev = sdev->pdata->hw_pdata; in hda_sdw_check_wakeen_irq_common()
315 if (hdev->sdw && in hda_sdw_check_wakeen_irq_common()
317 hdev->desc->sdw_shim_base + SDW_SHIM_WAKESTS)) in hda_sdw_check_wakeen_irq_common()
332 chip = get_chip_info(sdev->pdata); in hda_sdw_check_wakeen_irq()
333 if (chip && chip->check_sdw_wakeen_irq) in hda_sdw_check_wakeen_irq()
334 return chip->check_sdw_wakeen_irq(sdev); in hda_sdw_check_wakeen_irq()
347 hdev = sdev->pdata->hw_pdata; in hda_sdw_process_wakeen_common()
348 if (!hdev->sdw) in hda_sdw_process_wakeen_common()
351 sdw_intel_process_wakeen_event(hdev->sdw); in hda_sdw_process_wakeen_common()
400 if (sdev->first_boot) { in hda_dsp_post_fw_run()
401 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in hda_dsp_post_fw_run()
405 dev_err(sdev->dev, in hda_dsp_post_fw_run()
406 "error: could not startup SoundWire links\n"); in hda_dsp_post_fw_run()
412 (sdev->fw_ready.flags & SOF_IPC_INFO_D3_PERSISTENT || in hda_dsp_post_fw_run()
413 sdev->pdata->ipc_type == SOF_IPC_TYPE_4)) { in hda_dsp_post_fw_run()
414 hdev->imrboot_supported = true; in hda_dsp_post_fw_run()
416 0644, sdev->debugfs_root, in hda_dsp_post_fw_run()
417 &hdev->skip_imr_boot); in hda_dsp_post_fw_run()
423 /* re-enable clock gating and power gating */ in hda_dsp_post_fw_run()
444 static int dmic_num_override = -1;
448 static int mclk_id_override = -1;
460 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_init()
467 sof_hda_bus_init(sdev, &pci->dev); in hda_init()
470 bus->use_posbuf = 0; in hda_init()
472 bus->use_posbuf = 1; in hda_init()
473 bus->bdl_pos_adj = 0; in hda_init()
474 bus->sync_write = 1; in hda_init()
476 mutex_init(&hbus->prepare_mutex); in hda_init()
477 hbus->pci = pci; in hda_init()
478 hbus->mixer_assigned = -1; in hda_init()
479 hbus->modelname = hda_model; in hda_init()
482 bus->addr = pci_resource_start(pci, 0); in hda_init()
483 bus->remap_addr = pci_ioremap_bar(pci, 0); in hda_init()
484 if (!bus->remap_addr) { in hda_init()
485 dev_err(bus->dev, "error: ioremap error\n"); in hda_init()
486 return -ENXIO; in hda_init()
490 sdev->bar[HDA_DSP_HDA_BAR] = bus->remap_addr; in hda_init()
494 if (ret < 0 && ret != -ENODEV) { in hda_init()
495 dev_err_probe(sdev->dev, ret, "init of i915 and HDMI codec failed\n"); in hda_init()
502 dev_err(sdev->dev, "error: get caps error\n"); in hda_init()
508 iounmap(sof_to_bus(sdev)->remap_addr); in hda_init()
515 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in check_dmic_num()
519 nhlt = hdev->nhlt; in check_dmic_num()
521 dmic_num = intel_nhlt_get_dmic_geo(sdev->dev, nhlt); in check_dmic_num()
523 dev_info(sdev->dev, "DMICs detected in NHLT tables: %d\n", dmic_num); in check_dmic_num()
526 if (dmic_num_override != -1) { in check_dmic_num()
527 dev_dbg(sdev->dev, in check_dmic_num()
534 dev_dbg(sdev->dev, "invalid dmic_number %d\n", dmic_num); in check_dmic_num()
543 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in check_nhlt_ssp_mask()
547 nhlt = hdev->nhlt; in check_nhlt_ssp_mask()
554 dev_info(sdev->dev, "NHLT device %s(%d) detected, ssp_mask %#x\n", in check_nhlt_ssp_mask()
564 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in check_nhlt_ssp_mclk_mask()
567 nhlt = hdev->nhlt; in check_nhlt_ssp_mclk_mask()
578 struct snd_sof_pdata *pdata = sdev->pdata; in hda_init_caps()
579 struct sof_intel_hda_dev *hdev = pdata->hw_pdata; in hda_init_caps()
584 if (bus->ppcap) in hda_init_caps()
585 dev_dbg(sdev->dev, "PP capability, will probe DSP later.\n"); in hda_init_caps()
590 dev_err(bus->dev, "error: init chip failed with ret: %d\n", in hda_init_caps()
604 dev_dbg(sdev->dev, "skipping SoundWire, not detected with ACPI scan\n"); in hda_init_caps()
608 link_mask = hdev->info.link_mask; in hda_init_caps()
610 dev_dbg(sdev->dev, "skipping SoundWire, no links enabled\n"); in hda_init_caps()
623 dev_err(sdev->dev, "error: SoundWire probe error\n"); in hda_init_caps()
632 if (!HDA_IDISP_CODEC(bus->codec_mask)) in hda_init_caps()
666 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in hda_dsp_interrupt_thread()
676 sof_ops(sdev)->irq_thread(irq, sdev); in hda_dsp_interrupt_thread()
681 hda_dsp_sdw_thread(irq, hdev->sdw); in hda_dsp_interrupt_thread()
702 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_probe_early()
707 if (!sdev->dspless_mode_selected) { in hda_dsp_probe_early()
709 * detect DSP by checking class/subclass/prog-id information in hda_dsp_probe_early()
710 * class=04 subclass 03 prog-if 00: no DSP, legacy driver is required in hda_dsp_probe_early()
711 * class=04 subclass 01 prog-if 00: DSP is present in hda_dsp_probe_early()
713 * class=04 subclass 03 prog-if 80: either of DSP or legacy mode works in hda_dsp_probe_early()
715 if (pci->class == 0x040300) { in hda_dsp_probe_early()
716 dev_err(sdev->dev, "the DSP is not enabled on this platform, aborting probe\n"); in hda_dsp_probe_early()
717 return -ENODEV; in hda_dsp_probe_early()
718 } else if (pci->class != 0x040100 && pci->class != 0x040380) { in hda_dsp_probe_early()
719 dev_err(sdev->dev, "unknown PCI class/subclass/prog-if 0x%06x found, aborting probe\n", in hda_dsp_probe_early()
720 pci->class); in hda_dsp_probe_early()
721 return -ENODEV; in hda_dsp_probe_early()
723 dev_info_once(sdev->dev, "DSP detected with PCI class/subclass/prog-if 0x%06x\n", in hda_dsp_probe_early()
724 pci->class); in hda_dsp_probe_early()
727 chip = get_chip_info(sdev->pdata); in hda_dsp_probe_early()
729 dev_err(sdev->dev, "error: no such device supported, chip id:%x\n", in hda_dsp_probe_early()
730 pci->device); in hda_dsp_probe_early()
731 ret = -EIO; in hda_dsp_probe_early()
735 sdev->num_cores = chip->cores_num; in hda_dsp_probe_early()
737 hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL); in hda_dsp_probe_early()
739 return -ENOMEM; in hda_dsp_probe_early()
740 sdev->pdata->hw_pdata = hdev; in hda_dsp_probe_early()
741 hdev->desc = chip; in hda_dsp_probe_early()
751 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_probe()
752 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in hda_dsp_probe()
756 hdev->dmic_dev = platform_device_register_data(sdev->dev, "dmic-codec", in hda_dsp_probe()
759 if (IS_ERR(hdev->dmic_dev)) { in hda_dsp_probe()
760 dev_err(sdev->dev, "error: failed to create DMIC device\n"); in hda_dsp_probe()
761 return PTR_ERR(hdev->dmic_dev); in hda_dsp_probe()
769 hdev->no_ipc_position = 0; in hda_dsp_probe()
771 hdev->no_ipc_position = sof_ops(sdev)->pcm_pointer ? 1 : 0; in hda_dsp_probe()
774 if (sdev->dspless_mode_selected) in hda_dsp_probe()
775 hdev->no_ipc_position = 1; in hda_dsp_probe()
777 if (sdev->dspless_mode_selected) in hda_dsp_probe()
781 sdev->bar[HDA_DSP_BAR] = pci_ioremap_bar(pci, HDA_DSP_BAR); in hda_dsp_probe()
782 if (!sdev->bar[HDA_DSP_BAR]) { in hda_dsp_probe()
783 dev_err(sdev->dev, "error: ioremap error\n"); in hda_dsp_probe()
784 ret = -ENXIO; in hda_dsp_probe()
788 sdev->mmio_bar = HDA_DSP_BAR; in hda_dsp_probe()
789 sdev->mailbox_bar = HDA_DSP_BAR; in hda_dsp_probe()
793 if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64))) { in hda_dsp_probe()
794 dev_dbg(sdev->dev, "DMA mask is 32 bit\n"); in hda_dsp_probe()
795 dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32)); in hda_dsp_probe()
797 dma_set_max_seg_size(&pci->dev, UINT_MAX); in hda_dsp_probe()
802 dev_err(sdev->dev, "error: failed to init streams\n"); in hda_dsp_probe()
817 dev_info(sdev->dev, "use msi interrupt mode\n"); in hda_dsp_probe()
818 sdev->ipc_irq = pci_irq_vector(pci, 0); in hda_dsp_probe()
820 sdev->msi_enabled = true; in hda_dsp_probe()
823 if (!sdev->msi_enabled) { in hda_dsp_probe()
824 dev_info(sdev->dev, "use legacy interrupt mode\n"); in hda_dsp_probe()
826 * in IO-APIC mode, hda->irq and ipc_irq are using the same in hda_dsp_probe()
827 * irq number of pci->irq in hda_dsp_probe()
829 sdev->ipc_irq = pci->irq; in hda_dsp_probe()
832 dev_dbg(sdev->dev, "using IPC IRQ %d\n", sdev->ipc_irq); in hda_dsp_probe()
833 ret = request_threaded_irq(sdev->ipc_irq, hda_dsp_interrupt_handler, in hda_dsp_probe()
837 dev_err(sdev->dev, "error: failed to register IPC IRQ %d\n", in hda_dsp_probe()
838 sdev->ipc_irq); in hda_dsp_probe()
843 synchronize_irq(pci->irq); in hda_dsp_probe()
856 if (!sdev->dspless_mode_selected) { in hda_dsp_probe()
862 sdev->dsp_box.offset = HDA_DSP_MBOX_UPLINK_OFFSET; in hda_dsp_probe()
864 INIT_DELAYED_WORK(&hdev->d0i3_work, hda_dsp_d0i3_work); in hda_dsp_probe()
867 chip = get_chip_info(sdev->pdata); in hda_dsp_probe()
868 if (chip && chip->hw_ip_version >= SOF_INTEL_ACE_2_0) { in hda_dsp_probe()
871 dev_err(sdev->dev, "could not startup SoundWire links\n"); in hda_dsp_probe()
876 init_waitqueue_head(&hdev->waitq); in hda_dsp_probe()
878 hdev->nhlt = intel_nhlt_init(sdev->dev); in hda_dsp_probe()
883 if (!sdev->dspless_mode_selected) { in hda_dsp_probe()
888 free_irq(sdev->ipc_irq, sdev); in hda_dsp_probe()
890 if (sdev->msi_enabled) in hda_dsp_probe()
895 if (!sdev->dspless_mode_selected) in hda_dsp_probe()
896 iounmap(sdev->bar[HDA_DSP_BAR]); in hda_dsp_probe()
898 platform_device_unregister(hdev->dmic_dev); in hda_dsp_probe()
906 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_remove()
907 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_dsp_remove()
908 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_remove()
909 struct nhlt_acpi_table *nhlt = hda->nhlt; in hda_dsp_remove()
914 if (!sdev->dspless_mode_selected) in hda_dsp_remove()
916 cancel_delayed_work_sync(&hda->d0i3_work); in hda_dsp_remove()
922 if (!IS_ERR_OR_NULL(hda->dmic_dev)) in hda_dsp_remove()
923 platform_device_unregister(hda->dmic_dev); in hda_dsp_remove()
925 if (!sdev->dspless_mode_selected) { in hda_dsp_remove()
934 if (sdev->dspless_mode_selected) in hda_dsp_remove()
938 if (chip && chip->power_down_dsp) in hda_dsp_remove()
939 chip->power_down_dsp(sdev); in hda_dsp_remove()
945 if (hda->cl_dmab.area) in hda_dsp_remove()
946 snd_dma_free_pages(&hda->cl_dmab); in hda_dsp_remove()
947 if (hda->iccmax_dmab.area) in hda_dsp_remove()
948 snd_dma_free_pages(&hda->iccmax_dmab); in hda_dsp_remove()
951 free_irq(sdev->ipc_irq, sdev); in hda_dsp_remove()
952 if (sdev->msi_enabled) in hda_dsp_remove()
959 if (!sdev->dspless_mode_selected) in hda_dsp_remove()
960 iounmap(sdev->bar[HDA_DSP_BAR]); in hda_dsp_remove()
966 iounmap(sof_to_bus(sdev)->remap_addr); in hda_dsp_remove_late()
973 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_power_down_dsp()
974 const struct sof_intel_dsp_desc *chip = hda->desc; in hda_power_down_dsp()
976 return hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask); in hda_power_down_dsp()
987 struct snd_sof_pdata *pdata = sdev->pdata; in hda_generic_machine_select()
993 if (!bus->codec_mask) { in hda_generic_machine_select()
994 dev_info(bus->dev, "no hda codecs found!\n"); in hda_generic_machine_select()
996 dev_info(bus->dev, "hda codecs found, mask %lx\n", in hda_generic_machine_select()
997 bus->codec_mask); in hda_generic_machine_select()
1000 if (bus->codec_mask & (1 << i)) in hda_generic_machine_select()
1008 * - one HDMI codec, and/or in hda_generic_machine_select()
1009 * - one external HDAudio codec in hda_generic_machine_select()
1016 dev_info(bus->dev, "using HDA machine driver %s now\n", in hda_generic_machine_select()
1017 hda_mach->drv_name); in hda_generic_machine_select()
1023 if (!pdata->tplg_filename) in hda_generic_machine_select()
1027 codec_num == 1 && HDA_IDISP_CODEC(bus->codec_mask)) { in hda_generic_machine_select()
1028 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in hda_generic_machine_select()
1029 "%s-idisp", in hda_generic_machine_select()
1030 hda_mach->sof_tplg_filename); in hda_generic_machine_select()
1034 hda_mach->sof_tplg_filename = tplg_filename; in hda_generic_machine_select()
1038 (codec_num == 1 && !HDA_IDISP_CODEC(bus->codec_mask))) { in hda_generic_machine_select()
1040 * Prevent SoundWire links from starting when an external in hda_generic_machine_select()
1043 hda_mach->mach_params.link_mask = 0; in hda_generic_machine_select()
1046 * Allow SoundWire links to start when no external HDaudio codec in hda_generic_machine_select()
1050 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in hda_generic_machine_select()
1052 hda_mach->mach_params.link_mask = hdev->info.link_mask; in hda_generic_machine_select()
1059 /* used by hda machine driver to create dai links */ in hda_generic_machine_select()
1061 mach_params = &(*mach)->mach_params; in hda_generic_machine_select()
1062 mach_params->codec_mask = bus->codec_mask; in hda_generic_machine_select()
1076 struct snd_sof_pdata *pdata = sdev->pdata; in hda_sdw_machine_select()
1084 hdev = pdata->hw_pdata; in hda_sdw_machine_select()
1085 link_mask = hdev->info.link_mask; in hda_sdw_machine_select()
1088 dev_info(sdev->dev, "SoundWire links not enabled\n"); in hda_sdw_machine_select()
1092 if (!hdev->sdw) { in hda_sdw_machine_select()
1093 dev_dbg(sdev->dev, "SoundWire context not allocated\n"); in hda_sdw_machine_select()
1097 if (!hdev->sdw->peripherals || !hdev->sdw->peripherals->num_peripherals) { in hda_sdw_machine_select()
1098 dev_warn(sdev->dev, "No SoundWire peripheral detected in ACPI tables\n"); in hda_sdw_machine_select()
1104 * alternate tables. This case deals with SoundWire-only in hda_sdw_machine_select()
1108 for (mach = pdata->desc->alt_machines; in hda_sdw_machine_select()
1109 mach && mach->link_mask; mach++) { in hda_sdw_machine_select()
1111 * On some platforms such as Up Extreme all links in hda_sdw_machine_select()
1118 if (~link_mask & mach->link_mask) in hda_sdw_machine_select()
1121 /* No need to match adr if there is no links defined */ in hda_sdw_machine_select()
1122 if (!mach->links) in hda_sdw_machine_select()
1125 link = mach->links; in hda_sdw_machine_select()
1126 for (i = 0; i < hdev->info.count && link->num_adr; in hda_sdw_machine_select()
1132 if (!snd_soc_acpi_sdw_link_slaves_found(sdev->dev, link, in hda_sdw_machine_select()
1133 hdev->sdw->peripherals)) in hda_sdw_machine_select()
1137 if (i == hdev->info.count || !link->num_adr) in hda_sdw_machine_select()
1138 if (!mach->machine_check || mach->machine_check(hdev->sdw)) in hda_sdw_machine_select()
1141 if (mach && mach->link_mask) { in hda_sdw_machine_select()
1142 mach->mach_params.links = mach->links; in hda_sdw_machine_select()
1143 mach->mach_params.link_mask = mach->link_mask; in hda_sdw_machine_select()
1144 mach->mach_params.platform = dev_name(sdev->dev); in hda_sdw_machine_select()
1149 dev_info(sdev->dev, "No SoundWire machine driver found for the ACPI-reported configuration:\n"); in hda_sdw_machine_select()
1150 peripherals = hdev->sdw->peripherals; in hda_sdw_machine_select()
1151 for (i = 0; i < peripherals->num_peripherals; i++) in hda_sdw_machine_select()
1152 dev_info(sdev->dev, "link %d mfg_id 0x%04x part_id 0x%04x version %#x\n", in hda_sdw_machine_select()
1153 peripherals->array[i]->bus->link_id, in hda_sdw_machine_select()
1154 peripherals->array[i]->id.mfg_id, in hda_sdw_machine_select()
1155 peripherals->array[i]->id.part_id, in hda_sdw_machine_select()
1156 peripherals->array[i]->id.sdw_version); in hda_sdw_machine_select()
1170 struct snd_sof_pdata *pdata = sdev->pdata; in hda_set_mach_params()
1171 const struct sof_dev_desc *desc = pdata->desc; in hda_set_mach_params()
1174 mach_params = &mach->mach_params; in hda_set_mach_params()
1175 mach_params->platform = dev_name(sdev->dev); in hda_set_mach_params()
1178 mach_params->num_dai_drivers = SOF_SKL_NUM_DAIS_NOCODEC; in hda_set_mach_params()
1180 mach_params->num_dai_drivers = desc->ops->num_drv; in hda_set_mach_params()
1181 mach_params->dai_drivers = desc->ops->drv; in hda_set_mach_params()
1194 dmic_ssp_quirk = mach->tplg_quirk_mask & in check_tplg_quirk_mask()
1196 codec_amp_name_quirk = mach->tplg_quirk_mask & in check_tplg_quirk_mask()
1200 return -EINVAL; in check_tplg_quirk_mask()
1221 struct snd_sof_pdata *sof_pdata = sdev->pdata; in hda_machine_select()
1222 const struct sof_dev_desc *desc = sof_pdata->desc; in hda_machine_select()
1234 mach = snd_soc_acpi_find_machine(desc->machines); in hda_machine_select()
1243 if (!mach && !HDA_EXT_CODEC(bus->codec_mask) && in hda_machine_select()
1256 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in hda_machine_select()
1261 mach->mach_params.bt_link_mask = check_nhlt_ssp_mask(sdev, NHLT_DEVICE_BT); in hda_machine_select()
1263 dev_info(sdev->dev, "BT link detected in NHLT tables: %#x\n", in hda_machine_select()
1264 mach->mach_params.bt_link_mask); in hda_machine_select()
1268 dev_dbg(sdev->dev, "overriding BT link detected in NHLT tables %#x by kernel param %#x\n", in hda_machine_select()
1269 mach->mach_params.bt_link_mask, bt_link_mask_override); in hda_machine_select()
1270 mach->mach_params.bt_link_mask = bt_link_mask_override; in hda_machine_select()
1273 if (hweight_long(mach->mach_params.bt_link_mask) > 1) { in hda_machine_select()
1274 dev_warn(sdev->dev, "invalid BT link mask %#x found, reset the mask\n", in hda_machine_select()
1275 mach->mach_params.bt_link_mask); in hda_machine_select()
1276 mach->mach_params.bt_link_mask = 0; in hda_machine_select()
1291 if (!sof_pdata->tplg_filename) { in hda_machine_select()
1293 tplg_filename = remove_file_ext(mach->sof_tplg_filename); in hda_machine_select()
1297 sof_pdata->tplg_filename = tplg_filename; in hda_machine_select()
1307 dev_err(sdev->dev, "Invalid tplg quirk mask 0x%x\n", in hda_machine_select()
1308 mach->tplg_quirk_mask); in hda_machine_select()
1313 mach->mach_params.dmic_num = check_dmic_num(sdev); in hda_machine_select()
1315 if (sdw_mach_found || mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER) in hda_machine_select()
1320 mach->mach_params.dmic_num) { in hda_machine_select()
1321 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in hda_machine_select()
1323 sof_pdata->tplg_filename, in hda_machine_select()
1324 i2s_mach_found ? "-dmic" : "-", in hda_machine_select()
1325 mach->mach_params.dmic_num, in hda_machine_select()
1330 sof_pdata->tplg_filename = tplg_filename; in hda_machine_select()
1333 if (mach->link_mask) { in hda_machine_select()
1334 mach->mach_params.links = mach->links; in hda_machine_select()
1335 mach->mach_params.link_mask = mach->link_mask; in hda_machine_select()
1339 mach->mach_params.i2s_link_mask = check_nhlt_ssp_mask(sdev, NHLT_DEVICE_I2S); in hda_machine_select()
1342 mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER && in hda_machine_select()
1343 mach->mach_params.i2s_link_mask) { in hda_machine_select()
1344 const struct sof_intel_dsp_desc *chip = get_chip_info(sdev->pdata); in hda_machine_select()
1348 if (hweight_long(mach->mach_params.i2s_link_mask) > 1 && in hda_machine_select()
1349 !(mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_SSP_MSB)) in hda_machine_select()
1350 dev_warn(sdev->dev, "More than one SSP exposed by NHLT, choosing MSB\n"); in hda_machine_select()
1352 /* fls returns 1-based results, SSPs indices are 0-based */ in hda_machine_select()
1353 ssp_num = fls(mach->mach_params.i2s_link_mask) - 1; in hda_machine_select()
1355 if (ssp_num >= chip->ssp_count) { in hda_machine_select()
1356 dev_err(sdev->dev, "Invalid SSP %d, max on this platform is %d\n", in hda_machine_select()
1357 ssp_num, chip->ssp_count); in hda_machine_select()
1361 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in hda_machine_select()
1363 sof_pdata->tplg_filename, in hda_machine_select()
1364 "-ssp", in hda_machine_select()
1369 sof_pdata->tplg_filename = tplg_filename; in hda_machine_select()
1374 dev_err(sdev->dev, "Invalid MCLK configuration\n"); in hda_machine_select()
1378 dev_dbg(sdev->dev, "MCLK mask %#x found in NHLT\n", mclk_mask); in hda_machine_select()
1381 dev_info(sdev->dev, "Overriding topology with MCLK mask %#x from NHLT\n", mclk_mask); in hda_machine_select()
1382 sdev->mclk_id_override = true; in hda_machine_select()
1383 sdev->mclk_id_quirk = (mclk_mask & BIT(0)) ? 0 : 1; in hda_machine_select()
1387 amp_type = snd_soc_acpi_intel_detect_amp_type(sdev->dev); in hda_machine_select()
1388 codec_type = snd_soc_acpi_intel_detect_codec_type(sdev->dev); in hda_machine_select()
1392 mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_AMP_NAME) { in hda_machine_select()
1395 dev_err(sdev->dev, "no tplg suffix found, amp %d\n", in hda_machine_select()
1400 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in hda_machine_select()
1401 "%s-%s", in hda_machine_select()
1402 sof_pdata->tplg_filename, in hda_machine_select()
1407 sof_pdata->tplg_filename = tplg_filename; in hda_machine_select()
1412 mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME && in hda_machine_select()
1416 dev_err(sdev->dev, "no tplg suffix found, codec %d\n", in hda_machine_select()
1421 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in hda_machine_select()
1422 "%s-%s", in hda_machine_select()
1423 sof_pdata->tplg_filename, in hda_machine_select()
1428 sof_pdata->tplg_filename = tplg_filename; in hda_machine_select()
1432 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in hda_machine_select()
1434 sof_pdata->tplg_filename, in hda_machine_select()
1439 sof_pdata->tplg_filename = tplg_filename; in hda_machine_select()
1444 … dev_info(sdev->dev, "Overriding topology with MCLK %d from kernel_parameter\n", mclk_id_override); in hda_machine_select()
1445 sdev->mclk_id_override = true; in hda_machine_select()
1446 sdev->mclk_id_quirk = mclk_id_override; in hda_machine_select()
1459 dev_dbg(&pci->dev, "SOF PCI driver not selected, aborting probe\n"); in hda_pci_intel_probe()
1460 return -ENODEV; in hda_pci_intel_probe()