Lines Matching refs: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()
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()
748 codec = skl_codec_device_init(bus, addr); in probe_codec()
754 static void skl_codec_create(struct hdac_bus *bus) in skl_codec_create() argument
762 if ((bus->codec_mask & (1 << c))) { in skl_codec_create()
763 if (probe_codec(bus, c) < 0) { in skl_codec_create()
768 dev_warn(bus->dev, in skl_codec_create()
770 bus->codec_mask &= ~(1 << c); in skl_codec_create()
779 snd_hdac_bus_stop_chip(bus); in skl_codec_create()
780 skl_init_chip(bus, true); in skl_codec_create()
786 static int skl_i915_init(struct hdac_bus *bus) in skl_i915_init() argument
794 err = snd_hdac_i915_init(bus); in skl_i915_init()
798 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); in skl_i915_init()
806 struct hdac_bus *bus = skl_to_bus(skl); in skl_probe_work() local
811 err = skl_i915_init(bus); in skl_probe_work()
817 skl_dum_set(bus); in skl_probe_work()
819 err = skl_init_chip(bus, true); in skl_probe_work()
821 dev_err(bus->dev, "Init chip failed with err: %d\n", err); in skl_probe_work()
826 if (!bus->codec_mask) in skl_probe_work()
827 dev_info(bus->dev, "no hda codecs found!\n"); in skl_probe_work()
830 skl_codec_create(bus); in skl_probe_work()
833 err = skl_platform_register(bus->dev); in skl_probe_work()
835 dev_err(bus->dev, "platform register failed: %d\n", err); in skl_probe_work()
841 dev_err(bus->dev, "machine register failed: %d\n", err); in skl_probe_work()
848 list_for_each_entry(hlink, &bus->hlink_list, list) in skl_probe_work()
849 snd_hdac_ext_bus_link_put(bus, hlink); in skl_probe_work()
852 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_probe_work()
855 pm_runtime_put_noidle(bus->dev); in skl_probe_work()
856 pm_runtime_allow(bus->dev); in skl_probe_work()
863 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in skl_probe_work()
874 struct hdac_bus *bus; in skl_create() local
891 bus = skl_to_bus(skl); in skl_create()
899 snd_hdac_ext_bus_init(bus, &pci->dev, NULL, ext_ops); in skl_create()
900 bus->use_posbuf = 1; in skl_create()
903 bus->bdl_pos_adj = 0; in skl_create()
915 static int skl_first_init(struct hdac_bus *bus) in skl_first_init() argument
917 struct skl_dev *skl = bus_to_skl(bus); in skl_first_init()
927 bus->addr = pci_resource_start(pci, 0); in skl_first_init()
928 bus->remap_addr = pci_ioremap_bar(pci, 0); in skl_first_init()
929 if (bus->remap_addr == NULL) { in skl_first_init()
930 dev_err(bus->dev, "ioremap error\n"); in skl_first_init()
934 snd_hdac_bus_parse_capabilities(bus); in skl_first_init()
937 if (!bus->ppcap) { in skl_first_init()
938 dev_err(bus->dev, "bus ppcap not set, HDAudio or DSP not present?\n"); in skl_first_init()
942 if (skl_acquire_irq(bus, 0) < 0) in skl_first_init()
946 synchronize_irq(bus->irq); in skl_first_init()
948 gcap = snd_hdac_chip_readw(bus, GCAP); in skl_first_init()
949 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap); in skl_first_init()
956 dev_err(bus->dev, "no streams found in GCAP definitions?\n"); in skl_first_init()
960 bus->num_streams = cp_streams + pb_streams; in skl_first_init()
963 if (dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(64))) in skl_first_init()
964 dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(32)); in skl_first_init()
965 dma_set_max_seg_size(bus->dev, UINT_MAX); in skl_first_init()
969 (bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); in skl_first_init()
972 (bus, start_idx, pb_streams, SNDRV_PCM_STREAM_PLAYBACK); in skl_first_init()
974 err = snd_hdac_bus_alloc_stream_pages(bus); in skl_first_init()
985 struct hdac_bus *bus = NULL; in skl_probe() local
1011 bus = skl_to_bus(skl); in skl_probe()
1013 err = skl_first_init(bus); in skl_probe()
1015 dev_err(bus->dev, "skl_first_init failed with err: %d\n", err); in skl_probe()
1021 device_disable_async_suspend(bus->dev); in skl_probe()
1023 skl->nhlt = intel_nhlt_init(bus->dev); in skl_probe()
1027 dev_err(bus->dev, "no nhlt info found\n"); in skl_probe()
1031 dev_warn(bus->dev, "no nhlt info found, continuing to try to enable HDAudio codec\n"); in skl_probe()
1037 dev_err(bus->dev, "skl_nhlt_create_sysfs failed with err: %d\n", err); in skl_probe()
1046 dev_err(bus->dev, "skl_clock_device_register failed with err: %d\n", err); in skl_probe()
1051 pci_set_drvdata(skl->pci, bus); in skl_probe()
1056 dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err); in skl_probe()
1062 dev_dbg(bus->dev, "error failed to register dsp\n"); in skl_probe()
1068 if (bus->mlcap) in skl_probe()
1069 snd_hdac_ext_bus_get_ml_capabilities(bus); in skl_probe()
1074 dev_err(bus->dev, "skl_dmic_device_register failed with err: %d\n", err); in skl_probe()
1090 skl_free(bus); in skl_probe()
1097 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_shutdown() local
1102 if (!bus) in skl_shutdown()
1105 skl = bus_to_skl(bus); in skl_shutdown()
1110 snd_hdac_stop_streams(bus); in skl_shutdown()
1111 snd_hdac_ext_bus_link_power_down_all(bus); in skl_shutdown()
1114 list_for_each_entry(s, &bus->stream_list, list) { in skl_shutdown()
1116 snd_hdac_ext_stream_decouple(bus, stream, false); in skl_shutdown()
1119 snd_hdac_bus_stop_chip(bus); in skl_shutdown()
1124 struct hdac_bus *bus = pci_get_drvdata(pci); in skl_remove() local
1125 struct skl_dev *skl = bus_to_skl(bus); in skl_remove()
1132 snd_hdac_ext_bus_device_remove(bus); in skl_remove()
1142 skl_free(bus); in skl_remove()