Lines Matching refs:sdev

48 	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);  in hda_ctrl_dai_widget_setup()  local
57 dev_err(sdev->dev, "No config for DAI %s\n", w->name); in hda_ctrl_dai_widget_setup()
75 ret = sof_widget_setup(sdev, swidget); in hda_ctrl_dai_widget_setup()
77 dev_err(sdev->dev, "error: failed setting up DAI widget %s\n", w->name); in hda_ctrl_dai_widget_setup()
85 ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size, in hda_ctrl_dai_widget_setup()
88 dev_err(sdev->dev, "error: failed setting DAI config for %s\n", w->name); in hda_ctrl_dai_widget_setup()
101 struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); in hda_ctrl_dai_widget_free() local
110 dev_err(sdev->dev, "error: No config to free DAI %s\n", w->name); in hda_ctrl_dai_widget_free()
123 ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size, in hda_ctrl_dai_widget_free()
126 dev_err(sdev->dev, "error: failed resetting DAI config for %s\n", w->name); in hda_ctrl_dai_widget_free()
134 return sof_widget_free(sdev, swidget); in hda_ctrl_dai_widget_free()
160 static int sdw_dai_config_ipc(struct snd_sof_dev *sdev, in sdw_dai_config_ipc() argument
169 dev_err(sdev->dev, "error: No private data for widget %s\n", w->name); in sdw_dai_config_ipc()
176 dev_err(sdev->dev, "error: No config for DAI %s\n", w->name); in sdw_dai_config_ipc()
196 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sdw_params_stream() local
205 return sdw_dai_config_ipc(sdev, w, params_data->link_id, params_data->alh_stream_id, in sdw_params_stream()
213 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sdw_free_stream() local
223 return sdw_dai_config_ipc(sdev, w, free_data->link_id, 0xFFFF, d->id, false); in sdw_free_stream()
231 void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) in hda_sdw_int_enable() argument
233 sdw_intel_enable_irq(sdev->bar[HDA_DSP_BAR], enable); in hda_sdw_int_enable()
236 static int hda_sdw_acpi_scan(struct snd_sof_dev *sdev) in hda_sdw_acpi_scan() argument
242 handle = ACPI_HANDLE(sdev->dev); in hda_sdw_acpi_scan()
245 hdev = sdev->pdata->hw_pdata; in hda_sdw_acpi_scan()
254 static int hda_sdw_probe(struct snd_sof_dev *sdev) in hda_sdw_probe() argument
260 hdev = sdev->pdata->hw_pdata; in hda_sdw_probe()
264 res.mmio_base = sdev->bar[HDA_DSP_BAR]; in hda_sdw_probe()
267 res.irq = sdev->ipc_irq; in hda_sdw_probe()
269 res.parent = sdev->dev; in hda_sdw_probe()
271 res.dev = sdev->dev; in hda_sdw_probe()
286 dev_err(sdev->dev, "error: SoundWire probe failed\n"); in hda_sdw_probe()
296 int hda_sdw_startup(struct snd_sof_dev *sdev) in hda_sdw_startup() argument
299 struct snd_sof_pdata *pdata = sdev->pdata; in hda_sdw_startup()
301 hdev = sdev->pdata->hw_pdata; in hda_sdw_startup()
312 static int hda_sdw_exit(struct snd_sof_dev *sdev) in hda_sdw_exit() argument
316 hdev = sdev->pdata->hw_pdata; in hda_sdw_exit()
318 hda_sdw_int_enable(sdev, false); in hda_sdw_exit()
327 bool hda_common_check_sdw_irq(struct snd_sof_dev *sdev) in hda_common_check_sdw_irq() argument
333 hdev = sdev->pdata->hw_pdata; in hda_common_check_sdw_irq()
339 irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS2); in hda_common_check_sdw_irq()
353 static bool hda_dsp_check_sdw_irq(struct snd_sof_dev *sdev) in hda_dsp_check_sdw_irq() argument
357 chip = get_chip_info(sdev->pdata); in hda_dsp_check_sdw_irq()
359 return chip->check_sdw_irq(sdev); in hda_dsp_check_sdw_irq()
369 static bool hda_sdw_check_wakeen_irq(struct snd_sof_dev *sdev) in hda_sdw_check_wakeen_irq() argument
373 hdev = sdev->pdata->hw_pdata; in hda_sdw_check_wakeen_irq()
375 snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_sdw_check_wakeen_irq()
382 void hda_sdw_process_wakeen(struct snd_sof_dev *sdev) in hda_sdw_process_wakeen() argument
386 hdev = sdev->pdata->hw_pdata; in hda_sdw_process_wakeen()
394 static inline int hda_sdw_acpi_scan(struct snd_sof_dev *sdev) in hda_sdw_acpi_scan() argument
399 static inline int hda_sdw_probe(struct snd_sof_dev *sdev) in hda_sdw_probe() argument
404 static inline int hda_sdw_exit(struct snd_sof_dev *sdev) in hda_sdw_exit() argument
409 static inline bool hda_dsp_check_sdw_irq(struct snd_sof_dev *sdev) in hda_dsp_check_sdw_irq() argument
419 static inline bool hda_sdw_check_wakeen_irq(struct snd_sof_dev *sdev) in hda_sdw_check_wakeen_irq() argument
481 static void hda_dsp_get_status(struct snd_sof_dev *sdev) in hda_dsp_get_status() argument
486 status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, in hda_dsp_get_status()
491 dev_err(sdev->dev, "%s - code %8.8x\n", in hda_dsp_get_status()
498 dev_dbg(sdev->dev, "unknown ROM status value %8.8x\n", status); in hda_dsp_get_status()
501 static void hda_dsp_get_registers(struct snd_sof_dev *sdev, in hda_dsp_get_registers() argument
506 u32 offset = sdev->dsp_oops_offset; in hda_dsp_get_registers()
509 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); in hda_dsp_get_registers()
515 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in hda_dsp_get_registers()
520 sof_block_read(sdev, sdev->mmio_bar, offset, in hda_dsp_get_registers()
525 sof_block_read(sdev, sdev->mmio_bar, offset, stack, in hda_dsp_get_registers()
530 static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags) in hda_dsp_dump_ext_rom_status() argument
538 value = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_ROM_STATUS + i * 0x4); in hda_dsp_dump_ext_rom_status()
542 dev_err(sdev->dev, "extended rom status: %s", msg); in hda_dsp_dump_ext_rom_status()
546 void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags) in hda_dsp_dump() argument
553 hda_dsp_get_status(sdev); in hda_dsp_dump()
556 u32 status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_STATUS); in hda_dsp_dump()
557 u32 panic = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_TRACEP); in hda_dsp_dump()
559 hda_dsp_get_registers(sdev, &xoops, &panic_info, stack, in hda_dsp_dump()
561 snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, in hda_dsp_dump()
564 hda_dsp_dump_ext_rom_status(sdev, flags); in hda_dsp_dump()
568 void hda_ipc_irq_dump(struct snd_sof_dev *sdev) in hda_ipc_irq_dump() argument
570 struct hdac_bus *bus = sof_to_bus(sdev); in hda_ipc_irq_dump()
578 adspis = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPIS); in hda_ipc_irq_dump()
579 intsts = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS); in hda_ipc_irq_dump()
580 intctl = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL); in hda_ipc_irq_dump()
581 ppsts = snd_sof_dsp_read(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPSTS); in hda_ipc_irq_dump()
584 dev_err(sdev->dev, "hda irq intsts 0x%8.8x intlctl 0x%8.8x rirb %2.2x\n", in hda_ipc_irq_dump()
586 dev_err(sdev->dev, "dsp irq ppsts 0x%8.8x adspis 0x%8.8x\n", ppsts, adspis); in hda_ipc_irq_dump()
589 void hda_ipc_dump(struct snd_sof_dev *sdev) in hda_ipc_dump() argument
595 hda_ipc_irq_dump(sdev); in hda_ipc_dump()
598 hipcie = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCIE); in hda_ipc_dump()
599 hipct = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCT); in hda_ipc_dump()
600 hipcctl = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_HIPCCTL); in hda_ipc_dump()
604 dev_err(sdev->dev, "host status 0x%8.8x dsp status 0x%8.8x mask 0x%8.8x\n", in hda_ipc_dump()
608 static int hda_init(struct snd_sof_dev *sdev) in hda_init() argument
612 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_init()
615 hbus = sof_to_hbus(sdev); in hda_init()
616 bus = sof_to_bus(sdev); in hda_init()
639 sdev->bar[HDA_DSP_HDA_BAR] = bus->remap_addr; in hda_init()
642 ret = hda_codec_i915_init(sdev); in hda_init()
644 dev_warn(sdev->dev, "init of i915 and HDMI codec failed\n"); in hda_init()
647 ret = hda_dsp_ctrl_get_caps(sdev); in hda_init()
649 dev_err(sdev->dev, "error: get caps error\n"); in hda_init()
656 static int check_nhlt_dmic(struct snd_sof_dev *sdev) in check_nhlt_dmic() argument
661 nhlt = intel_nhlt_init(sdev->dev); in check_nhlt_dmic()
663 dmic_num = intel_nhlt_get_dmic_geo(sdev->dev, nhlt); in check_nhlt_dmic()
672 static const char *fixup_tplg_name(struct snd_sof_dev *sdev, in fixup_tplg_name() argument
689 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in fixup_tplg_name()
697 static int dmic_topology_fixup(struct snd_sof_dev *sdev, in dmic_topology_fixup() argument
708 dmic_num = check_nhlt_dmic(sdev); in dmic_topology_fixup()
712 dev_dbg(sdev->dev, in dmic_topology_fixup()
737 fixed_tplg_filename = fixup_tplg_name(sdev, default_tplg_filename, in dmic_topology_fixup()
742 dev_info(sdev->dev, "DMICs detected in NHLT tables: %d\n", dmic_num); in dmic_topology_fixup()
750 static int hda_init_caps(struct snd_sof_dev *sdev) in hda_init_caps() argument
752 struct hdac_bus *bus = sof_to_bus(sdev); in hda_init_caps()
753 struct snd_sof_pdata *pdata = sdev->pdata; in hda_init_caps()
763 dev_dbg(sdev->dev, "PP capability, will probe DSP later.\n"); in hda_init_caps()
766 ret = hda_dsp_ctrl_init_chip(sdev, true); in hda_init_caps()
774 ret = hda_sdw_acpi_scan(sdev); in hda_init_caps()
776 dev_dbg(sdev->dev, "skipping SoundWire, not detected with ACPI scan\n"); in hda_init_caps()
782 dev_dbg(sdev->dev, "skipping SoundWire, no links enabled\n"); in hda_init_caps()
793 ret = hda_sdw_probe(sdev); in hda_init_caps()
795 dev_err(sdev->dev, "error: SoundWire probe error\n"); in hda_init_caps()
806 hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi); in hda_init_caps()
809 hda_codec_i915_display_power(sdev, false); in hda_init_caps()
820 static void hda_check_for_state_change(struct snd_sof_dev *sdev) in hda_check_for_state_change() argument
823 struct hdac_bus *bus = sof_to_bus(sdev); in hda_check_for_state_change()
828 hda_codec_jack_check(sdev); in hda_check_for_state_change()
836 struct snd_sof_dev *sdev = context; in hda_dsp_interrupt_handler() local
842 if (snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS) & in hda_dsp_interrupt_handler()
846 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_interrupt_handler()
859 struct snd_sof_dev *sdev = context; in hda_dsp_interrupt_thread() local
860 struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; in hda_dsp_interrupt_thread()
863 if (hda_dsp_check_stream_irq(sdev)) in hda_dsp_interrupt_thread()
864 hda_dsp_stream_threaded_handler(irq, sdev); in hda_dsp_interrupt_thread()
866 if (hda_dsp_check_ipc_irq(sdev)) in hda_dsp_interrupt_thread()
867 sof_ops(sdev)->irq_thread(irq, sdev); in hda_dsp_interrupt_thread()
869 if (hda_dsp_check_sdw_irq(sdev)) in hda_dsp_interrupt_thread()
872 if (hda_sdw_check_wakeen_irq(sdev)) in hda_dsp_interrupt_thread()
873 hda_sdw_process_wakeen(sdev); in hda_dsp_interrupt_thread()
875 hda_check_for_state_change(sdev); in hda_dsp_interrupt_thread()
878 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_interrupt_thread()
886 int hda_dsp_probe(struct snd_sof_dev *sdev) in hda_dsp_probe() argument
888 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_probe()
902 dev_err(sdev->dev, "error: the DSP is not enabled on this platform, aborting probe\n"); in hda_dsp_probe()
905 …dev_err(sdev->dev, "error: unknown PCI class/subclass/prog-if 0x%06x found, aborting probe\n", pci… in hda_dsp_probe()
908 dev_info(sdev->dev, "DSP detected with PCI class/subclass/prog-if 0x%06x\n", pci->class); in hda_dsp_probe()
910 chip = get_chip_info(sdev->pdata); in hda_dsp_probe()
912 dev_err(sdev->dev, "error: no such device supported, chip id:%x\n", in hda_dsp_probe()
918 hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL); in hda_dsp_probe()
921 sdev->pdata->hw_pdata = hdev; in hda_dsp_probe()
924 hdev->dmic_dev = platform_device_register_data(sdev->dev, "dmic-codec", in hda_dsp_probe()
928 dev_err(sdev->dev, "error: failed to create DMIC device\n"); in hda_dsp_probe()
939 hdev->no_ipc_position = sof_ops(sdev)->pcm_pointer ? 1 : 0; in hda_dsp_probe()
943 bus = sof_to_bus(sdev); in hda_dsp_probe()
944 ret = hda_init(sdev); in hda_dsp_probe()
949 sdev->bar[HDA_DSP_BAR] = pci_ioremap_bar(pci, HDA_DSP_BAR); in hda_dsp_probe()
950 if (!sdev->bar[HDA_DSP_BAR]) { in hda_dsp_probe()
951 dev_err(sdev->dev, "error: ioremap error\n"); in hda_dsp_probe()
956 sdev->mmio_bar = HDA_DSP_BAR; in hda_dsp_probe()
957 sdev->mailbox_bar = HDA_DSP_BAR; in hda_dsp_probe()
961 dev_dbg(sdev->dev, "DMA mask is 32 bit\n"); in hda_dsp_probe()
966 ret = hda_dsp_stream_init(sdev); in hda_dsp_probe()
968 dev_err(sdev->dev, "error: failed to init streams\n"); in hda_dsp_probe()
983 dev_info(sdev->dev, "use msi interrupt mode\n"); in hda_dsp_probe()
984 sdev->ipc_irq = pci_irq_vector(pci, 0); in hda_dsp_probe()
986 sdev->msi_enabled = true; in hda_dsp_probe()
989 if (!sdev->msi_enabled) { in hda_dsp_probe()
990 dev_info(sdev->dev, "use legacy interrupt mode\n"); in hda_dsp_probe()
995 sdev->ipc_irq = pci->irq; in hda_dsp_probe()
998 dev_dbg(sdev->dev, "using IPC IRQ %d\n", sdev->ipc_irq); in hda_dsp_probe()
999 ret = request_threaded_irq(sdev->ipc_irq, hda_dsp_interrupt_handler, in hda_dsp_probe()
1001 IRQF_SHARED, "AudioDSP", sdev); in hda_dsp_probe()
1003 dev_err(sdev->dev, "error: failed to register IPC IRQ %d\n", in hda_dsp_probe()
1004 sdev->ipc_irq); in hda_dsp_probe()
1015 snd_sof_pci_update_bits(sdev, PCI_TCSEL, 0x07, 0); in hda_dsp_probe()
1018 ret = hda_init_caps(sdev); in hda_dsp_probe()
1023 hda_dsp_ctrl_ppcap_enable(sdev, true); in hda_dsp_probe()
1024 hda_dsp_ctrl_ppcap_int_enable(sdev, true); in hda_dsp_probe()
1027 sdev->dsp_box.offset = HDA_DSP_MBOX_UPLINK_OFFSET; in hda_dsp_probe()
1034 free_irq(sdev->ipc_irq, sdev); in hda_dsp_probe()
1036 if (sdev->msi_enabled) in hda_dsp_probe()
1039 hda_dsp_stream_free(sdev); in hda_dsp_probe()
1041 iounmap(sdev->bar[HDA_DSP_BAR]); in hda_dsp_probe()
1045 hda_codec_i915_exit(sdev); in hda_dsp_probe()
1050 int hda_dsp_remove(struct snd_sof_dev *sdev) in hda_dsp_remove() argument
1052 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_remove()
1053 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_remove()
1054 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_remove()
1065 hda_sdw_exit(sdev); in hda_dsp_remove()
1071 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_remove()
1075 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL, in hda_dsp_remove()
1080 snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask); in hda_dsp_remove()
1083 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_remove()
1086 free_irq(sdev->ipc_irq, sdev); in hda_dsp_remove()
1087 if (sdev->msi_enabled) in hda_dsp_remove()
1090 hda_dsp_stream_free(sdev); in hda_dsp_remove()
1095 iounmap(sdev->bar[HDA_DSP_BAR]); in hda_dsp_remove()
1101 hda_codec_i915_exit(sdev); in hda_dsp_remove()
1107 static int hda_generic_machine_select(struct snd_sof_dev *sdev) in hda_generic_machine_select() argument
1109 struct hdac_bus *bus = sof_to_bus(sdev); in hda_generic_machine_select()
1112 struct snd_sof_pdata *pdata = sdev->pdata; in hda_generic_machine_select()
1152 ret = dmic_topology_fixup(sdev, &tplg_filename, idisp_str, &dmic_num); in hda_generic_machine_select()
1181 static int hda_generic_machine_select(struct snd_sof_dev *sdev) in hda_generic_machine_select() argument
1189 static bool link_slaves_found(struct snd_sof_dev *sdev, in link_slaves_found() argument
1193 struct hdac_bus *bus = sof_to_bus(sdev); in link_slaves_found()
1266 static int hda_sdw_machine_select(struct snd_sof_dev *sdev) in hda_sdw_machine_select() argument
1268 struct snd_sof_pdata *pdata = sdev->pdata; in hda_sdw_machine_select()
1309 if (!link_slaves_found(sdev, link, hdev->sdw)) in hda_sdw_machine_select()
1322 mach->mach_params.platform = dev_name(sdev->dev); in hda_sdw_machine_select()
1340 ret = dmic_topology_fixup(sdev, &tplg_filename, "", &dmic_num); in hda_sdw_machine_select()
1349 dev_dbg(sdev->dev, in hda_sdw_machine_select()
1354 dev_info(sdev->dev, in hda_sdw_machine_select()
1362 static int hda_sdw_machine_select(struct snd_sof_dev *sdev) in hda_sdw_machine_select() argument
1369 struct snd_sof_dev *sdev) in hda_set_mach_params() argument
1371 struct snd_sof_pdata *pdata = sdev->pdata; in hda_set_mach_params()
1376 mach_params->platform = dev_name(sdev->dev); in hda_set_mach_params()
1381 void hda_machine_select(struct snd_sof_dev *sdev) in hda_machine_select() argument
1383 struct snd_sof_pdata *sof_pdata = sdev->pdata; in hda_machine_select()
1407 hda_sdw_machine_select(sdev); in hda_machine_select()
1413 hda_generic_machine_select(sdev); in hda_machine_select()
1416 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in hda_machine_select()