Lines Matching refs:bus

58 	struct hdac_bus *bus = skl_to_bus(skl);
67 dev_dbg(bus->dev, "Clearing TCSEL\n");
107 struct hdac_bus *bus = pci_get_drvdata(pci);
116 snd_hdac_chip_updatel(bus, VS_EM2, AZX_REG_VS_EM2_L1SEN, val);
128 static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
133 snd_hdac_set_codec_wakeup(bus, true);
134 skl_enable_miscbdcge(bus->dev, false);
135 ret = snd_hdac_bus_init_chip(bus, full_reset);
138 list_for_each_entry(hlink, &bus->hlink_list, list)
141 skl_enable_miscbdcge(bus->dev, true);
142 snd_hdac_set_codec_wakeup(bus, false);
150 struct hdac_bus *bus = pci_get_drvdata(pci);
154 reg = snd_hdac_chip_readb(bus, VS_D0I3C);
158 reg = snd_hdac_chip_readb(bus, VS_D0I3C);
163 dev_err(bus->dev, "Before D0I3C update: D0I3C CIP timeout\n");
172 snd_hdac_chip_writeb(bus, VS_D0I3C, reg);
176 reg = snd_hdac_chip_readb(bus, VS_D0I3C);
179 reg = snd_hdac_chip_readb(bus, VS_D0I3C);
184 dev_err(bus->dev, "After D0I3C update: D0I3C CIP timeout\n");
188 dev_dbg(bus->dev, "D0I3C register = 0x%x\n",
189 snd_hdac_chip_readb(bus, VS_D0I3C));
194 * @bus: HD-audio core bus
199 static void skl_dum_set(struct hdac_bus *bus)
202 if (!(snd_hdac_chip_readb(bus, GCTL) & AZX_GCTL_RESET)) {
203 skl_enable_miscbdcge(bus->dev, false);
204 snd_hdac_bus_exit_link_reset(bus);
205 skl_enable_miscbdcge(bus->dev, true);
208 snd_hdac_chip_updatel(bus, VS_EM2, AZX_VS_EM2_DUM, AZX_VS_EM2_DUM);
212 static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr)
219 struct hdac_bus *bus = dev_id;
222 if (!pm_runtime_active(bus->dev))
225 spin_lock(&bus->reg_lock);
227 status = snd_hdac_chip_readl(bus, INTSTS);
229 spin_unlock(&bus->reg_lock);
234 status = snd_hdac_chip_readb(bus, RIRBSTS);
237 snd_hdac_bus_update_rirb(bus);
238 snd_hdac_chip_writeb(bus, RIRBSTS, RIRB_INT_MASK);
241 spin_unlock(&bus->reg_lock);
243 return snd_hdac_chip_readl(bus, INTSTS) ? IRQ_WAKE_THREAD : IRQ_HANDLED;
248 struct hdac_bus *bus = dev_id;
251 status = snd_hdac_chip_readl(bus, INTSTS);
253 snd_hdac_bus_handle_stream_irq(bus, status, skl_stream_update);
258 static int skl_acquire_irq(struct hdac_bus *bus, int do_disconnect)
260 struct skl_dev *skl = bus_to_skl(bus);
266 KBUILD_MODNAME, bus);
268 dev_err(bus->dev,
274 bus->irq = skl->pci->irq;
283 struct hdac_bus *bus = pci_get_drvdata(pci);
284 struct skl_dev *skl = bus_to_skl(bus);
290 static int _skl_suspend(struct hdac_bus *bus)
292 struct skl_dev *skl = bus_to_skl(bus);
293 struct pci_dev *pci = to_pci_dev(bus->dev);
296 snd_hdac_ext_bus_link_power_down_all(bus);
302 snd_hdac_bus_stop_chip(bus);
305 skl_enable_miscbdcge(bus->dev, false);
306 snd_hdac_bus_enter_link_reset(bus);
307 skl_enable_miscbdcge(bus->dev, true);
313 static int _skl_resume(struct hdac_bus *bus)
315 struct skl_dev *skl = bus_to_skl(bus);
318 skl_dum_set(bus);
319 skl_init_chip(bus, true);
332 struct hdac_bus *bus = pci_get_drvdata(pci);
333 struct skl_dev *skl = bus_to_skl(bus);
342 snd_hdac_ext_bus_link_power_down_all(bus);
344 if (bus->cmd_dma_state)
345 snd_hdac_bus_stop_cmd_io(bus);
347 enable_irq_wake(bus->irq);
350 ret = _skl_suspend(bus);
362 struct hdac_bus *bus = pci_get_drvdata(pci);
363 struct skl_dev *skl = bus_to_skl(bus);
373 snd_hdac_ext_bus_link_power_up_all(bus);
374 disable_irq_wake(bus->irq);
380 list_for_each_entry(hlink, &bus->hlink_list, list) {
386 if (bus->cmd_dma_state)
387 snd_hdac_bus_init_cmd_io(bus);
389 ret = _skl_resume(bus);
400 struct hdac_bus *bus = pci_get_drvdata(pci);
402 dev_dbg(bus->dev, "in %s\n", __func__);
404 return _skl_suspend(bus);
410 struct hdac_bus *bus = pci_get_drvdata(pci);
412 dev_dbg(bus->dev, "in %s\n", __func__);
414 return _skl_resume(bus);
427 static int skl_free(struct hdac_bus *bus)
429 struct skl_dev *skl = bus_to_skl(bus);
433 snd_hdac_stop_streams_and_chip(bus);
435 if (bus->irq >= 0)
436 free_irq(bus->irq, (void *)bus);
437 snd_hdac_bus_free_stream_pages(bus);
438 snd_hdac_ext_stream_free_all(bus);
439 snd_hdac_ext_link_free_all(bus);
441 if (bus->remap_addr)
442 iounmap(bus->remap_addr);
447 snd_hdac_ext_bus_exit(bus);
450 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
451 snd_hdac_i915_exit(bus);
490 struct hdac_bus *bus = skl_to_bus(skl);
496 dev_dbg(bus->dev, "No matching I2S machine driver found\n");
499 dev_err(bus->dev, "No matching machine driver found\n");
521 struct hdac_bus *bus = skl_to_bus(skl);
527 dev_err(bus->dev, "platform device alloc failed\n");
531 mach->mach_params.platform = dev_name(bus->dev);
532 mach->mach_params.codec_mask = bus->codec_mask;
536 dev_err(bus->dev, "failed to add machine device platform data\n");
543 dev_err(bus->dev, "failed to add machine device\n");
562 struct hdac_bus *bus = skl_to_bus(skl);
569 dev_err(bus->dev, "failed to allocate dmic device\n");
575 dev_err(bus->dev, "failed to add dmic device: %d\n", ret);
683 static struct hda_codec *skl_codec_device_init(struct hdac_bus *bus, int addr)
688 codec = snd_hda_codec_device_init(to_hda_bus(bus), addr, "ehdaudio%dD%d", bus->idx, addr);
690 dev_err(bus->dev, "device init failed for hdac device\n");
698 dev_err(bus->dev, "failed to register hdac device\n");
709 static int probe_codec(struct hdac_bus *bus, int addr)
715 struct skl_dev *skl = bus_to_skl(bus);
720 mutex_lock(&bus->cmd_mutex);
721 snd_hdac_bus_send_cmd(bus, cmd);
722 snd_hdac_bus_get_response(bus, addr, &res);
723 mutex_unlock(&bus->cmd_mutex);
726 dev_dbg(bus->dev, "codec #%d probed OK: %x\n", addr, res);
734 codec = skl_codec_device_init(bus, addr);
741 /* use legacy bus only for HDA codecs, idisp uses ext bus */
748 codec = skl_codec_device_init(bus, addr);
754 static void skl_codec_create(struct hdac_bus *bus)
762 if ((bus->codec_mask & (1 << c))) {
763 if (probe_codec(bus, c) < 0) {
768 dev_warn(bus->dev,
770 bus->codec_mask &= ~(1 << c);
773 * codec often screws up the controller bus,
776 * better to reset the controller bus to get
779 snd_hdac_bus_stop_chip(bus);
780 skl_init_chip(bus, true);
786 static int skl_i915_init(struct hdac_bus *bus)
794 err = snd_hdac_i915_init(bus);
798 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);
806 struct hdac_bus *bus = skl_to_bus(skl);
811 err = skl_i915_init(bus);
817 skl_dum_set(bus);
819 err = skl_init_chip(bus, true);
821 dev_err(bus->dev, "Init chip failed with err: %d\n", err);
826 if (!bus->codec_mask)
827 dev_info(bus->dev, "no hda codecs found!\n");
830 skl_codec_create(bus);
833 err = skl_platform_register(bus->dev);
835 dev_err(bus->dev, "platform register failed: %d\n", err);
841 dev_err(bus->dev, "machine register failed: %d\n", err);
848 list_for_each_entry(hlink, &bus->hlink_list, list)
849 snd_hdac_ext_bus_link_put(bus, hlink);
852 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
855 pm_runtime_put_noidle(bus->dev);
856 pm_runtime_allow(bus->dev);
863 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
874 struct hdac_bus *bus;
891 bus = skl_to_bus(skl);
899 snd_hdac_ext_bus_init(bus, &pci->dev, NULL, ext_ops);
900 bus->use_posbuf = 1;
903 bus->bdl_pos_adj = 0;
915 static int skl_first_init(struct hdac_bus *bus)
917 struct skl_dev *skl = bus_to_skl(bus);
927 bus->addr = pci_resource_start(pci, 0);
928 bus->remap_addr = pci_ioremap_bar(pci, 0);
929 if (bus->remap_addr == NULL) {
930 dev_err(bus->dev, "ioremap error\n");
934 snd_hdac_bus_parse_capabilities(bus);
937 if (!bus->ppcap) {
938 dev_err(bus->dev, "bus ppcap not set, HDAudio or DSP not present?\n");
942 if (skl_acquire_irq(bus, 0) < 0)
946 synchronize_irq(bus->irq);
948 gcap = snd_hdac_chip_readw(bus, GCAP);
949 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap);
956 dev_err(bus->dev, "no streams found in GCAP definitions?\n");
960 bus->num_streams = cp_streams + pb_streams;
963 if (dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(64)))
964 dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(32));
965 dma_set_max_seg_size(bus->dev, UINT_MAX);
969 (bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE);
972 (bus, start_idx, pb_streams, SNDRV_PCM_STREAM_PLAYBACK);
974 err = snd_hdac_bus_alloc_stream_pages(bus);
985 struct hdac_bus *bus = NULL;
1011 bus = skl_to_bus(skl);
1013 err = skl_first_init(bus);
1015 dev_err(bus->dev, "skl_first_init failed with err: %d\n", err);
1021 device_disable_async_suspend(bus->dev);
1023 skl->nhlt = intel_nhlt_init(bus->dev);
1027 dev_err(bus->dev, "no nhlt info found\n");
1031 dev_warn(bus->dev, "no nhlt info found, continuing to try to enable HDAudio codec\n");
1037 dev_err(bus->dev, "skl_nhlt_create_sysfs failed with err: %d\n", err);
1046 dev_err(bus->dev, "skl_clock_device_register failed with err: %d\n", err);
1051 pci_set_drvdata(skl->pci, bus);
1056 dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
1062 dev_dbg(bus->dev, "error failed to register dsp\n");
1068 if (bus->mlcap)
1069 snd_hdac_ext_bus_get_ml_capabilities(bus);
1074 dev_err(bus->dev, "skl_dmic_device_register failed with err: %d\n", err);
1090 skl_free(bus);
1097 struct hdac_bus *bus = pci_get_drvdata(pci);
1102 if (!bus)
1105 skl = bus_to_skl(bus);
1110 snd_hdac_stop_streams(bus);
1111 snd_hdac_ext_bus_link_power_down_all(bus);
1114 list_for_each_entry(s, &bus->stream_list, list) {
1116 snd_hdac_ext_stream_decouple(bus, stream, false);
1119 snd_hdac_bus_stop_chip(bus);
1124 struct hdac_bus *bus = pci_get_drvdata(pci);
1125 struct skl_dev *skl = bus_to_skl(bus);
1132 snd_hdac_ext_bus_device_remove(bus);
1142 skl_free(bus);