Lines Matching refs:sdev
70 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sdw_params_stream() local
87 ret = sof_ipc_tx_message(sdev->ipc, in sdw_params_stream()
91 dev_err(sdev->dev, in sdw_params_stream()
102 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sdw_free_stream() local
118 ret = sof_ipc_tx_message(sdev->ipc, in sdw_free_stream()
122 dev_err(sdev->dev, in sdw_free_stream()
135 void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) in hda_sdw_int_enable() argument
137 sdw_intel_enable_irq(sdev->bar[HDA_DSP_BAR], enable); in hda_sdw_int_enable()
140 static int hda_sdw_acpi_scan(struct snd_sof_dev *sdev) in hda_sdw_acpi_scan() argument
146 handle = ACPI_HANDLE(sdev->dev); in hda_sdw_acpi_scan()
149 hdev = sdev->pdata->hw_pdata; in hda_sdw_acpi_scan()
158 static int hda_sdw_probe(struct snd_sof_dev *sdev) in hda_sdw_probe() argument
164 hdev = sdev->pdata->hw_pdata; in hda_sdw_probe()
168 res.mmio_base = sdev->bar[HDA_DSP_BAR]; in hda_sdw_probe()
171 res.irq = sdev->ipc_irq; in hda_sdw_probe()
173 res.parent = sdev->dev; in hda_sdw_probe()
175 res.dev = sdev->dev; in hda_sdw_probe()
190 dev_err(sdev->dev, "error: SoundWire probe failed\n"); in hda_sdw_probe()
200 int hda_sdw_startup(struct snd_sof_dev *sdev) in hda_sdw_startup() argument
203 struct snd_sof_pdata *pdata = sdev->pdata; in hda_sdw_startup()
205 hdev = sdev->pdata->hw_pdata; in hda_sdw_startup()
216 static int hda_sdw_exit(struct snd_sof_dev *sdev) in hda_sdw_exit() argument
220 hdev = sdev->pdata->hw_pdata; in hda_sdw_exit()
222 hda_sdw_int_enable(sdev, false); in hda_sdw_exit()
231 bool hda_common_check_sdw_irq(struct snd_sof_dev *sdev) in hda_common_check_sdw_irq() argument
237 hdev = sdev->pdata->hw_pdata; in hda_common_check_sdw_irq()
243 irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS2); in hda_common_check_sdw_irq()
257 static bool hda_dsp_check_sdw_irq(struct snd_sof_dev *sdev) in hda_dsp_check_sdw_irq() argument
261 chip = get_chip_info(sdev->pdata); in hda_dsp_check_sdw_irq()
263 return chip->check_sdw_irq(sdev); in hda_dsp_check_sdw_irq()
273 static bool hda_sdw_check_wakeen_irq(struct snd_sof_dev *sdev) in hda_sdw_check_wakeen_irq() argument
277 hdev = sdev->pdata->hw_pdata; in hda_sdw_check_wakeen_irq()
279 snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_sdw_check_wakeen_irq()
286 void hda_sdw_process_wakeen(struct snd_sof_dev *sdev) in hda_sdw_process_wakeen() argument
290 hdev = sdev->pdata->hw_pdata; in hda_sdw_process_wakeen()
354 static void hda_dsp_get_status(struct snd_sof_dev *sdev) in hda_dsp_get_status() argument
359 status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_dsp_get_status()
364 dev_err(sdev->dev, "%s - code %8.8x\n", in hda_dsp_get_status()
371 dev_dbg(sdev->dev, "unknown ROM status value %8.8x\n", status); in hda_dsp_get_status()
374 static void hda_dsp_get_registers(struct snd_sof_dev *sdev, in hda_dsp_get_registers() argument
379 u32 offset = sdev->dsp_oops_offset; in hda_dsp_get_registers()
382 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); in hda_dsp_get_registers()
388 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in hda_dsp_get_registers()
393 sof_block_read(sdev, sdev->mmio_bar, offset, in hda_dsp_get_registers()
398 sof_block_read(sdev, sdev->mmio_bar, offset, stack, in hda_dsp_get_registers()
403 static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags) in hda_dsp_dump_ext_rom_status() argument
411 value = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_ROM_STATUS + i * 0x4); in hda_dsp_dump_ext_rom_status()
415 sof_dev_dbg_or_err(sdev->dev, flags & SOF_DBG_DUMP_FORCE_ERR_LEVEL, in hda_dsp_dump_ext_rom_status()
420 void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags) in hda_dsp_dump() argument
427 hda_dsp_get_status(sdev); in hda_dsp_dump()
430 if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) { in hda_dsp_dump()
431 u32 status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_STATUS); in hda_dsp_dump()
432 u32 panic = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_TRACEP); in hda_dsp_dump()
434 hda_dsp_get_registers(sdev, &xoops, &panic_info, stack, in hda_dsp_dump()
436 snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, in hda_dsp_dump()
439 hda_dsp_dump_ext_rom_status(sdev, flags); in hda_dsp_dump()
443 void hda_ipc_irq_dump(struct snd_sof_dev *sdev) in hda_ipc_irq_dump() argument
445 struct hdac_bus *bus = sof_to_bus(sdev); in hda_ipc_irq_dump()
453 adspis = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS); in hda_ipc_irq_dump()
454 intsts = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS); in hda_ipc_irq_dump()
455 intctl = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL); in hda_ipc_irq_dump()
456 ppsts = snd_sof_dsp_read(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPSTS); in hda_ipc_irq_dump()
459 dev_err(sdev->dev, in hda_ipc_irq_dump()
462 dev_err(sdev->dev, in hda_ipc_irq_dump()
467 void hda_ipc_dump(struct snd_sof_dev *sdev) in hda_ipc_dump() argument
473 hda_ipc_irq_dump(sdev); in hda_ipc_dump()
476 hipcie = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCIE); in hda_ipc_dump()
477 hipct = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCT); in hda_ipc_dump()
478 hipcctl = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCCTL); in hda_ipc_dump()
482 dev_err(sdev->dev, in hda_ipc_dump()
487 static int hda_init(struct snd_sof_dev *sdev) in hda_init() argument
491 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_init()
494 hbus = sof_to_hbus(sdev); in hda_init()
495 bus = sof_to_bus(sdev); in hda_init()
518 sdev->bar[HDA_DSP_HDA_BAR] = bus->remap_addr; in hda_init()
521 ret = hda_codec_i915_init(sdev); in hda_init()
523 dev_warn(sdev->dev, "init of i915 and HDMI codec failed\n"); in hda_init()
526 ret = hda_dsp_ctrl_get_caps(sdev); in hda_init()
528 dev_err(sdev->dev, "error: get caps error\n"); in hda_init()
535 static int check_nhlt_dmic(struct snd_sof_dev *sdev) in check_nhlt_dmic() argument
540 nhlt = intel_nhlt_init(sdev->dev); in check_nhlt_dmic()
542 dmic_num = intel_nhlt_get_dmic_geo(sdev->dev, nhlt); in check_nhlt_dmic()
551 static const char *fixup_tplg_name(struct snd_sof_dev *sdev, in fixup_tplg_name() argument
568 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in fixup_tplg_name()
576 static int dmic_topology_fixup(struct snd_sof_dev *sdev, in dmic_topology_fixup() argument
587 dmic_num = check_nhlt_dmic(sdev); in dmic_topology_fixup()
591 dev_dbg(sdev->dev, in dmic_topology_fixup()
616 fixed_tplg_filename = fixup_tplg_name(sdev, default_tplg_filename, in dmic_topology_fixup()
621 dev_info(sdev->dev, "DMICs detected in NHLT tables: %d\n", dmic_num); in dmic_topology_fixup()
629 static int hda_init_caps(struct snd_sof_dev *sdev) in hda_init_caps() argument
631 struct hdac_bus *bus = sof_to_bus(sdev); in hda_init_caps()
632 struct snd_sof_pdata *pdata = sdev->pdata; in hda_init_caps()
642 dev_dbg(sdev->dev, "PP capability, will probe DSP later.\n"); in hda_init_caps()
645 ret = hda_dsp_ctrl_init_chip(sdev, true); in hda_init_caps()
653 ret = hda_sdw_acpi_scan(sdev); in hda_init_caps()
655 dev_dbg(sdev->dev, "skipping SoundWire, not detected with ACPI scan\n"); in hda_init_caps()
661 dev_dbg(sdev->dev, "skipping SoundWire, no links enabled\n"); in hda_init_caps()
672 ret = hda_sdw_probe(sdev); in hda_init_caps()
674 dev_err(sdev->dev, "error: SoundWire probe error\n"); in hda_init_caps()
685 hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi); in hda_init_caps()
688 hda_codec_i915_display_power(sdev, false); in hda_init_caps()
701 struct snd_sof_dev *sdev = context; in hda_dsp_interrupt_handler() local
707 if (snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS) & in hda_dsp_interrupt_handler()
711 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_interrupt_handler()
724 struct snd_sof_dev *sdev = context; in hda_dsp_interrupt_thread() local
725 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in hda_dsp_interrupt_thread()
728 if (hda_dsp_check_stream_irq(sdev)) in hda_dsp_interrupt_thread()
729 hda_dsp_stream_threaded_handler(irq, sdev); in hda_dsp_interrupt_thread()
731 if (hda_dsp_check_ipc_irq(sdev)) in hda_dsp_interrupt_thread()
732 sof_ops(sdev)->irq_thread(irq, sdev); in hda_dsp_interrupt_thread()
734 if (hda_dsp_check_sdw_irq(sdev)) in hda_dsp_interrupt_thread()
737 if (hda_sdw_check_wakeen_irq(sdev)) in hda_dsp_interrupt_thread()
738 hda_sdw_process_wakeen(sdev); in hda_dsp_interrupt_thread()
741 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_interrupt_thread()
749 int hda_dsp_probe(struct snd_sof_dev *sdev) in hda_dsp_probe() argument
751 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_probe()
765 dev_err(sdev->dev, "error: the DSP is not enabled on this platform, aborting probe\n"); in hda_dsp_probe()
768 …dev_err(sdev->dev, "error: unknown PCI class/subclass/prog-if 0x%06x found, aborting probe\n", pci… in hda_dsp_probe()
771 dev_info(sdev->dev, "DSP detected with PCI class/subclass/prog-if 0x%06x\n", pci->class); in hda_dsp_probe()
773 chip = get_chip_info(sdev->pdata); in hda_dsp_probe()
775 dev_err(sdev->dev, "error: no such device supported, chip id:%x\n", in hda_dsp_probe()
781 hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL); in hda_dsp_probe()
784 sdev->pdata->hw_pdata = hdev; in hda_dsp_probe()
787 hdev->dmic_dev = platform_device_register_data(sdev->dev, "dmic-codec", in hda_dsp_probe()
791 dev_err(sdev->dev, "error: failed to create DMIC device\n"); in hda_dsp_probe()
802 hdev->no_ipc_position = sof_ops(sdev)->pcm_pointer ? 1 : 0; in hda_dsp_probe()
806 bus = sof_to_bus(sdev); in hda_dsp_probe()
807 ret = hda_init(sdev); in hda_dsp_probe()
812 sdev->bar[HDA_DSP_BAR] = pci_ioremap_bar(pci, HDA_DSP_BAR); in hda_dsp_probe()
813 if (!sdev->bar[HDA_DSP_BAR]) { in hda_dsp_probe()
814 dev_err(sdev->dev, "error: ioremap error\n"); in hda_dsp_probe()
819 sdev->mmio_bar = HDA_DSP_BAR; in hda_dsp_probe()
820 sdev->mailbox_bar = HDA_DSP_BAR; in hda_dsp_probe()
824 dev_dbg(sdev->dev, "DMA mask is 32 bit\n"); in hda_dsp_probe()
829 ret = hda_dsp_stream_init(sdev); in hda_dsp_probe()
831 dev_err(sdev->dev, "error: failed to init streams\n"); in hda_dsp_probe()
846 dev_info(sdev->dev, "use msi interrupt mode\n"); in hda_dsp_probe()
847 sdev->ipc_irq = pci_irq_vector(pci, 0); in hda_dsp_probe()
849 sdev->msi_enabled = true; in hda_dsp_probe()
852 if (!sdev->msi_enabled) { in hda_dsp_probe()
853 dev_info(sdev->dev, "use legacy interrupt mode\n"); in hda_dsp_probe()
858 sdev->ipc_irq = pci->irq; in hda_dsp_probe()
861 dev_dbg(sdev->dev, "using IPC IRQ %d\n", sdev->ipc_irq); in hda_dsp_probe()
862 ret = request_threaded_irq(sdev->ipc_irq, hda_dsp_interrupt_handler, in hda_dsp_probe()
864 IRQF_SHARED, "AudioDSP", sdev); in hda_dsp_probe()
866 dev_err(sdev->dev, "error: failed to register IPC IRQ %d\n", in hda_dsp_probe()
867 sdev->ipc_irq); in hda_dsp_probe()
878 snd_sof_pci_update_bits(sdev, PCI_TCSEL, 0x07, 0); in hda_dsp_probe()
881 ret = hda_init_caps(sdev); in hda_dsp_probe()
886 hda_dsp_ctrl_ppcap_enable(sdev, true); in hda_dsp_probe()
887 hda_dsp_ctrl_ppcap_int_enable(sdev, true); in hda_dsp_probe()
890 sdev->dsp_box.offset = HDA_DSP_MBOX_UPLINK_OFFSET; in hda_dsp_probe()
897 free_irq(sdev->ipc_irq, sdev); in hda_dsp_probe()
899 if (sdev->msi_enabled) in hda_dsp_probe()
902 hda_dsp_stream_free(sdev); in hda_dsp_probe()
904 iounmap(sdev->bar[HDA_DSP_BAR]); in hda_dsp_probe()
908 hda_codec_i915_exit(sdev); in hda_dsp_probe()
913 int hda_dsp_remove(struct snd_sof_dev *sdev) in hda_dsp_remove() argument
915 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_remove()
916 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_remove()
917 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_remove()
928 hda_sdw_exit(sdev); in hda_dsp_remove()
934 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_remove()
938 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL, in hda_dsp_remove()
943 snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask); in hda_dsp_remove()
946 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_remove()
949 free_irq(sdev->ipc_irq, sdev); in hda_dsp_remove()
950 if (sdev->msi_enabled) in hda_dsp_remove()
953 hda_dsp_stream_free(sdev); in hda_dsp_remove()
958 iounmap(sdev->bar[HDA_DSP_BAR]); in hda_dsp_remove()
964 hda_codec_i915_exit(sdev); in hda_dsp_remove()
970 static int hda_generic_machine_select(struct snd_sof_dev *sdev) in hda_generic_machine_select() argument
972 struct hdac_bus *bus = sof_to_bus(sdev); in hda_generic_machine_select()
975 struct snd_sof_pdata *pdata = sdev->pdata; in hda_generic_machine_select()
1015 ret = dmic_topology_fixup(sdev, &tplg_filename, idisp_str, &dmic_num); in hda_generic_machine_select()
1044 static int hda_generic_machine_select(struct snd_sof_dev *sdev) in hda_generic_machine_select() argument
1052 static bool link_slaves_found(struct snd_sof_dev *sdev, in link_slaves_found() argument
1056 struct hdac_bus *bus = sof_to_bus(sdev); in link_slaves_found()
1129 static int hda_sdw_machine_select(struct snd_sof_dev *sdev) in hda_sdw_machine_select() argument
1131 struct snd_sof_pdata *pdata = sdev->pdata; in hda_sdw_machine_select()
1172 if (!link_slaves_found(sdev, link, hdev->sdw)) in hda_sdw_machine_select()
1185 mach->mach_params.platform = dev_name(sdev->dev); in hda_sdw_machine_select()
1203 ret = dmic_topology_fixup(sdev, &tplg_filename, "", &dmic_num); in hda_sdw_machine_select()
1212 dev_dbg(sdev->dev, in hda_sdw_machine_select()
1217 dev_info(sdev->dev, in hda_sdw_machine_select()
1225 static int hda_sdw_machine_select(struct snd_sof_dev *sdev) in hda_sdw_machine_select() argument
1232 struct snd_sof_dev *sdev) in hda_set_mach_params() argument
1234 struct snd_sof_pdata *pdata = sdev->pdata; in hda_set_mach_params()
1239 mach_params->platform = dev_name(sdev->dev); in hda_set_mach_params()
1244 void hda_machine_select(struct snd_sof_dev *sdev) in hda_machine_select() argument
1246 struct snd_sof_pdata *sof_pdata = sdev->pdata; in hda_machine_select()
1270 hda_sdw_machine_select(sdev); in hda_machine_select()
1276 hda_generic_machine_select(sdev); in hda_machine_select()
1279 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in hda_machine_select()