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()
400 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_runtime_suspend() local
402 dev_dbg(bus->dev, "in %s\n", __func__); in skl_runtime_suspend()
404 return _skl_suspend(bus); in skl_runtime_suspend()
410 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_runtime_resume() local
412 dev_dbg(bus->dev, "in %s\n", __func__); in skl_runtime_resume()
414 return _skl_resume(bus); in skl_runtime_resume()
427 static int skl_free(struct hdac_bus *bus) in skl_free() argument
429 struct skl_dev *skl = bus_to_skl(bus); in skl_free()
433 snd_hdac_stop_streams_and_chip(bus); in skl_free()
435 if (bus->irq >= 0) in skl_free()
436 free_irq(bus->irq, (void *)bus); in skl_free()
437 snd_hdac_bus_free_stream_pages(bus); in skl_free()
438 snd_hdac_ext_stream_free_all(bus); in skl_free()
439 snd_hdac_ext_link_free_all(bus); in skl_free()
441 if (bus->remap_addr) in skl_free()
442 iounmap(bus->remap_addr); in skl_free()
447 snd_hdac_ext_bus_exit(bus); in skl_free()
450 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_free()
451 snd_hdac_i915_exit(bus); in skl_free()
490 struct hdac_bus *bus = skl_to_bus(skl); in skl_find_machine() local
496 dev_dbg(bus->dev, "No matching I2S machine driver found\n"); in skl_find_machine()
499 dev_err(bus->dev, "No matching machine driver found\n"); in skl_find_machine()
521 struct hdac_bus *bus = skl_to_bus(skl); in skl_machine_device_register() local
527 dev_err(bus->dev, "platform device alloc failed\n"); in skl_machine_device_register()
531 mach->mach_params.platform = dev_name(bus->dev); in skl_machine_device_register()
532 mach->mach_params.codec_mask = bus->codec_mask; in skl_machine_device_register()
536 dev_err(bus->dev, "failed to add machine device platform data\n"); in skl_machine_device_register()
543 dev_err(bus->dev, "failed to add machine device\n"); in skl_machine_device_register()
562 struct hdac_bus *bus = skl_to_bus(skl); in skl_dmic_device_register() local
569 dev_err(bus->dev, "failed to allocate dmic device\n"); in skl_dmic_device_register()
575 dev_err(bus->dev, "failed to add dmic device: %d\n", ret); in skl_dmic_device_register()
683 static struct hda_codec *skl_codec_device_init(struct hdac_bus *bus, int addr) in skl_codec_device_init() argument
688 codec = snd_hda_codec_device_init(to_hda_bus(bus), addr, "ehdaudio%dD%d", bus->idx, addr); in skl_codec_device_init()
690 dev_err(bus->dev, "device init failed for hdac device\n"); in skl_codec_device_init()
698 dev_err(bus->dev, "failed to register hdac device\n"); in skl_codec_device_init()
709 static int probe_codec(struct hdac_bus *bus, int addr) in probe_codec() argument
715 struct skl_dev *skl = bus_to_skl(bus); in probe_codec()
720 mutex_lock(&bus->cmd_mutex); in probe_codec()
721 snd_hdac_bus_send_cmd(bus, cmd); in probe_codec()
722 snd_hdac_bus_get_response(bus, addr, &res); in probe_codec()
723 mutex_unlock(&bus->cmd_mutex); in probe_codec()
726 dev_dbg(bus->dev, "codec #%d probed OK: %x\n", addr, res); in probe_codec()
734 codec = skl_codec_device_init(bus, addr); in probe_codec()
742 /* use legacy bus only for HDA codecs, idisp uses ext bus */ in probe_codec()
749 codec = skl_codec_device_init(bus, addr); in probe_codec()
755 static void skl_codec_create(struct hdac_bus *bus) in skl_codec_create() argument
763 if ((bus->codec_mask & (1 << c))) { in skl_codec_create()
764 if (probe_codec(bus, c) < 0) { in skl_codec_create()
769 dev_warn(bus->dev, in skl_codec_create()
771 bus->codec_mask &= ~(1 << c); in skl_codec_create()
774 * codec often screws up the controller bus, in skl_codec_create()
777 * better to reset the controller bus to get in skl_codec_create()
780 snd_hdac_bus_stop_chip(bus); in skl_codec_create()
781 skl_init_chip(bus, true); in skl_codec_create()
790 struct hdac_bus *bus = skl_to_bus(skl); in skl_probe_work() local
795 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); in skl_probe_work()
798 skl_dum_set(bus); in skl_probe_work()
800 err = skl_init_chip(bus, true); in skl_probe_work()
802 dev_err(bus->dev, "Init chip failed with err: %d\n", err); in skl_probe_work()
807 if (!bus->codec_mask) in skl_probe_work()
808 dev_info(bus->dev, "no hda codecs found!\n"); in skl_probe_work()
811 skl_codec_create(bus); in skl_probe_work()
814 err = skl_platform_register(bus->dev); in skl_probe_work()
816 dev_err(bus->dev, "platform register failed: %d\n", err); in skl_probe_work()
822 dev_err(bus->dev, "machine register failed: %d\n", err); in skl_probe_work()
829 list_for_each_entry(hlink, &bus->hlink_list, list) in skl_probe_work()
830 snd_hdac_ext_bus_link_put(bus, hlink); in skl_probe_work()
833 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_probe_work()
836 pm_runtime_put_noidle(bus->dev); in skl_probe_work()
837 pm_runtime_allow(bus->dev); in skl_probe_work()
844 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_probe_work()
855 struct hdac_bus *bus; in skl_create() local
872 bus = skl_to_bus(skl); in skl_create()
880 snd_hdac_ext_bus_init(bus, &pci->dev, NULL, ext_ops); in skl_create()
881 bus->use_posbuf = 1; in skl_create()
884 bus->bdl_pos_adj = 0; in skl_create()
896 static int skl_first_init(struct hdac_bus *bus) in skl_first_init() argument
898 struct skl_dev *skl = bus_to_skl(bus); in skl_first_init()
908 bus->addr = pci_resource_start(pci, 0); in skl_first_init()
909 bus->remap_addr = pci_ioremap_bar(pci, 0); in skl_first_init()
910 if (bus->remap_addr == NULL) { in skl_first_init()
911 dev_err(bus->dev, "ioremap error\n"); in skl_first_init()
915 snd_hdac_bus_parse_capabilities(bus); in skl_first_init()
918 if (!bus->ppcap) { in skl_first_init()
919 dev_err(bus->dev, "bus ppcap not set, HDAudio or DSP not present?\n"); in skl_first_init()
923 if (skl_acquire_irq(bus, 0) < 0) in skl_first_init()
927 synchronize_irq(bus->irq); in skl_first_init()
929 gcap = snd_hdac_chip_readw(bus, GCAP); in skl_first_init()
930 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap); in skl_first_init()
937 dev_err(bus->dev, "no streams found in GCAP definitions?\n"); in skl_first_init()
941 bus->num_streams = cp_streams + pb_streams; in skl_first_init()
944 if (dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(64))) in skl_first_init()
945 dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(32)); in skl_first_init()
946 dma_set_max_seg_size(bus->dev, UINT_MAX); in skl_first_init()
950 (bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); in skl_first_init()
953 (bus, start_idx, pb_streams, SNDRV_PCM_STREAM_PLAYBACK); in skl_first_init()
955 err = snd_hdac_bus_alloc_stream_pages(bus); in skl_first_init()
966 struct hdac_bus *bus = NULL; in skl_probe() local
992 bus = skl_to_bus(skl); in skl_probe()
994 err = skl_first_init(bus); in skl_probe()
996 dev_err(bus->dev, "skl_first_init failed with err: %d\n", err); in skl_probe()
1002 device_disable_async_suspend(bus->dev); in skl_probe()
1004 skl->nhlt = intel_nhlt_init(bus->dev); in skl_probe()
1008 dev_err(bus->dev, "no nhlt info found\n"); in skl_probe()
1012 dev_warn(bus->dev, "no nhlt info found, continuing to try to enable HDAudio codec\n"); in skl_probe()
1018 dev_err(bus->dev, "skl_nhlt_create_sysfs failed with err: %d\n", err); in skl_probe()
1027 dev_err(bus->dev, "skl_clock_device_register failed with err: %d\n", err); in skl_probe()
1032 pci_set_drvdata(skl->pci, bus); in skl_probe()
1037 dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err); in skl_probe()
1043 dev_dbg(bus->dev, "error failed to register dsp\n"); in skl_probe()
1049 if (bus->mlcap) in skl_probe()
1050 snd_hdac_ext_bus_get_ml_capabilities(bus); in skl_probe()
1055 dev_err(bus->dev, "skl_dmic_device_register failed with err: %d\n", err); in skl_probe()
1060 err = snd_hdac_i915_init(bus); in skl_probe()
1078 skl_free(bus); in skl_probe()
1085 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_shutdown() local
1090 if (!bus) in skl_shutdown()
1093 skl = bus_to_skl(bus); in skl_shutdown()
1098 snd_hdac_stop_streams(bus); in skl_shutdown()
1099 snd_hdac_ext_bus_link_power_down_all(bus); in skl_shutdown()
1102 list_for_each_entry(s, &bus->stream_list, list) { in skl_shutdown()
1104 snd_hdac_ext_stream_decouple(bus, stream, false); in skl_shutdown()
1107 snd_hdac_bus_stop_chip(bus); in skl_shutdown()
1112 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_remove() local
1113 struct skl_dev *skl = bus_to_skl(bus); in skl_remove()
1120 snd_hdac_ext_bus_device_remove(bus); in skl_remove()
1130 skl_free(bus); in skl_remove()