Lines Matching defs:sdev

28 static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,
34 struct pci_dev *pci = to_pci_dev(sdev->dev);
37 dsp_stream = hda_dsp_stream_get(sdev, direction);
40 dev_err(sdev->dev, "error: no stream available\n");
49 dev_err(sdev->dev, "error: memory alloc failed: %x\n", ret);
58 ret = hda_dsp_iccmax_stream_hw_params(sdev, dsp_stream, dmab, NULL);
60 dev_err(sdev->dev, "error: iccmax stream prepare failed: %x\n", ret);
64 ret = hda_dsp_stream_hw_params(sdev, dsp_stream, dmab, NULL);
66 dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret);
69 hda_dsp_stream_spib_config(sdev, dsp_stream, HDA_DSP_SPIB_ENABLE, size);
77 hda_dsp_stream_put(sdev, direction, hstream->stream_tag);
86 static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag)
88 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
95 ret = hda_dsp_core_power_up(sdev, chip->host_managed_cores_mask);
98 dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
104 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR,
113 snd_sof_dsp_write(sdev, HDA_DSP_BAR, chip->ipc_req,
118 ret = hda_dsp_core_run(sdev, chip->init_core_mask);
121 dev_err(sdev->dev,
128 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
137 dev_err(sdev->dev,
144 snd_sof_dsp_update_bits_forced(sdev, HDA_DSP_BAR,
150 ret = hda_dsp_core_power_down(sdev, chip->host_managed_cores_mask & ~(BIT(0)));
153 dev_err(sdev->dev,
159 hda_dsp_ipc_int_enable(sdev);
162 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
173 dev_err(sdev->dev,
178 hda_dsp_dump(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX);
179 hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask);
184 static int cl_trigger(struct snd_sof_dev *sdev,
193 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL,
197 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
207 return hda_dsp_stream_trigger(sdev, stream, cmd);
211 static int cl_cleanup(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
219 ret = hda_dsp_stream_spib_config(sdev, stream, HDA_DSP_SPIB_DISABLE, 0);
221 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
224 hda_dsp_stream_put(sdev, hstream->direction, hstream->stream_tag);
229 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR,
231 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR,
234 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, sd_offset, 0);
243 static int cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *stream)
248 ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_START);
250 dev_err(sdev->dev, "error: DMA trigger start failed\n");
254 status = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
267 dev_err(sdev->dev,
272 ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_STOP);
274 dev_err(sdev->dev, "error: DMA trigger stop failed\n");
282 int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev)
284 struct snd_sof_pdata *plat_data = sdev->pdata;
286 struct hdac_bus *bus = sof_to_bus(sdev);
295 dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n");
302 iccmax_stream = cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size,
303 &sdev->dmab_bdl, SNDRV_PCM_STREAM_CAPTURE);
305 dev_err(sdev->dev, "error: dma prepare for ICCMAX stream failed\n");
309 ret = hda_dsp_cl_boot_firmware(sdev);
315 ret1 = cl_cleanup(sdev, &sdev->dmab_bdl, iccmax_stream);
317 dev_err(sdev->dev, "error: ICCMAX stream cleanup failed\n");
330 int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
332 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
333 struct snd_sof_pdata *plat_data = sdev->pdata;
343 dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n");
351 init_waitqueue_head(&sdev->boot_wait);
354 stream = cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size,
355 &sdev->dmab, SNDRV_PCM_STREAM_PLAYBACK);
357 dev_err(sdev->dev, "error: dma prepare for fw loading failed\n");
361 memcpy(sdev->dmab.area, stripped_firmware.data,
366 dev_dbg(sdev->dev,
370 ret = cl_dsp_init(sdev, stream->hstream.stream_tag);
378 dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n",
380 dev_err(sdev->dev, "ROM error=0x%x: FW status=0x%x\n",
381 snd_sof_dsp_read(sdev, HDA_DSP_BAR,
383 snd_sof_dsp_read(sdev, HDA_DSP_BAR,
403 if (!sdev->first_boot)
404 hda_sdw_process_wakeen(sdev);
410 ret = cl_copy_fw(sdev, stream);
412 dev_dbg(sdev->dev, "Firmware download successful, booting...\n");
414 dev_err(sdev->dev, "error: load fw failed ret: %d\n", ret);
422 ret1 = cl_cleanup(sdev, &sdev->dmab, stream);
424 dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n");
439 hda_dsp_dump(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX);
442 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR,
449 int hda_dsp_pre_fw_run(struct snd_sof_dev *sdev)
452 return hda_dsp_ctrl_clock_power_gating(sdev, false);
456 int hda_dsp_post_fw_run(struct snd_sof_dev *sdev)
460 if (sdev->first_boot) {
461 ret = hda_sdw_startup(sdev);
463 dev_err(sdev->dev,
469 hda_sdw_int_enable(sdev, true);
472 return hda_dsp_ctrl_clock_power_gating(sdev, true);