Lines Matching full:bus
42 avs_hda_update_config_dword(struct hdac_bus *bus, u32 reg, u32 mask, u32 value) in avs_hda_update_config_dword() argument
44 struct pci_dev *pci = to_pci_dev(bus->dev); in avs_hda_update_config_dword()
60 static void avs_hdac_clock_gating_enable(struct hdac_bus *bus, bool enable) in avs_hdac_clock_gating_enable() argument
64 avs_hda_update_config_dword(bus, AZX_PCIREG_CGCTL, cgctl_mask, value); in avs_hdac_clock_gating_enable()
84 static int avs_hdac_bus_init_streams(struct hdac_bus *bus) in avs_hdac_bus_init_streams() argument
89 gcap = snd_hdac_chip_readw(bus, GCAP); in avs_hdac_bus_init_streams()
92 bus->num_streams = cp_streams + pb_streams; in avs_hdac_bus_init_streams()
94 snd_hdac_ext_stream_init_all(bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); in avs_hdac_bus_init_streams()
95 snd_hdac_ext_stream_init_all(bus, cp_streams, pb_streams, SNDRV_PCM_STREAM_PLAYBACK); in avs_hdac_bus_init_streams()
97 return snd_hdac_bus_alloc_stream_pages(bus); in avs_hdac_bus_init_streams()
100 static bool avs_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset) in avs_hdac_bus_init_chip() argument
105 avs_hdac_clock_gating_enable(bus, false); in avs_hdac_bus_init_chip()
106 ret = snd_hdac_bus_init_chip(bus, full_reset); in avs_hdac_bus_init_chip()
109 list_for_each_entry(hlink, &bus->hlink_list, list) in avs_hdac_bus_init_chip()
112 avs_hdac_clock_gating_enable(bus, true); in avs_hdac_bus_init_chip()
117 snd_hdac_chip_updatel(bus, VS_EM2, AZX_VS_EM2_DUM, AZX_VS_EM2_DUM); in avs_hdac_bus_init_chip()
122 static int probe_codec(struct hdac_bus *bus, int addr) in probe_codec() argument
130 mutex_lock(&bus->cmd_mutex); in probe_codec()
131 snd_hdac_bus_send_cmd(bus, cmd); in probe_codec()
132 snd_hdac_bus_get_response(bus, addr, &res); in probe_codec()
133 mutex_unlock(&bus->cmd_mutex); in probe_codec()
137 dev_dbg(bus->dev, "codec #%d probed OK: 0x%x\n", addr, res); in probe_codec()
139 codec = snd_hda_codec_device_init(to_hda_bus(bus), addr, "hdaudioB%dD%d", bus->idx, addr); in probe_codec()
141 dev_err(bus->dev, "init codec failed: %ld\n", PTR_ERR(codec)); in probe_codec()
154 dev_warn(bus->dev, "failed to config codec #%d: %d\n", addr, ret); in probe_codec()
161 static void avs_hdac_bus_probe_codecs(struct hdac_bus *bus) in avs_hdac_bus_probe_codecs() argument
167 if (!(bus->codec_mask & BIT(c))) in avs_hdac_bus_probe_codecs()
170 ret = probe_codec(bus, c); in avs_hdac_bus_probe_codecs()
179 dev_warn(bus->dev, "Codec #%d probe error; disabling it...\n", c); in avs_hdac_bus_probe_codecs()
180 bus->codec_mask &= ~BIT(c); in avs_hdac_bus_probe_codecs()
183 * codec often screws up the controller bus, in avs_hdac_bus_probe_codecs()
186 * better to reset the controller bus to get in avs_hdac_bus_probe_codecs()
189 snd_hdac_bus_stop_chip(bus); in avs_hdac_bus_probe_codecs()
190 avs_hdac_bus_init_chip(bus, true); in avs_hdac_bus_probe_codecs()
197 struct hdac_bus *bus = &adev->base.core; in avs_hda_probe_work() local
201 pm_runtime_set_active(bus->dev); /* clear runtime_error flag */ in avs_hda_probe_work()
203 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); in avs_hda_probe_work()
204 avs_hdac_bus_init_chip(bus, true); in avs_hda_probe_work()
205 avs_hdac_bus_probe_codecs(bus); in avs_hda_probe_work()
206 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in avs_hda_probe_work()
209 list_for_each_entry(hlink, &bus->hlink_list, list) in avs_hda_probe_work()
210 snd_hdac_ext_bus_link_put(bus, hlink); in avs_hda_probe_work()
212 snd_hdac_ext_bus_ppcap_enable(bus, true); in avs_hda_probe_work()
213 snd_hdac_ext_bus_ppcap_int_enable(bus, true); in avs_hda_probe_work()
225 pm_runtime_set_autosuspend_delay(bus->dev, 2000); in avs_hda_probe_work()
226 pm_runtime_use_autosuspend(bus->dev); in avs_hda_probe_work()
227 pm_runtime_mark_last_busy(bus->dev); in avs_hda_probe_work()
228 pm_runtime_put_autosuspend(bus->dev); in avs_hda_probe_work()
229 pm_runtime_allow(bus->dev); in avs_hda_probe_work()
248 static void hdac_update_stream(struct hdac_bus *bus, struct hdac_stream *stream) in hdac_update_stream() argument
260 static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus) in avs_hda_interrupt() argument
265 status = snd_hdac_chip_readl(bus, INTSTS); in avs_hda_interrupt()
266 if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream)) in avs_hda_interrupt()
269 spin_lock_irq(&bus->reg_lock); in avs_hda_interrupt()
271 status = snd_hdac_chip_readb(bus, RIRBSTS); in avs_hda_interrupt()
274 snd_hdac_bus_update_rirb(bus); in avs_hda_interrupt()
275 snd_hdac_chip_writeb(bus, RIRBSTS, RIRB_INT_MASK); in avs_hda_interrupt()
279 spin_unlock_irq(&bus->reg_lock); in avs_hda_interrupt()
285 struct hdac_bus *bus = dev_id; in avs_hda_irq_handler() local
288 intsts = snd_hdac_chip_readl(bus, INTSTS); in avs_hda_irq_handler()
293 snd_hdac_chip_updatel(bus, INTCTL, AZX_INT_GLOBAL_EN, 0); in avs_hda_irq_handler()
300 struct hdac_bus *bus = dev_id; in avs_hda_irq_thread() local
303 status = snd_hdac_chip_readl(bus, INTSTS); in avs_hda_irq_thread()
305 avs_hda_interrupt(bus); in avs_hda_irq_thread()
308 snd_hdac_chip_updatel(bus, INTCTL, AZX_INT_GLOBAL_EN, AZX_INT_GLOBAL_EN); in avs_hda_irq_thread()
323 struct hdac_bus *bus = &adev->base.core; in avs_dsp_irq_thread() local
326 status = readl(bus->ppcap + AZX_REG_PP_PPSTS); in avs_dsp_irq_thread()
331 snd_hdac_chip_updatel(bus, INTCTL, AZX_INT_GLOBAL_EN, AZX_INT_GLOBAL_EN); in avs_dsp_irq_thread()
338 struct hdac_bus *bus = &adev->base.core; in avs_hdac_acquire_irq() local
339 struct pci_dev *pci = to_pci_dev(bus->dev); in avs_hdac_acquire_irq()
349 ret = pci_request_irq(pci, 0, avs_hda_irq_handler, avs_hda_irq_thread, bus, in avs_hdac_acquire_irq()
366 pci_free_irq(pci, 0, bus); in avs_hdac_acquire_irq()
374 struct hda_bus *bus = &adev->base; in avs_bus_init() local
379 ret = snd_hdac_ext_bus_init(&bus->core, dev, NULL, &soc_hda_ext_bus_ops); in avs_bus_init()
383 bus->core.use_posbuf = 1; in avs_bus_init()
384 bus->core.bdl_pos_adj = 0; in avs_bus_init()
385 bus->core.sync_write = 1; in avs_bus_init()
386 bus->pci = pci; in avs_bus_init()
387 bus->mixer_assigned = -1; in avs_bus_init()
388 mutex_init(&bus->prepare_mutex); in avs_bus_init()
420 struct hdac_bus *bus; in avs_pci_probe() local
444 dev_err(dev, "failed to init avs bus: %d\n", ret); in avs_pci_probe()
452 bus = &adev->base.core; in avs_pci_probe()
453 bus->addr = pci_resource_start(pci, 0); in avs_pci_probe()
454 bus->remap_addr = pci_ioremap_bar(pci, 0); in avs_pci_probe()
455 if (!bus->remap_addr) { in avs_pci_probe()
456 dev_err(bus->dev, "ioremap error\n"); in avs_pci_probe()
463 dev_err(bus->dev, "ioremap error\n"); in avs_pci_probe()
468 snd_hdac_bus_parse_capabilities(bus); in avs_pci_probe()
469 if (bus->mlcap) in avs_pci_probe()
470 snd_hdac_ext_bus_get_ml_capabilities(bus); in avs_pci_probe()
476 ret = avs_hdac_bus_init_streams(bus); in avs_pci_probe()
484 dev_err(bus->dev, "failed to acquire irq: %d\n", ret); in avs_pci_probe()
489 pci_set_drvdata(pci, bus); in avs_pci_probe()
492 ret = snd_hdac_i915_init(bus); in avs_pci_probe()
496 dev_info(bus->dev, "i915 init unsuccessful: %d\n", ret); in avs_pci_probe()
504 pci_free_irq(pci, 0, bus); in avs_pci_probe()
509 snd_hdac_bus_free_stream_pages(bus); in avs_pci_probe()
510 snd_hdac_ext_stream_free_all(bus); in avs_pci_probe()
514 iounmap(bus->remap_addr); in avs_pci_probe()
522 struct hdac_bus *bus = pci_get_drvdata(pci); in avs_pci_shutdown() local
523 struct avs_dev *adev = hdac_to_avs(bus); in avs_pci_shutdown()
528 snd_hdac_stop_streams(bus); in avs_pci_shutdown()
530 snd_hdac_ext_bus_ppcap_int_enable(bus, false); in avs_pci_shutdown()
531 snd_hdac_ext_bus_link_power_down_all(bus); in avs_pci_shutdown()
533 snd_hdac_bus_stop_chip(bus); in avs_pci_shutdown()
534 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in avs_pci_shutdown()
537 pci_free_irq(pci, 0, bus); in avs_pci_shutdown()
544 struct hdac_bus *bus = pci_get_drvdata(pci); in avs_pci_remove() local
545 struct avs_dev *adev = hdac_to_avs(bus); in avs_pci_remove()
558 snd_hdac_stop_streams_and_chip(bus); in avs_pci_remove()
560 snd_hdac_ext_bus_ppcap_int_enable(bus, false); in avs_pci_remove()
563 list_for_each_entry_safe(hdev, save, &bus->codec_list, list) in avs_pci_remove()
566 snd_hdac_bus_free_stream_pages(bus); in avs_pci_remove()
567 snd_hdac_ext_stream_free_all(bus); in avs_pci_remove()
569 snd_hdac_ext_link_free_all(bus); in avs_pci_remove()
570 snd_hdac_ext_bus_exit(bus); in avs_pci_remove()
573 snd_hdac_ext_bus_ppcap_enable(bus, false); in avs_pci_remove()
576 snd_hdac_bus_stop_chip(bus); in avs_pci_remove()
577 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in avs_pci_remove()
578 if (bus->audio_component) in avs_pci_remove()
579 snd_hdac_i915_exit(bus); in avs_pci_remove()
583 pci_free_irq(pci, 0, bus); in avs_pci_remove()
585 iounmap(bus->remap_addr); in avs_pci_remove()
601 struct hdac_bus *bus = &adev->base.core; in avs_suspend_standby() local
604 if (bus->cmd_dma_state) in avs_suspend_standby()
605 snd_hdac_bus_stop_cmd_io(bus); in avs_suspend_standby()
607 snd_hdac_ext_bus_link_power_down_all(bus); in avs_suspend_standby()
617 struct hdac_bus *bus = &adev->base.core; in avs_suspend_common() local
624 snd_hdac_ext_bus_link_power_down_all(bus); in avs_suspend_common()
638 snd_hdac_ext_bus_ppcap_int_enable(bus, false); in avs_suspend_common()
646 snd_hdac_ext_bus_ppcap_enable(bus, false); in avs_suspend_common()
649 snd_hdac_bus_stop_chip(bus); in avs_suspend_common()
651 avs_hdac_clock_gating_enable(bus, false); in avs_suspend_common()
652 snd_hdac_bus_enter_link_reset(bus); in avs_suspend_common()
653 avs_hdac_clock_gating_enable(bus, true); in avs_suspend_common()
655 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false); in avs_suspend_common()
662 struct hdac_bus *bus = &adev->base.core; in avs_resume_standby() local
668 snd_hdac_ext_bus_link_power_up_all(bus); in avs_resume_standby()
670 if (bus->cmd_dma_state) in avs_resume_standby()
671 snd_hdac_bus_init_cmd_io(bus); in avs_resume_standby()
678 struct hdac_bus *bus = &adev->base.core; in avs_resume_common() local
684 snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); in avs_resume_common()
685 avs_hdac_bus_init_chip(bus, true); in avs_resume_common()
687 snd_hdac_ext_bus_ppcap_enable(bus, true); in avs_resume_common()
688 snd_hdac_ext_bus_ppcap_int_enable(bus, true); in avs_resume_common()