Lines Matching full:bus
58 struct hdac_bus *bus = skl_to_bus(skl); in skl_init_pci() local
67 dev_dbg(bus->dev, "Clearing TCSEL\n"); in skl_init_pci()
107 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_clock_power_gating() local
116 snd_hdac_chip_updatel(bus, VS_EM2, AZX_REG_VS_EM2_L1SEN, val); in skl_clock_power_gating()
128 static int skl_init_chip(struct hdac_bus *bus, bool full_reset) in skl_init_chip() argument
133 snd_hdac_set_codec_wakeup(bus, true); in skl_init_chip()
134 skl_enable_miscbdcge(bus->dev, false); in skl_init_chip()
135 ret = snd_hdac_bus_init_chip(bus, full_reset); in skl_init_chip()
138 list_for_each_entry(hlink, &bus->hlink_list, list) in skl_init_chip()
141 skl_enable_miscbdcge(bus->dev, true); in skl_init_chip()
142 snd_hdac_set_codec_wakeup(bus, false); in skl_init_chip()
150 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_update_d0i3c() local
154 reg = snd_hdac_chip_readb(bus, VS_D0I3C); in skl_update_d0i3c()
158 reg = snd_hdac_chip_readb(bus, VS_D0I3C); in skl_update_d0i3c()
163 dev_err(bus->dev, "Before D0I3C update: D0I3C CIP timeout\n"); in skl_update_d0i3c()
172 snd_hdac_chip_writeb(bus, VS_D0I3C, reg); in skl_update_d0i3c()
176 reg = snd_hdac_chip_readb(bus, VS_D0I3C); in skl_update_d0i3c()
179 reg = snd_hdac_chip_readb(bus, VS_D0I3C); in skl_update_d0i3c()
184 dev_err(bus->dev, "After D0I3C update: D0I3C CIP timeout\n"); in skl_update_d0i3c()
188 dev_dbg(bus->dev, "D0I3C register = 0x%x\n", in skl_update_d0i3c()
189 snd_hdac_chip_readb(bus, VS_D0I3C)); in skl_update_d0i3c()
194 * @bus: HD-audio core bus
199 static void skl_dum_set(struct hdac_bus *bus) in skl_dum_set() argument
202 if (!(snd_hdac_chip_readb(bus, GCTL) & AZX_GCTL_RESET)) { in skl_dum_set()
203 skl_enable_miscbdcge(bus->dev, false); in skl_dum_set()
204 snd_hdac_bus_exit_link_reset(bus); in skl_dum_set()
205 skl_enable_miscbdcge(bus->dev, true); in skl_dum_set()
208 snd_hdac_chip_updatel(bus, VS_EM2, AZX_VS_EM2_DUM, AZX_VS_EM2_DUM); in skl_dum_set()
212 static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr) in skl_stream_update() argument
219 struct hdac_bus *bus = dev_id; in skl_interrupt() local
222 if (!pm_runtime_active(bus->dev)) in skl_interrupt()
225 spin_lock(&bus->reg_lock); in skl_interrupt()
227 status = snd_hdac_chip_readl(bus, INTSTS); in skl_interrupt()
229 spin_unlock(&bus->reg_lock); in skl_interrupt()
234 status = snd_hdac_chip_readb(bus, RIRBSTS); in skl_interrupt()
237 snd_hdac_bus_update_rirb(bus); in skl_interrupt()
238 snd_hdac_chip_writeb(bus, RIRBSTS, RIRB_INT_MASK); in skl_interrupt()
241 spin_unlock(&bus->reg_lock); in skl_interrupt()
243 return snd_hdac_chip_readl(bus, INTSTS) ? IRQ_WAKE_THREAD : IRQ_HANDLED; in skl_interrupt()
248 struct hdac_bus *bus = dev_id; in skl_threaded_handler() local
251 status = snd_hdac_chip_readl(bus, INTSTS); in skl_threaded_handler()
253 snd_hdac_bus_handle_stream_irq(bus, status, skl_stream_update); in skl_threaded_handler()
258 static int skl_acquire_irq(struct hdac_bus *bus, int do_disconnect) in skl_acquire_irq() argument
260 struct skl_dev *skl = bus_to_skl(bus); in skl_acquire_irq()
266 KBUILD_MODNAME, bus); in skl_acquire_irq()
268 dev_err(bus->dev, in skl_acquire_irq()
274 bus->irq = skl->pci->irq; in skl_acquire_irq()
283 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_suspend_late() local
284 struct skl_dev *skl = bus_to_skl(bus); in skl_suspend_late()
290 static int _skl_suspend(struct hdac_bus *bus) in _skl_suspend() argument
292 struct skl_dev *skl = bus_to_skl(bus); in _skl_suspend()
293 struct pci_dev *pci = to_pci_dev(bus->dev); in _skl_suspend()
296 snd_hdac_ext_bus_link_power_down_all(bus); in _skl_suspend()
302 snd_hdac_bus_stop_chip(bus); in _skl_suspend()
305 skl_enable_miscbdcge(bus->dev, false); in _skl_suspend()
306 snd_hdac_bus_enter_link_reset(bus); in _skl_suspend()
307 skl_enable_miscbdcge(bus->dev, true); in _skl_suspend()
313 static int _skl_resume(struct hdac_bus *bus) in _skl_resume() argument
315 struct skl_dev *skl = bus_to_skl(bus); in _skl_resume()
318 skl_dum_set(bus); in _skl_resume()
319 skl_init_chip(bus, true); in _skl_resume()
332 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_suspend() local
333 struct skl_dev *skl = bus_to_skl(bus); in skl_suspend()
342 snd_hdac_ext_bus_link_power_down_all(bus); in skl_suspend()
344 if (bus->cmd_dma_state) in skl_suspend()
345 snd_hdac_bus_stop_cmd_io(bus); in skl_suspend()
347 enable_irq_wake(bus->irq); in skl_suspend()
350 ret = _skl_suspend(bus); in skl_suspend()
362 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_resume() local
363 struct skl_dev *skl = bus_to_skl(bus); in skl_resume()
373 snd_hdac_ext_bus_link_power_up_all(bus); in skl_resume()
374 disable_irq_wake(bus->irq); in skl_resume()
380 list_for_each_entry(hlink, &bus->hlink_list, list) { in skl_resume()
386 if (bus->cmd_dma_state) in skl_resume()
387 snd_hdac_bus_init_cmd_io(bus); in skl_resume()
389 ret = _skl_resume(bus); in skl_resume()
392 list_for_each_entry(hlink, &bus->hlink_list, list) { in skl_resume()
397 if (!bus->cmd_dma_state) in skl_resume()
398 snd_hdac_bus_stop_cmd_io(bus); in skl_resume()
409 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_runtime_suspend() local
411 dev_dbg(bus->dev, "in %s\n", __func__); in skl_runtime_suspend()
413 return _skl_suspend(bus); in skl_runtime_suspend()
419 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_runtime_resume() local
421 dev_dbg(bus->dev, "in %s\n", __func__); in skl_runtime_resume()
423 return _skl_resume(bus); in skl_runtime_resume()
436 static int skl_free(struct hdac_bus *bus) in skl_free() argument
438 struct skl_dev *skl = bus_to_skl(bus); in skl_free()
442 snd_hdac_stop_streams_and_chip(bus); in skl_free()
444 if (bus->irq >= 0) in skl_free()
445 free_irq(bus->irq, (void *)bus); in skl_free()
446 snd_hdac_bus_free_stream_pages(bus); in skl_free()
447 snd_hdac_ext_stream_free_all(bus); in skl_free()
448 snd_hdac_link_free_all(bus); in skl_free()
450 if (bus->remap_addr) in skl_free()
451 iounmap(bus->remap_addr); in skl_free()
456 snd_hdac_ext_bus_exit(bus); in skl_free()
459 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_free()
460 snd_hdac_i915_exit(bus); in skl_free()
499 struct hdac_bus *bus = skl_to_bus(skl); in skl_find_machine() local
505 dev_dbg(bus->dev, "No matching I2S machine driver found\n"); in skl_find_machine()
508 dev_err(bus->dev, "No matching machine driver found\n"); in skl_find_machine()
530 struct hdac_bus *bus = skl_to_bus(skl); in skl_machine_device_register() local
536 dev_err(bus->dev, "platform device alloc failed\n"); in skl_machine_device_register()
540 mach->mach_params.platform = dev_name(bus->dev); in skl_machine_device_register()
541 mach->mach_params.codec_mask = bus->codec_mask; in skl_machine_device_register()
545 dev_err(bus->dev, "failed to add machine device platform data\n"); in skl_machine_device_register()
552 dev_err(bus->dev, "failed to add machine device\n"); in skl_machine_device_register()
571 struct hdac_bus *bus = skl_to_bus(skl); in skl_dmic_device_register() local
578 dev_err(bus->dev, "failed to allocate dmic device\n"); in skl_dmic_device_register()
584 dev_err(bus->dev, "failed to add dmic device: %d\n", ret); in skl_dmic_device_register()
692 static struct hda_codec *skl_codec_device_init(struct hdac_bus *bus, int addr) in skl_codec_device_init() argument
697 codec = snd_hda_codec_device_init(to_hda_bus(bus), addr, "ehdaudio%dD%d", bus->idx, addr); in skl_codec_device_init()
699 dev_err(bus->dev, "device init failed for hdac device\n"); in skl_codec_device_init()
707 dev_err(bus->dev, "failed to register hdac device\n"); in skl_codec_device_init()
718 static int probe_codec(struct hdac_bus *bus, int addr) in probe_codec() argument
724 struct skl_dev *skl = bus_to_skl(bus); in probe_codec()
729 mutex_lock(&bus->cmd_mutex); in probe_codec()
730 snd_hdac_bus_send_cmd(bus, cmd); in probe_codec()
731 snd_hdac_bus_get_response(bus, addr, &res); in probe_codec()
732 mutex_unlock(&bus->cmd_mutex); in probe_codec()
735 dev_dbg(bus->dev, "codec #%d probed OK: %x\n", addr, res); in probe_codec()
743 codec = skl_codec_device_init(bus, addr); in probe_codec()
750 /* use legacy bus only for HDA codecs, idisp uses ext bus */ in probe_codec()
757 codec = skl_codec_device_init(bus, addr); in probe_codec()
763 static void skl_codec_create(struct hdac_bus *bus) in skl_codec_create() argument
771 if ((bus->codec_mask & (1 << c))) { in skl_codec_create()
772 if (probe_codec(bus, c) < 0) { in skl_codec_create()
777 dev_warn(bus->dev, in skl_codec_create()
779 bus->codec_mask &= ~(1 << c); in skl_codec_create()
782 * codec often screws up the controller bus, in skl_codec_create()
785 * better to reset the controller bus to get in skl_codec_create()
788 snd_hdac_bus_stop_chip(bus); in skl_codec_create()
789 skl_init_chip(bus, true); in skl_codec_create()
795 static int skl_i915_init(struct hdac_bus *bus) in skl_i915_init() argument
803 err = snd_hdac_i915_init(bus); in skl_i915_init()
807 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); in skl_i915_init()
815 struct hdac_bus *bus = skl_to_bus(skl); in skl_probe_work() local
820 err = skl_i915_init(bus); in skl_probe_work()
826 skl_dum_set(bus); in skl_probe_work()
828 err = skl_init_chip(bus, true); in skl_probe_work()
830 dev_err(bus->dev, "Init chip failed with err: %d\n", err); in skl_probe_work()
835 if (!bus->codec_mask) in skl_probe_work()
836 dev_info(bus->dev, "no hda codecs found!\n"); in skl_probe_work()
839 skl_codec_create(bus); in skl_probe_work()
842 err = skl_platform_register(bus->dev); in skl_probe_work()
844 dev_err(bus->dev, "platform register failed: %d\n", err); in skl_probe_work()
850 dev_err(bus->dev, "machine register failed: %d\n", err); in skl_probe_work()
857 list_for_each_entry(hlink, &bus->hlink_list, list) in skl_probe_work()
858 snd_hdac_ext_bus_link_put(bus, hlink); in skl_probe_work()
861 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_probe_work()
864 pm_runtime_put_noidle(bus->dev); in skl_probe_work()
865 pm_runtime_allow(bus->dev); in skl_probe_work()
872 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_probe_work()
883 struct hdac_bus *bus; in skl_create() local
900 bus = skl_to_bus(skl); in skl_create()
908 snd_hdac_ext_bus_init(bus, &pci->dev, NULL, ext_ops); in skl_create()
909 bus->use_posbuf = 1; in skl_create()
912 bus->bdl_pos_adj = 0; in skl_create()
924 static int skl_first_init(struct hdac_bus *bus) in skl_first_init() argument
926 struct skl_dev *skl = bus_to_skl(bus); in skl_first_init()
936 bus->addr = pci_resource_start(pci, 0); in skl_first_init()
937 bus->remap_addr = pci_ioremap_bar(pci, 0); in skl_first_init()
938 if (bus->remap_addr == NULL) { in skl_first_init()
939 dev_err(bus->dev, "ioremap error\n"); in skl_first_init()
943 snd_hdac_bus_parse_capabilities(bus); in skl_first_init()
946 if (!bus->ppcap) { in skl_first_init()
947 dev_err(bus->dev, "bus ppcap not set, HDAudio or DSP not present?\n"); in skl_first_init()
951 if (skl_acquire_irq(bus, 0) < 0) in skl_first_init()
955 synchronize_irq(bus->irq); in skl_first_init()
957 gcap = snd_hdac_chip_readw(bus, GCAP); in skl_first_init()
958 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap); in skl_first_init()
965 dev_err(bus->dev, "no streams found in GCAP definitions?\n"); in skl_first_init()
969 bus->num_streams = cp_streams + pb_streams; in skl_first_init()
972 if (dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(64))) in skl_first_init()
973 dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(32)); in skl_first_init()
974 dma_set_max_seg_size(bus->dev, UINT_MAX); in skl_first_init()
978 (bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); in skl_first_init()
981 (bus, start_idx, pb_streams, SNDRV_PCM_STREAM_PLAYBACK); in skl_first_init()
983 err = snd_hdac_bus_alloc_stream_pages(bus); in skl_first_init()
994 struct hdac_bus *bus = NULL; in skl_probe() local
1020 bus = skl_to_bus(skl); in skl_probe()
1022 err = skl_first_init(bus); in skl_probe()
1024 dev_err(bus->dev, "skl_first_init failed with err: %d\n", err); in skl_probe()
1030 device_disable_async_suspend(bus->dev); in skl_probe()
1032 skl->nhlt = intel_nhlt_init(bus->dev); in skl_probe()
1036 dev_err(bus->dev, "no nhlt info found\n"); in skl_probe()
1040 dev_warn(bus->dev, "no nhlt info found, continuing to try to enable HDAudio codec\n"); in skl_probe()
1046 dev_err(bus->dev, "skl_nhlt_create_sysfs failed with err: %d\n", err); in skl_probe()
1055 dev_err(bus->dev, "skl_clock_device_register failed with err: %d\n", err); in skl_probe()
1060 pci_set_drvdata(skl->pci, bus); in skl_probe()
1065 dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err); in skl_probe()
1071 dev_dbg(bus->dev, "error failed to register dsp\n"); in skl_probe()
1077 if (bus->mlcap) in skl_probe()
1078 snd_hdac_ext_bus_get_ml_capabilities(bus); in skl_probe()
1083 dev_err(bus->dev, "skl_dmic_device_register failed with err: %d\n", err); in skl_probe()
1099 skl_free(bus); in skl_probe()
1106 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_shutdown() local
1111 if (!bus) in skl_shutdown()
1114 skl = bus_to_skl(bus); in skl_shutdown()
1119 snd_hdac_stop_streams_and_chip(bus); in skl_shutdown()
1120 list_for_each_entry(s, &bus->stream_list, list) { in skl_shutdown()
1122 snd_hdac_ext_stream_decouple(bus, stream, false); in skl_shutdown()
1125 snd_hdac_bus_stop_chip(bus); in skl_shutdown()
1130 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_remove() local
1131 struct skl_dev *skl = bus_to_skl(bus); in skl_remove()
1138 snd_hdac_ext_bus_device_remove(bus); in skl_remove()
1148 skl_free(bus); in skl_remove()