Lines Matching refs:sdev

29 static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,  in cl_stream_prepare()  argument
35 struct pci_dev *pci = to_pci_dev(sdev->dev); in cl_stream_prepare()
38 dsp_stream = hda_dsp_stream_get(sdev, direction, 0); in cl_stream_prepare()
41 dev_err(sdev->dev, "error: no stream available\n"); in cl_stream_prepare()
50 dev_err(sdev->dev, "error: memory alloc failed: %d\n", ret); in cl_stream_prepare()
59 ret = hda_dsp_iccmax_stream_hw_params(sdev, dsp_stream, dmab, NULL); in cl_stream_prepare()
61 dev_err(sdev->dev, "error: iccmax stream prepare failed: %d\n", ret); in cl_stream_prepare()
65 ret = hda_dsp_stream_hw_params(sdev, dsp_stream, dmab, NULL); in cl_stream_prepare()
67 dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret); in cl_stream_prepare()
70 hda_dsp_stream_spib_config(sdev, dsp_stream, HDA_DSP_SPIB_ENABLE, size); in cl_stream_prepare()
76 hda_dsp_stream_put(sdev, direction, hstream->stream_tag); in cl_stream_prepare()
86 static int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag) in cl_dsp_init() argument
88 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in cl_dsp_init()
96 ret = snd_sof_dsp_core_power_up(sdev, chip->host_managed_cores_mask); in cl_dsp_init()
99 dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n"); in cl_dsp_init()
105 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in cl_dsp_init()
114 snd_sof_dsp_write(sdev, HDA_DSP_BAR, chip->ipc_req, in cl_dsp_init()
119 ret = hda_dsp_core_run(sdev, BIT(0)); in cl_dsp_init()
122 dev_err(sdev->dev, in cl_dsp_init()
129 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in cl_dsp_init()
138 dev_err(sdev->dev, in cl_dsp_init()
145 snd_sof_dsp_update_bits_forced(sdev, HDA_DSP_BAR, in cl_dsp_init()
151 ret = snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask & in cl_dsp_init()
155 dev_err(sdev->dev, in cl_dsp_init()
161 hda_dsp_ipc_int_enable(sdev); in cl_dsp_init()
164 ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in cl_dsp_init()
175 dev_err(sdev->dev, in cl_dsp_init()
186 snd_sof_dsp_dbg_dump(sdev, flags); in cl_dsp_init()
187 snd_sof_dsp_core_power_down(sdev, chip->host_managed_cores_mask); in cl_dsp_init()
192 static int cl_trigger(struct snd_sof_dev *sdev, in cl_trigger() argument
201 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL, in cl_trigger()
205 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, in cl_trigger()
215 return hda_dsp_stream_trigger(sdev, stream, cmd); in cl_trigger()
219 static int cl_cleanup(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab, in cl_cleanup() argument
227 ret = hda_dsp_stream_spib_config(sdev, stream, HDA_DSP_SPIB_DISABLE, 0); in cl_cleanup()
229 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, in cl_cleanup()
232 hda_dsp_stream_put(sdev, hstream->direction, hstream->stream_tag); in cl_cleanup()
237 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in cl_cleanup()
239 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, in cl_cleanup()
242 snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, sd_offset, 0); in cl_cleanup()
251 static int cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *stream) in cl_copy_fw() argument
256 ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_START); in cl_copy_fw()
258 dev_err(sdev->dev, "error: DMA trigger start failed\n"); in cl_copy_fw()
262 status = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, in cl_copy_fw()
275 dev_err(sdev->dev, in cl_copy_fw()
280 ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_STOP); in cl_copy_fw()
282 dev_err(sdev->dev, "error: DMA trigger stop failed\n"); in cl_copy_fw()
290 int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) in hda_dsp_cl_boot_firmware_iccmax() argument
292 struct snd_sof_pdata *plat_data = sdev->pdata; in hda_dsp_cl_boot_firmware_iccmax()
294 struct hdac_bus *bus = sof_to_bus(sdev); in hda_dsp_cl_boot_firmware_iccmax()
303 dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); in hda_dsp_cl_boot_firmware_iccmax()
310 iccmax_stream = cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size, in hda_dsp_cl_boot_firmware_iccmax()
311 &sdev->dmab_bdl, SNDRV_PCM_STREAM_CAPTURE); in hda_dsp_cl_boot_firmware_iccmax()
313 dev_err(sdev->dev, "error: dma prepare for ICCMAX stream failed\n"); in hda_dsp_cl_boot_firmware_iccmax()
317 ret = hda_dsp_cl_boot_firmware(sdev); in hda_dsp_cl_boot_firmware_iccmax()
323 ret1 = cl_cleanup(sdev, &sdev->dmab_bdl, iccmax_stream); in hda_dsp_cl_boot_firmware_iccmax()
325 dev_err(sdev->dev, "error: ICCMAX stream cleanup failed\n"); in hda_dsp_cl_boot_firmware_iccmax()
338 int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) in hda_dsp_cl_boot_firmware() argument
340 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_cl_boot_firmware()
341 struct snd_sof_pdata *plat_data = sdev->pdata; in hda_dsp_cl_boot_firmware()
351 dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); in hda_dsp_cl_boot_firmware()
359 init_waitqueue_head(&sdev->boot_wait); in hda_dsp_cl_boot_firmware()
362 stream = cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size, in hda_dsp_cl_boot_firmware()
363 &sdev->dmab, SNDRV_PCM_STREAM_PLAYBACK); in hda_dsp_cl_boot_firmware()
365 dev_err(sdev->dev, "error: dma prepare for fw loading failed\n"); in hda_dsp_cl_boot_firmware()
369 memcpy(sdev->dmab.area, stripped_firmware.data, in hda_dsp_cl_boot_firmware()
374 dev_dbg(sdev->dev, in hda_dsp_cl_boot_firmware()
378 ret = cl_dsp_init(sdev, stream->hstream.stream_tag); in hda_dsp_cl_boot_firmware()
386 dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n", in hda_dsp_cl_boot_firmware()
406 if (!sdev->first_boot) in hda_dsp_cl_boot_firmware()
407 hda_sdw_process_wakeen(sdev); in hda_dsp_cl_boot_firmware()
413 ret = cl_copy_fw(sdev, stream); in hda_dsp_cl_boot_firmware()
415 dev_dbg(sdev->dev, "Firmware download successful, booting...\n"); in hda_dsp_cl_boot_firmware()
417 snd_sof_dsp_dbg_dump(sdev, SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX); in hda_dsp_cl_boot_firmware()
418 dev_err(sdev->dev, "error: load fw failed ret: %d\n", ret); in hda_dsp_cl_boot_firmware()
427 ret1 = cl_cleanup(sdev, &sdev->dmab, stream); in hda_dsp_cl_boot_firmware()
429 dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); in hda_dsp_cl_boot_firmware()
444 snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, in hda_dsp_cl_boot_firmware()
451 int hda_dsp_pre_fw_run(struct snd_sof_dev *sdev) in hda_dsp_pre_fw_run() argument
454 return hda_dsp_ctrl_clock_power_gating(sdev, false); in hda_dsp_pre_fw_run()
458 int hda_dsp_post_fw_run(struct snd_sof_dev *sdev) in hda_dsp_post_fw_run() argument
462 if (sdev->first_boot) { in hda_dsp_post_fw_run()
463 ret = hda_sdw_startup(sdev); in hda_dsp_post_fw_run()
465 dev_err(sdev->dev, in hda_dsp_post_fw_run()
471 hda_sdw_int_enable(sdev, true); in hda_dsp_post_fw_run()
474 return hda_dsp_ctrl_clock_power_gating(sdev, true); in hda_dsp_post_fw_run()
481 int hda_dsp_post_fw_run_icl(struct snd_sof_dev *sdev) in hda_dsp_post_fw_run_icl() argument
483 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_post_fw_run_icl()
486 if (sdev->first_boot) { in hda_dsp_post_fw_run_icl()
487 ret = hda_sdw_startup(sdev); in hda_dsp_post_fw_run_icl()
489 dev_err(sdev->dev, in hda_dsp_post_fw_run_icl()
495 hda_sdw_int_enable(sdev, true); in hda_dsp_post_fw_run_icl()
504 ret = snd_sof_dsp_core_power_up(sdev, BIT(3)); in hda_dsp_post_fw_run_icl()
506 dev_err(sdev->dev, "error: dsp core power up failed on core 3\n"); in hda_dsp_post_fw_run_icl()
510 snd_sof_dsp_stall(sdev, BIT(3)); in hda_dsp_post_fw_run_icl()
514 return hda_dsp_ctrl_clock_power_gating(sdev, true); in hda_dsp_post_fw_run_icl()
517 int hda_dsp_ext_man_get_cavs_config_data(struct snd_sof_dev *sdev, in hda_dsp_ext_man_get_cavs_config_data() argument
522 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_ext_man_get_cavs_config_data()
529 dev_err(sdev->dev, "cavs config data is inconsistent: %d\n", elem_num); in hda_dsp_ext_man_get_cavs_config_data()
540 dev_dbg(sdev->dev, "FW clock config: %s\n", in hda_dsp_ext_man_get_cavs_config_data()
548 dev_info(sdev->dev, "unsupported token type: %d\n", in hda_dsp_ext_man_get_cavs_config_data()
555 int hda_dsp_core_stall_icl(struct snd_sof_dev *sdev, unsigned int core_mask) in hda_dsp_core_stall_icl() argument
557 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_core_stall_icl()
563 dev_err(sdev->dev, "error: core_mask is not in host managed cores\n"); in hda_dsp_core_stall_icl()
568 snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, in hda_dsp_core_stall_icl()