Lines Matching refs:sdev
64 static int hda_setup_bdle(struct snd_sof_dev *sdev, in hda_setup_bdle() argument
70 struct hdac_bus *bus = sof_to_bus(sdev); in hda_setup_bdle()
78 dev_err(sdev->dev, "error: stream frags exceeded\n"); in hda_setup_bdle()
112 int hda_dsp_stream_setup_bdl(struct snd_sof_dev *sdev, in hda_dsp_stream_setup_bdl() argument
116 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_stream_setup_bdl()
122 dev_dbg(sdev->dev, "period_bytes: %#x, bufsize: %#x\n", period_bytes, in hda_dsp_stream_setup_bdl()
154 dev_dbg(sdev->dev, "periods: %d\n", periods); in hda_dsp_stream_setup_bdl()
175 offset = hda_setup_bdle(sdev, dmab, in hda_dsp_stream_setup_bdl()
179 offset = hda_setup_bdle(sdev, dmab, in hda_dsp_stream_setup_bdl()
187 int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev, in hda_dsp_stream_spib_config() argument
194 if (!sdev->bar[HDA_DSP_SPIB_BAR]) { in hda_dsp_stream_spib_config()
195 dev_err(sdev->dev, "error: address of spib capability is NULL\n"); in hda_dsp_stream_spib_config()
202 snd_sof_dsp_update_bits(sdev, HDA_DSP_SPIB_BAR, in hda_dsp_stream_spib_config()
207 sof_io_write(sdev, hstream->spib_addr, size); in hda_dsp_stream_spib_config()
214 hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags) in hda_dsp_stream_get() argument
216 const struct sof_intel_dsp_desc *chip_info = get_chip_info(sdev->pdata); in hda_dsp_stream_get()
217 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_stream_get()
218 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_get()
245 dev_err(sdev->dev, "error: no free %s streams\n", snd_pcm_direction_name(direction)); in hda_dsp_stream_get()
258 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_get()
268 int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag) in hda_dsp_stream_put() argument
270 const struct sof_intel_dsp_desc *chip_info = get_chip_info(sdev->pdata); in hda_dsp_stream_put()
271 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_stream_put()
272 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_put()
304 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, HDA_VS_INTEL_EM2, in hda_dsp_stream_put()
310 dev_err(sdev->dev, "%s: stream_tag %d not opened!\n", in hda_dsp_stream_put()
318 static int hda_dsp_stream_reset(struct snd_sof_dev *sdev, struct hdac_stream *hstream) in hda_dsp_stream_reset() argument
325 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, SOF_STREAM_SD_OFFSET_CRST, in hda_dsp_stream_reset()
328 val = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, sd_offset); in hda_dsp_stream_reset()
333 dev_err(sdev->dev, "timeout waiting for stream reset\n"); in hda_dsp_stream_reset()
340 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, SOF_STREAM_SD_OFFSET_CRST, 0x0); in hda_dsp_stream_reset()
345 val = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, sd_offset); in hda_dsp_stream_reset()
350 dev_err(sdev->dev, "timeout waiting for stream to exit reset\n"); in hda_dsp_stream_reset()
357 int hda_dsp_stream_trigger(struct snd_sof_dev *sdev, in hda_dsp_stream_trigger() argument
369 if (!sdev->dspless_mode_selected) in hda_dsp_stream_trigger()
376 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL, in hda_dsp_stream_trigger()
380 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_trigger()
387 ret = snd_sof_dsp_read_poll_timeout(sdev, in hda_dsp_stream_trigger()
399 if (!sdev->dspless_mode_selected) in hda_dsp_stream_trigger()
404 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_trigger()
409 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_trigger()
416 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_trigger()
421 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_trigger()
427 dev_err(sdev->dev, "error: unknown command: %d\n", cmd); in hda_dsp_stream_trigger()
434 dev_err(sdev->dev, in hda_dsp_stream_trigger()
444 int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream, in hda_dsp_iccmax_stream_hw_params() argument
454 dev_err(sdev->dev, "error: no stream available\n"); in hda_dsp_iccmax_stream_hw_params()
459 dev_err(sdev->dev, "error: no dma buffer allocated!\n"); in hda_dsp_iccmax_stream_hw_params()
467 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_iccmax_stream_hw_params()
470 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_iccmax_stream_hw_params()
476 ret = hda_dsp_stream_setup_bdl(sdev, dmab, hstream); in hda_dsp_iccmax_stream_hw_params()
478 dev_err(sdev->dev, "error: set up of BDL failed\n"); in hda_dsp_iccmax_stream_hw_params()
483 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_iccmax_stream_hw_params()
486 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_iccmax_stream_hw_params()
491 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_iccmax_stream_hw_params()
496 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_iccmax_stream_hw_params()
501 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_iccmax_stream_hw_params()
505 snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, HDA_VS_INTEL_LTRP, in hda_dsp_iccmax_stream_hw_params()
509 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, in hda_dsp_iccmax_stream_hw_params()
519 int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev, in hda_dsp_stream_hw_params() argument
524 const struct sof_intel_dsp_desc *chip = get_chip_info(sdev->pdata); in hda_dsp_stream_hw_params()
525 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_hw_params()
533 dev_err(sdev->dev, "error: no stream available\n"); in hda_dsp_stream_hw_params()
538 dev_err(sdev->dev, "error: no dma buffer allocated!\n"); in hda_dsp_stream_hw_params()
547 if (!sdev->dspless_mode_selected) in hda_dsp_stream_hw_params()
548 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_stream_hw_params()
552 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, in hda_dsp_stream_hw_params()
556 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
565 dev_err(sdev->dev, in hda_dsp_stream_hw_params()
572 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
578 ret = hda_dsp_stream_reset(sdev, hstream); in hda_dsp_stream_hw_params()
586 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
589 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
594 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, in hda_dsp_stream_hw_params()
598 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
607 dev_err(sdev->dev, in hda_dsp_stream_hw_params()
614 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
621 ret = hda_dsp_stream_setup_bdl(sdev, dmab, hstream); in hda_dsp_stream_hw_params()
623 dev_err(sdev->dev, "error: set up of BDL failed\n"); in hda_dsp_stream_hw_params()
628 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, in hda_dsp_stream_hw_params()
634 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
650 if (!sdev->dspless_mode_selected && (chip->quirks & SOF_INTEL_PROCEN_FMT_QUIRK)) in hda_dsp_stream_hw_params()
652 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_stream_hw_params()
656 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
661 if (!sdev->dspless_mode_selected && (chip->quirks & SOF_INTEL_PROCEN_FMT_QUIRK)) in hda_dsp_stream_hw_params()
663 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL, in hda_dsp_stream_hw_params()
667 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
672 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
675 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
681 !(snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_ADSP_DPLBASE) in hda_dsp_stream_hw_params()
683 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, SOF_HDA_ADSP_DPUBASE, in hda_dsp_stream_hw_params()
685 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, SOF_HDA_ADSP_DPLBASE, in hda_dsp_stream_hw_params()
691 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, in hda_dsp_stream_hw_params()
698 snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_hw_params()
710 int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev, in hda_dsp_stream_hw_free() argument
719 ret = hda_dsp_stream_reset(sdev, hstream); in hda_dsp_stream_hw_free()
723 if (!sdev->dspless_mode_selected) { in hda_dsp_stream_hw_free()
724 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_hw_free()
730 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, in hda_dsp_stream_hw_free()
735 hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0); in hda_dsp_stream_hw_free()
743 bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev) in hda_dsp_check_stream_irq() argument
745 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_check_stream_irq()
752 status = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS); in hda_dsp_check_stream_irq()
754 trace_sof_intel_hda_dsp_check_stream_irq(sdev, status); in hda_dsp_check_stream_irq()
834 struct snd_sof_dev *sdev = context; in hda_dsp_stream_threaded_handler() local
835 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_threaded_handler()
847 status = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS); in hda_dsp_stream_threaded_handler()
854 active |= hda_codec_check_rirb_status(sdev); in hda_dsp_stream_threaded_handler()
863 int hda_dsp_stream_init(struct snd_sof_dev *sdev) in hda_dsp_stream_init() argument
865 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_init()
868 struct pci_dev *pci = to_pci_dev(sdev->dev); in hda_dsp_stream_init()
874 gcap = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_GCAP); in hda_dsp_stream_init()
875 dev_dbg(sdev->dev, "hda global caps = 0x%x\n", gcap); in hda_dsp_stream_init()
882 dev_dbg(sdev->dev, "detected %d playback and %d capture streams\n", in hda_dsp_stream_init()
886 dev_err(sdev->dev, "error: too many playback streams %d\n", in hda_dsp_stream_init()
892 dev_err(sdev->dev, "error: too many capture streams %d\n", in hda_dsp_stream_init()
905 dev_err(sdev->dev, "error: posbuffer dma alloc failed\n"); in hda_dsp_stream_init()
916 dev_err(sdev->dev, "error: RB alloc failed\n"); in hda_dsp_stream_init()
924 hda_stream = devm_kzalloc(sdev->dev, sizeof(*hda_stream), in hda_dsp_stream_init()
929 hda_stream->sdev = sdev; in hda_dsp_stream_init()
934 if (sdev->bar[HDA_DSP_PP_BAR]) { in hda_dsp_stream_init()
935 hext_stream->pphc_addr = sdev->bar[HDA_DSP_PP_BAR] + in hda_dsp_stream_init()
938 hext_stream->pplc_addr = sdev->bar[HDA_DSP_PP_BAR] + in hda_dsp_stream_init()
946 if (sdev->bar[HDA_DSP_SPIB_BAR]) { in hda_dsp_stream_init()
947 hstream->spib_addr = sdev->bar[HDA_DSP_SPIB_BAR] + in hda_dsp_stream_init()
951 hstream->fifo_addr = sdev->bar[HDA_DSP_SPIB_BAR] + in hda_dsp_stream_init()
960 hstream->sd_addr = sdev->bar[HDA_DSP_HDA_BAR] + sd_offset; in hda_dsp_stream_init()
976 dev_err(sdev->dev, "error: stream bdl dma alloc failed\n"); in hda_dsp_stream_init()
990 if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) { in hda_dsp_stream_init()
991 struct sof_ipc4_fw_data *ipc4_data = sdev->private; in hda_dsp_stream_init()
1001 void hda_dsp_stream_free(struct snd_sof_dev *sdev) in hda_dsp_stream_free() argument
1003 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_stream_free()
1026 devm_kfree(sdev->dev, hda_stream); in hda_dsp_stream_free()
1036 struct snd_sof_dev *sdev = hda_stream->sdev; in hda_dsp_stream_get_position() local
1060 pos = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_get_position()
1080 snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_get_position()
1091 pos = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, in hda_dsp_stream_get_position()
1105 dev_err_once(sdev->dev, "hda_position_quirk value %d not supported\n", in hda_dsp_stream_get_position()
1128 u64 hda_dsp_get_stream_llp(struct snd_sof_dev *sdev, in hda_dsp_get_stream_llp() argument
1166 u64 hda_dsp_get_stream_ldp(struct snd_sof_dev *sdev, in hda_dsp_get_stream_ldp() argument