Lines Matching +full:firmware +full:- +full:initialized

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
18 #include <linux/firmware.h>
34 struct pci_dev *pci = to_pci_dev(sdev->dev); in cl_stream_prepare()
40 dev_err(sdev->dev, "error: no stream available\n"); in cl_stream_prepare()
41 return ERR_PTR(-ENODEV); in cl_stream_prepare()
43 hstream = &dsp_stream->hstream; in cl_stream_prepare()
44 hstream->substream = NULL; in cl_stream_prepare()
47 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab); in cl_stream_prepare()
49 dev_err(sdev->dev, "error: memory alloc failed: %x\n", ret); in cl_stream_prepare()
53 hstream->period_bytes = 0;/* initialize period_bytes */ in cl_stream_prepare()
54 hstream->format_val = format; in cl_stream_prepare()
55 hstream->bufsize = size; in cl_stream_prepare()
60 dev_err(sdev->dev, "error: iccmax stream prepare failed: %x\n", ret); in cl_stream_prepare()
66 dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret); in cl_stream_prepare()
77 hda_dsp_stream_put(sdev, direction, hstream->stream_tag); in cl_stream_prepare()
88 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in cl_dsp_init()
89 const struct sof_intel_dsp_desc *chip = hda->desc; in cl_dsp_init()
95 ret = hda_dsp_core_power_up(sdev, chip->host_managed_cores_mask); in cl_dsp_init()
97 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in cl_dsp_init()
98 dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n"); in cl_dsp_init()
103 for (i = 0; i < chip->ssp_count; i++) { in cl_dsp_init()
105 chip->ssp_base_offset in cl_dsp_init()
113 snd_sof_dsp_write(sdev, HDA_DSP_BAR, chip->ipc_req, in cl_dsp_init()
114 chip->ipc_req_mask | (HDA_DSP_IPC_PURGE_FW | in cl_dsp_init()
115 ((stream_tag - 1) << 9))); in cl_dsp_init()
118 ret = hda_dsp_core_run(sdev, chip->init_core_mask); in cl_dsp_init()
120 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in cl_dsp_init()
121 dev_err(sdev->dev, in cl_dsp_init()
123 ret = -EIO; in cl_dsp_init()
129 chip->ipc_ack, status, in cl_dsp_init()
130 ((status & chip->ipc_ack_mask) in cl_dsp_init()
131 == chip->ipc_ack_mask), in cl_dsp_init()
136 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in cl_dsp_init()
137 dev_err(sdev->dev, in cl_dsp_init()
145 chip->ipc_ack, in cl_dsp_init()
146 chip->ipc_ack_mask, in cl_dsp_init()
147 chip->ipc_ack_mask); in cl_dsp_init()
150 ret = hda_dsp_core_power_down(sdev, chip->host_managed_cores_mask & ~(BIT(0))); in cl_dsp_init()
152 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in cl_dsp_init()
153 dev_err(sdev->dev, in cl_dsp_init()
167 chip->rom_init_timeout * in cl_dsp_init()
172 if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) in cl_dsp_init()
173 dev_err(sdev->dev, in cl_dsp_init()
179 hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask); in cl_dsp_init()
187 struct hdac_stream *hstream = &stream->hstream; in cl_trigger()
194 1 << hstream->index, in cl_trigger()
195 1 << hstream->index); in cl_trigger()
204 hstream->running = true; in cl_trigger()
214 struct hdac_stream *hstream = &stream->hstream; in cl_cleanup()
218 if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK) in cl_cleanup()
224 hda_dsp_stream_put(sdev, hstream->direction, hstream->stream_tag); in cl_cleanup()
225 hstream->running = 0; in cl_cleanup()
226 hstream->substream = NULL; in cl_cleanup()
236 dmab->area = NULL; in cl_cleanup()
237 hstream->bufsize = 0; in cl_cleanup()
238 hstream->format_val = 0; in cl_cleanup()
250 dev_err(sdev->dev, "error: DMA trigger start failed\n"); in cl_copy_fw()
267 dev_err(sdev->dev, in cl_copy_fw()
274 dev_err(sdev->dev, "error: DMA trigger stop failed\n"); in cl_copy_fw()
284 struct snd_sof_pdata *plat_data = sdev->pdata; in hda_dsp_cl_boot_firmware_iccmax()
287 struct firmware stripped_firmware; in hda_dsp_cl_boot_firmware_iccmax()
294 if (plat_data->fw->size <= plat_data->fw_offset) { in hda_dsp_cl_boot_firmware_iccmax()
295 dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); in hda_dsp_cl_boot_firmware_iccmax()
296 return -EINVAL; in hda_dsp_cl_boot_firmware_iccmax()
299 stripped_firmware.size = plat_data->fw->size - plat_data->fw_offset; in hda_dsp_cl_boot_firmware_iccmax()
303 &sdev->dmab_bdl, SNDRV_PCM_STREAM_CAPTURE); in hda_dsp_cl_boot_firmware_iccmax()
305 dev_err(sdev->dev, "error: dma prepare for ICCMAX stream failed\n"); in hda_dsp_cl_boot_firmware_iccmax()
312 * Perform iccmax stream cleanup. This should be done even if firmware loading fails. in hda_dsp_cl_boot_firmware_iccmax()
315 ret1 = cl_cleanup(sdev, &sdev->dmab_bdl, iccmax_stream); in hda_dsp_cl_boot_firmware_iccmax()
317 dev_err(sdev->dev, "error: ICCMAX stream cleanup failed\n"); in hda_dsp_cl_boot_firmware_iccmax()
332 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_cl_boot_firmware()
333 struct snd_sof_pdata *plat_data = sdev->pdata; in hda_dsp_cl_boot_firmware()
334 const struct sof_dev_desc *desc = plat_data->desc; in hda_dsp_cl_boot_firmware()
337 struct firmware stripped_firmware; in hda_dsp_cl_boot_firmware()
340 chip_info = desc->chip_info; in hda_dsp_cl_boot_firmware()
342 if (plat_data->fw->size <= plat_data->fw_offset) { in hda_dsp_cl_boot_firmware()
343 dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); in hda_dsp_cl_boot_firmware()
344 return -EINVAL; in hda_dsp_cl_boot_firmware()
347 stripped_firmware.data = plat_data->fw->data + plat_data->fw_offset; in hda_dsp_cl_boot_firmware()
348 stripped_firmware.size = plat_data->fw->size - plat_data->fw_offset; in hda_dsp_cl_boot_firmware()
351 init_waitqueue_head(&sdev->boot_wait); in hda_dsp_cl_boot_firmware()
355 &sdev->dmab, SNDRV_PCM_STREAM_PLAYBACK); in hda_dsp_cl_boot_firmware()
357 dev_err(sdev->dev, "error: dma prepare for fw loading failed\n"); in hda_dsp_cl_boot_firmware()
361 memcpy(sdev->dmab.area, stripped_firmware.data, in hda_dsp_cl_boot_firmware()
366 dev_dbg(sdev->dev, in hda_dsp_cl_boot_firmware()
369 hda->boot_iteration = i + 1; in hda_dsp_cl_boot_firmware()
370 ret = cl_dsp_init(sdev, stream->hstream.stream_tag); in hda_dsp_cl_boot_firmware()
378 dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n", in hda_dsp_cl_boot_firmware()
380 dev_err(sdev->dev, "ROM error=0x%x: FW status=0x%x\n", in hda_dsp_cl_boot_firmware()
390 * device may trigger in-band wakes for events such as jack in hda_dsp_cl_boot_firmware()
400 * is initialized successfully, which ensures power rails are in hda_dsp_cl_boot_firmware()
403 if (!sdev->first_boot) in hda_dsp_cl_boot_firmware()
407 * at this point DSP ROM has been initialized and in hda_dsp_cl_boot_firmware()
408 * should be ready for code loading and firmware boot in hda_dsp_cl_boot_firmware()
412 dev_dbg(sdev->dev, "Firmware download successful, booting...\n"); in hda_dsp_cl_boot_firmware()
414 dev_err(sdev->dev, "error: load fw failed ret: %d\n", ret); in hda_dsp_cl_boot_firmware()
419 * This should be done even if firmware loading fails. in hda_dsp_cl_boot_firmware()
422 ret1 = cl_cleanup(sdev, &sdev->dmab, stream); in hda_dsp_cl_boot_firmware()
424 dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); in hda_dsp_cl_boot_firmware()
436 return chip_info->init_core_mask; in hda_dsp_cl_boot_firmware()
460 if (sdev->first_boot) { in hda_dsp_post_fw_run()
463 dev_err(sdev->dev, in hda_dsp_post_fw_run()
471 /* re-enable clock gating and power gating */ in hda_dsp_post_fw_run()