Lines Matching refs:hsw

229 	struct sst_hsw *hsw;  member
276 struct sst_hsw *hsw; member
426 static struct sst_hsw_stream *get_stream_by_id(struct sst_hsw *hsw, in get_stream_by_id() argument
431 list_for_each_entry(stream, &hsw->stream_list, node) { in get_stream_by_id()
439 static void hsw_fw_ready(struct sst_hsw *hsw, u32 header) in hsw_fw_ready() argument
449 dev_dbg(hsw->dev, "ipc: DSP is ready 0x%8.8x offset %d\n", in hsw_fw_ready()
453 sst_dsp_read(hsw->dsp, &fw_ready, offset, sizeof(fw_ready)); in hsw_fw_ready()
455 sst_dsp_mailbox_init(hsw->dsp, fw_ready.inbox_offset, in hsw_fw_ready()
459 hsw->boot_complete = true; in hsw_fw_ready()
460 wake_up(&hsw->boot_wait); in hsw_fw_ready()
462 dev_dbg(hsw->dev, " mailbox upstream 0x%x - size 0x%x\n", in hsw_fw_ready()
464 dev_dbg(hsw->dev, " mailbox downstream 0x%x - size 0x%x\n", in hsw_fw_ready()
468 dev_dbg(hsw->dev, " Firmware info: %s \n", fw_ready.fw_info); in hsw_fw_ready()
475 dev_info(hsw->dev, "FW loaded, mailbox readback FW info: type %s, - " in hsw_fw_ready()
487 struct sst_hsw *hsw = stream->hsw; in hsw_notification_work() local
496 sst_dsp_inbox_read(hsw->dsp, glitch, sizeof(*glitch)); in hsw_notification_work()
498 dev_err(hsw->dev, "glitch %d pos 0x%x write pos 0x%x\n", in hsw_notification_work()
506 sst_dsp_inbox_read(hsw->dsp, pos, sizeof(*pos)); in hsw_notification_work()
513 dev_err(hsw->dev, "error: unknown notification 0x%x\n", in hsw_notification_work()
519 sst_dsp_shim_update_bits(hsw->dsp, SST_IPCD, in hsw_notification_work()
523 sst_dsp_shim_update_bits(hsw->dsp, SST_IMRX, SST_IMRX_BUSY, 0); in hsw_notification_work()
526 static void hsw_stream_update(struct sst_hsw *hsw, struct ipc_message *msg) in hsw_stream_update() argument
533 stream = get_stream_by_id(hsw, stream_id); in hsw_stream_update()
557 static int hsw_process_reply(struct sst_hsw *hsw, u32 header) in hsw_process_reply() argument
564 msg = sst_ipc_reply_find_msg(&hsw->ipc, header); in hsw_process_reply()
575 hsw->ipc.pending = true; in hsw_process_reply()
580 sst_dsp_inbox_read(hsw->dsp, msg->rx_data, in hsw_process_reply()
582 hsw->ipc.pending = false; in hsw_process_reply()
585 sst_dsp_outbox_read(hsw->dsp, msg->rx_data, in hsw_process_reply()
634 hsw_stream_update(hsw, msg); in hsw_process_reply()
638 sst_ipc_tx_msg_reply_complete(&hsw->ipc, msg); in hsw_process_reply()
643 static int hsw_module_message(struct sst_hsw *hsw, u32 header) in hsw_module_message() argument
650 dev_dbg(hsw->dev, "received module message header: 0x%8.8x\n", in hsw_module_message()
652 dev_dbg(hsw->dev, "operation: 0x%8.8x module_id: 0x%8.8x\n", in hsw_module_message()
657 dev_dbg(hsw->dev, "module notification received"); in hsw_module_message()
661 handled = hsw_process_reply(hsw, header); in hsw_module_message()
668 static int hsw_stream_message(struct sst_hsw *hsw, u32 header) in hsw_stream_message() argument
678 stream = get_stream_by_id(hsw, stream_id); in hsw_stream_message()
686 dev_err(hsw->dev, "error: stage msg not implemented 0x%8.8x\n", in hsw_stream_message()
694 handled = hsw_process_reply(hsw, header); in hsw_stream_message()
701 static int hsw_log_message(struct sst_hsw *hsw, u32 header) in hsw_log_message() argument
704 struct sst_hsw_log_stream *stream = &hsw->log_stream; in hsw_log_message()
708 dev_err(hsw->dev, in hsw_log_message()
716 hsw->dsp, &stream->curr_pos, sizeof(stream->curr_pos)); in hsw_log_message()
724 static int hsw_process_notification(struct sst_hsw *hsw) in hsw_process_notification() argument
726 struct sst_dsp *sst = hsw->dsp; in hsw_process_notification()
736 if (!hsw->boot_complete && header & IPC_FW_READY) { in hsw_process_notification()
737 hsw_fw_ready(hsw, header); in hsw_process_notification()
754 dev_err(hsw->dev, "error: message type %d header 0x%x\n", in hsw_process_notification()
758 handled = hsw_stream_message(hsw, header); in hsw_process_notification()
761 handled = hsw_log_message(hsw, header); in hsw_process_notification()
764 handled = hsw_module_message(hsw, header); in hsw_process_notification()
767 dev_err(hsw->dev, "error: unexpected type %d hdr 0x%8.8x\n", in hsw_process_notification()
778 struct sst_hsw *hsw = sst_dsp_get_thread_context(sst); in hsw_irq_thread() local
779 struct sst_generic_ipc *ipc = &hsw->ipc; in hsw_irq_thread()
786 ipcx = sst_dsp_ipc_msg_rx(hsw->dsp); in hsw_irq_thread()
793 handled = hsw_process_reply(hsw, ipcx); in hsw_irq_thread()
810 handled = hsw_process_notification(hsw); in hsw_irq_thread()
831 int sst_hsw_fw_get_version(struct sst_hsw *hsw, in sst_hsw_fw_get_version() argument
836 ret = sst_ipc_tx_message_wait(&hsw->ipc, in sst_hsw_fw_get_version()
840 dev_err(hsw->dev, "error: get version failed\n"); in sst_hsw_fw_get_version()
846 int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream, in sst_hsw_stream_get_volume() argument
852 sst_dsp_read(hsw->dsp, volume, in sst_hsw_stream_get_volume()
860 int sst_hsw_stream_set_volume(struct sst_hsw *hsw, in sst_hsw_stream_set_volume() argument
883 if (hsw->mute[0] && hsw->mute[1]) { in sst_hsw_stream_set_volume()
884 hsw->mute_volume[0] = hsw->mute_volume[1] = volume; in sst_hsw_stream_set_volume()
886 } else if (hsw->mute[0]) in sst_hsw_stream_set_volume()
888 else if (hsw->mute[1]) in sst_hsw_stream_set_volume()
894 if (hsw->mute[channel]) { in sst_hsw_stream_set_volume()
895 hsw->mute_volume[channel] = volume; in sst_hsw_stream_set_volume()
901 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, req, in sst_hsw_stream_set_volume()
904 dev_err(hsw->dev, "error: set stream volume failed\n"); in sst_hsw_stream_set_volume()
911 int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, in sst_hsw_mixer_get_volume() argument
917 sst_dsp_read(hsw->dsp, volume, in sst_hsw_mixer_get_volume()
918 hsw->mixer_info.volume_register_address[channel], in sst_hsw_mixer_get_volume()
925 int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel, in sst_hsw_mixer_set_volume() argument
939 if (hsw->mute[0] && hsw->mute[1]) { in sst_hsw_mixer_set_volume()
940 hsw->mute_volume[0] = hsw->mute_volume[1] = volume; in sst_hsw_mixer_set_volume()
942 } else if (hsw->mute[0]) in sst_hsw_mixer_set_volume()
944 else if (hsw->mute[1]) in sst_hsw_mixer_set_volume()
950 if (hsw->mute[channel]) { in sst_hsw_mixer_set_volume()
951 hsw->mute_volume[channel] = volume; in sst_hsw_mixer_set_volume()
959 header |= (hsw->mixer_info.mixer_hw_id << IPC_STR_ID_SHIFT); in sst_hsw_mixer_set_volume()
963 req.curve_duration = hsw->curve_duration; in sst_hsw_mixer_set_volume()
964 req.curve_type = hsw->curve_type; in sst_hsw_mixer_set_volume()
967 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, &req, in sst_hsw_mixer_set_volume()
970 dev_err(hsw->dev, "error: set mixer volume failed\n"); in sst_hsw_mixer_set_volume()
978 struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id, in sst_hsw_stream_new() argument
983 struct sst_dsp *sst = hsw->dsp; in sst_hsw_stream_new()
992 list_add(&stream->node, &hsw->stream_list); in sst_hsw_stream_new()
995 stream->hsw = hsw; in sst_hsw_stream_new()
1005 int sst_hsw_stream_free(struct sst_hsw *hsw, struct sst_hsw_stream *stream) in sst_hsw_stream_free() argument
1009 struct sst_dsp *sst = hsw->dsp; in sst_hsw_stream_free()
1013 dev_warn(hsw->dev, "warning: stream is NULL, no stream to free, ignore it.\n"); in sst_hsw_stream_free()
1026 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, &stream->free_req, in sst_hsw_stream_free()
1029 dev_err(hsw->dev, "error: free stream %d failed\n", in sst_hsw_stream_free()
1046 int sst_hsw_stream_set_bits(struct sst_hsw *hsw, in sst_hsw_stream_set_bits() argument
1050 dev_err(hsw->dev, "error: stream committed for set bits\n"); in sst_hsw_stream_set_bits()
1058 int sst_hsw_stream_set_channels(struct sst_hsw *hsw, in sst_hsw_stream_set_channels() argument
1062 dev_err(hsw->dev, "error: stream committed for set channels\n"); in sst_hsw_stream_set_channels()
1070 int sst_hsw_stream_set_rate(struct sst_hsw *hsw, in sst_hsw_stream_set_rate() argument
1074 dev_err(hsw->dev, "error: stream committed for set rate\n"); in sst_hsw_stream_set_rate()
1082 int sst_hsw_stream_set_map_config(struct sst_hsw *hsw, in sst_hsw_stream_set_map_config() argument
1087 dev_err(hsw->dev, "error: stream committed for set map\n"); in sst_hsw_stream_set_map_config()
1096 int sst_hsw_stream_set_style(struct sst_hsw *hsw, in sst_hsw_stream_set_style() argument
1100 dev_err(hsw->dev, "error: stream committed for set style\n"); in sst_hsw_stream_set_style()
1108 int sst_hsw_stream_set_valid(struct sst_hsw *hsw, in sst_hsw_stream_set_valid() argument
1112 dev_err(hsw->dev, "error: stream committed for set valid bits\n"); in sst_hsw_stream_set_valid()
1121 int sst_hsw_stream_format(struct sst_hsw *hsw, struct sst_hsw_stream *stream, in sst_hsw_stream_format() argument
1127 dev_err(hsw->dev, "error: stream committed for set format\n"); in sst_hsw_stream_format()
1140 int sst_hsw_stream_buffer(struct sst_hsw *hsw, struct sst_hsw_stream *stream, in sst_hsw_stream_buffer() argument
1145 dev_err(hsw->dev, "error: stream committed for buffer\n"); in sst_hsw_stream_buffer()
1160 int sst_hsw_stream_set_module_info(struct sst_hsw *hsw, in sst_hsw_stream_set_module_info() argument
1164 struct sst_dsp *dsp = sst_hsw_get_dsp(hsw); in sst_hsw_stream_set_module_info()
1168 dev_err(hsw->dev, "error: stream committed for set module\n"); in sst_hsw_stream_set_module_info()
1185 dev_dbg(hsw->dev, "module %d runtime %d using:\n", module->id, in sst_hsw_stream_set_module_info()
1187 dev_dbg(hsw->dev, " persistent offset 0x%x bytes 0x%x\n", in sst_hsw_stream_set_module_info()
1190 dev_dbg(hsw->dev, " scratch offset 0x%x bytes 0x%x\n", in sst_hsw_stream_set_module_info()
1197 int sst_hsw_stream_commit(struct sst_hsw *hsw, struct sst_hsw_stream *stream) in sst_hsw_stream_commit() argument
1205 dev_warn(hsw->dev, "warning: stream is NULL, no stream to commit, ignore it.\n"); in sst_hsw_stream_commit()
1210 dev_warn(hsw->dev, "warning: stream is already committed, ignore it.\n"); in sst_hsw_stream_commit()
1218 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, str_req, in sst_hsw_stream_commit()
1221 dev_err(hsw->dev, "error: stream commit failed\n"); in sst_hsw_stream_commit()
1231 snd_pcm_uframes_t sst_hsw_stream_get_old_position(struct sst_hsw *hsw, in sst_hsw_stream_get_old_position() argument
1237 void sst_hsw_stream_set_old_position(struct sst_hsw *hsw, in sst_hsw_stream_set_old_position() argument
1243 bool sst_hsw_stream_get_silence_start(struct sst_hsw *hsw, in sst_hsw_stream_get_silence_start() argument
1249 void sst_hsw_stream_set_silence_start(struct sst_hsw *hsw, in sst_hsw_stream_set_silence_start() argument
1257 int sst_hsw_mixer_get_info(struct sst_hsw *hsw) in sst_hsw_mixer_get_info() argument
1263 reply = &hsw->mixer_info; in sst_hsw_mixer_get_info()
1268 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, NULL, 0, in sst_hsw_mixer_get_info()
1271 dev_err(hsw->dev, "error: get stream info failed\n"); in sst_hsw_mixer_get_info()
1281 static int sst_hsw_stream_operations(struct sst_hsw *hsw, int type, in sst_hsw_stream_operations() argument
1290 return sst_ipc_tx_message_wait(&hsw->ipc, header, in sst_hsw_stream_operations()
1293 return sst_ipc_tx_message_nowait(&hsw->ipc, header, NULL, 0); in sst_hsw_stream_operations()
1297 int sst_hsw_stream_pause(struct sst_hsw *hsw, struct sst_hsw_stream *stream, in sst_hsw_stream_pause() argument
1303 dev_warn(hsw->dev, "warning: stream is NULL, no stream to pause, ignore it.\n"); in sst_hsw_stream_pause()
1309 ret = sst_hsw_stream_operations(hsw, IPC_STR_PAUSE, in sst_hsw_stream_pause()
1312 dev_err(hsw->dev, "error: failed to pause stream %d\n", in sst_hsw_stream_pause()
1318 int sst_hsw_stream_resume(struct sst_hsw *hsw, struct sst_hsw_stream *stream, in sst_hsw_stream_resume() argument
1324 dev_warn(hsw->dev, "warning: stream is NULL, no stream to resume, ignore it.\n"); in sst_hsw_stream_resume()
1330 ret = sst_hsw_stream_operations(hsw, IPC_STR_RESUME, in sst_hsw_stream_resume()
1333 dev_err(hsw->dev, "error: failed to resume stream %d\n", in sst_hsw_stream_resume()
1339 int sst_hsw_stream_reset(struct sst_hsw *hsw, struct sst_hsw_stream *stream) in sst_hsw_stream_reset() argument
1344 dev_warn(hsw->dev, "warning: stream is NULL, no stream to reset, ignore it.\n"); in sst_hsw_stream_reset()
1356 dev_err(hsw->dev, "error: reset stream %d still running\n", in sst_hsw_stream_reset()
1363 ret = sst_hsw_stream_operations(hsw, IPC_STR_RESET, in sst_hsw_stream_reset()
1366 dev_err(hsw->dev, "error: failed to reset stream %d\n", in sst_hsw_stream_reset()
1372 u32 sst_hsw_get_dsp_position(struct sst_hsw *hsw, in sst_hsw_get_dsp_position() argument
1377 sst_dsp_read(hsw->dsp, &rpos, in sst_hsw_get_dsp_position()
1384 u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw, in sst_hsw_get_dsp_presentation_position() argument
1389 sst_dsp_read(hsw->dsp, &ppos, in sst_hsw_get_dsp_presentation_position()
1397 int sst_hsw_device_set_config(struct sst_hsw *hsw, in sst_hsw_device_set_config() argument
1407 hsw->dx_dev = config.ssp_interface = dev; in sst_hsw_device_set_config()
1408 hsw->dx_mclk = config.clock_frequency = mclk; in sst_hsw_device_set_config()
1409 hsw->dx_mode = config.mode = mode; in sst_hsw_device_set_config()
1410 hsw->dx_clock_divider = config.clock_divider = clock_divider; in sst_hsw_device_set_config()
1420 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, &config, in sst_hsw_device_set_config()
1423 dev_err(hsw->dev, "error: set device formats failed\n"); in sst_hsw_device_set_config()
1430 int sst_hsw_dx_set_state(struct sst_hsw *hsw, in sst_hsw_dx_set_state() argument
1441 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, &state_, in sst_hsw_dx_set_state()
1444 dev_err(hsw->dev, "ipc: error set dx state %d failed\n", state); in sst_hsw_dx_set_state()
1449 dev_dbg(hsw->dev, in sst_hsw_dx_set_state()
1455 dev_dbg(hsw->dev, "ipc: got %d entry numbers for state %d\n", in sst_hsw_dx_set_state()
1461 struct sst_module_runtime *sst_hsw_runtime_module_create(struct sst_hsw *hsw, in sst_hsw_runtime_module_create() argument
1464 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_runtime_module_create()
1503 static int sst_hsw_dx_state_dump(struct sst_hsw *hsw) in sst_hsw_dx_state_dump() argument
1505 struct sst_dsp *sst = hsw->dsp; in sst_hsw_dx_state_dump()
1511 if (hsw->dx.entries_no > SST_HSW_MAX_DX_REGIONS) { in sst_hsw_dx_state_dump()
1512 dev_err(hsw->dev, in sst_hsw_dx_state_dump()
1515 memset(&hsw->dx, 0, sizeof(hsw->dx)); in sst_hsw_dx_state_dump()
1521 dev_err(hsw->dev, "error: cant allocate dma channel %d\n", ret); in sst_hsw_dx_state_dump()
1530 for (item = 0; item < hsw->dx.entries_no; item++) { in sst_hsw_dx_state_dump()
1531 if (hsw->dx.mem_info[item].source == SST_HSW_DX_TYPE_MEMORY_DUMP in sst_hsw_dx_state_dump()
1532 && hsw->dx.mem_info[item].offset > DSP_DRAM_ADDR_OFFSET in sst_hsw_dx_state_dump()
1533 && hsw->dx.mem_info[item].offset < in sst_hsw_dx_state_dump()
1536 offset = hsw->dx.mem_info[item].offset in sst_hsw_dx_state_dump()
1538 size = (hsw->dx.mem_info[item].size + 3) & (~3); in sst_hsw_dx_state_dump()
1540 ret = sst_dsp_dma_copyfrom(sst, hsw->dx_context_paddr + offset, in sst_hsw_dx_state_dump()
1543 dev_err(hsw->dev, in sst_hsw_dx_state_dump()
1545 memset(&hsw->dx, 0, sizeof(hsw->dx)); in sst_hsw_dx_state_dump()
1556 static int sst_hsw_dx_state_restore(struct sst_hsw *hsw) in sst_hsw_dx_state_restore() argument
1558 struct sst_dsp *sst = hsw->dsp; in sst_hsw_dx_state_restore()
1562 for (item = 0; item < hsw->dx.entries_no; item++) { in sst_hsw_dx_state_restore()
1563 if (hsw->dx.mem_info[item].source == SST_HSW_DX_TYPE_MEMORY_DUMP in sst_hsw_dx_state_restore()
1564 && hsw->dx.mem_info[item].offset > DSP_DRAM_ADDR_OFFSET in sst_hsw_dx_state_restore()
1565 && hsw->dx.mem_info[item].offset < in sst_hsw_dx_state_restore()
1568 offset = hsw->dx.mem_info[item].offset in sst_hsw_dx_state_restore()
1570 size = (hsw->dx.mem_info[item].size + 3) & (~3); in sst_hsw_dx_state_restore()
1573 hsw->dx_context_paddr + offset, size); in sst_hsw_dx_state_restore()
1575 dev_err(hsw->dev, in sst_hsw_dx_state_restore()
1585 int sst_hsw_dsp_load(struct sst_hsw *hsw) in sst_hsw_dsp_load() argument
1587 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_dsp_load()
1591 dev_dbg(hsw->dev, "loading audio DSP...."); in sst_hsw_dsp_load()
1595 dev_err(hsw->dev, "error: failed to wake audio DSP\n"); in sst_hsw_dsp_load()
1601 dev_err(hsw->dev, "error: cant allocate dma channel %d\n", ret); in sst_hsw_dsp_load()
1608 dev_err(hsw->dev, "error: SST FW reload failed\n"); in sst_hsw_dsp_load()
1613 ret = sst_block_alloc_scratch(hsw->dsp); in sst_hsw_dsp_load()
1621 static int sst_hsw_dsp_restore(struct sst_hsw *hsw) in sst_hsw_dsp_restore() argument
1623 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_dsp_restore()
1626 dev_dbg(hsw->dev, "restoring audio DSP...."); in sst_hsw_dsp_restore()
1630 dev_err(hsw->dev, "error: cant allocate dma channel %d\n", ret); in sst_hsw_dsp_restore()
1634 ret = sst_hsw_dx_state_restore(hsw); in sst_hsw_dsp_restore()
1636 dev_err(hsw->dev, "error: SST FW context restore failed\n"); in sst_hsw_dsp_restore()
1648 int sst_hsw_dsp_runtime_suspend(struct sst_hsw *hsw) in sst_hsw_dsp_runtime_suspend() argument
1652 dev_dbg(hsw->dev, "audio dsp runtime suspend\n"); in sst_hsw_dsp_runtime_suspend()
1654 ret = sst_hsw_dx_set_state(hsw, SST_HSW_DX_STATE_D3, &hsw->dx); in sst_hsw_dsp_runtime_suspend()
1658 sst_dsp_stall(hsw->dsp); in sst_hsw_dsp_runtime_suspend()
1660 ret = sst_hsw_dx_state_dump(hsw); in sst_hsw_dsp_runtime_suspend()
1664 sst_ipc_drop_all(&hsw->ipc); in sst_hsw_dsp_runtime_suspend()
1669 int sst_hsw_dsp_runtime_sleep(struct sst_hsw *hsw) in sst_hsw_dsp_runtime_sleep() argument
1672 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_dsp_runtime_sleep()
1679 hsw->boot_complete = false; in sst_hsw_dsp_runtime_sleep()
1686 int sst_hsw_dsp_runtime_resume(struct sst_hsw *hsw) in sst_hsw_dsp_runtime_resume() argument
1688 struct device *dev = hsw->dev; in sst_hsw_dsp_runtime_resume()
1693 if (hsw->boot_complete) in sst_hsw_dsp_runtime_resume()
1696 ret = sst_hsw_dsp_restore(hsw); in sst_hsw_dsp_runtime_resume()
1700 sst_hsw_init_module_state(hsw); in sst_hsw_dsp_runtime_resume()
1702 ret = wait_event_timeout(hsw->boot_wait, hsw->boot_complete, in sst_hsw_dsp_runtime_resume()
1705 dev_err(hsw->dev, "error: audio DSP boot timeout IPCD 0x%x IPCX 0x%x\n", in sst_hsw_dsp_runtime_resume()
1706 sst_dsp_shim_read_unlocked(hsw->dsp, SST_IPCD), in sst_hsw_dsp_runtime_resume()
1707 sst_dsp_shim_read_unlocked(hsw->dsp, SST_IPCX)); in sst_hsw_dsp_runtime_resume()
1713 ret = sst_hsw_device_set_config(hsw, hsw->dx_dev, hsw->dx_mclk, in sst_hsw_dsp_runtime_resume()
1714 hsw->dx_mode, hsw->dx_clock_divider); in sst_hsw_dsp_runtime_resume()
1722 struct sst_dsp *sst_hsw_get_dsp(struct sst_hsw *hsw) in sst_hsw_get_dsp() argument
1724 return hsw->dsp; in sst_hsw_get_dsp()
1727 void sst_hsw_init_module_state(struct sst_hsw *hsw) in sst_hsw_init_module_state() argument
1734 module = sst_module_get_from_id(hsw->dsp, id); in sst_hsw_init_module_state()
1745 bool sst_hsw_is_module_loaded(struct sst_hsw *hsw, u32 module_id) in sst_hsw_is_module_loaded() argument
1749 module = sst_module_get_from_id(hsw->dsp, module_id); in sst_hsw_is_module_loaded()
1756 bool sst_hsw_is_module_active(struct sst_hsw *hsw, u32 module_id) in sst_hsw_is_module_active() argument
1760 module = sst_module_get_from_id(hsw->dsp, module_id); in sst_hsw_is_module_active()
1767 void sst_hsw_set_module_enabled_rtd3(struct sst_hsw *hsw, u32 module_id) in sst_hsw_set_module_enabled_rtd3() argument
1769 hsw->enabled_modules_rtd3 |= (1 << module_id); in sst_hsw_set_module_enabled_rtd3()
1772 void sst_hsw_set_module_disabled_rtd3(struct sst_hsw *hsw, u32 module_id) in sst_hsw_set_module_disabled_rtd3() argument
1774 hsw->enabled_modules_rtd3 &= ~(1 << module_id); in sst_hsw_set_module_disabled_rtd3()
1777 bool sst_hsw_is_module_enabled_rtd3(struct sst_hsw *hsw, u32 module_id) in sst_hsw_is_module_enabled_rtd3() argument
1779 return hsw->enabled_modules_rtd3 & (1 << module_id); in sst_hsw_is_module_enabled_rtd3()
1782 void sst_hsw_reset_param_buf(struct sst_hsw *hsw) in sst_hsw_reset_param_buf() argument
1784 hsw->param_idx_w = 0; in sst_hsw_reset_param_buf()
1785 hsw->param_idx_r = 0; in sst_hsw_reset_param_buf()
1786 memset((void *)hsw->param_buf, 0, sizeof(hsw->param_buf)); in sst_hsw_reset_param_buf()
1789 int sst_hsw_store_param_line(struct sst_hsw *hsw, u8 *buf) in sst_hsw_store_param_line() argument
1792 if (hsw->param_idx_w > WAVES_PARAM_LINES - 1) { in sst_hsw_store_param_line()
1793 dev_warn(hsw->dev, "warning: param buffer overflow!\n"); in sst_hsw_store_param_line()
1796 memcpy(hsw->param_buf[hsw->param_idx_w], buf, WAVES_PARAM_COUNT); in sst_hsw_store_param_line()
1797 hsw->param_idx_w++; in sst_hsw_store_param_line()
1801 int sst_hsw_load_param_line(struct sst_hsw *hsw, u8 *buf) in sst_hsw_load_param_line() argument
1806 while (hsw->param_idx_r < WAVES_PARAM_LINES) { in sst_hsw_load_param_line()
1807 id = hsw->param_buf[hsw->param_idx_r][0]; in sst_hsw_load_param_line()
1808 hsw->param_idx_r++; in sst_hsw_load_param_line()
1810 memcpy(buf, hsw->param_buf[hsw->param_idx_r], in sst_hsw_load_param_line()
1815 if (hsw->param_idx_r > WAVES_PARAM_LINES - 1) { in sst_hsw_load_param_line()
1816 dev_dbg(hsw->dev, "end of buffer, roll to the beginning\n"); in sst_hsw_load_param_line()
1817 hsw->param_idx_r = 0; in sst_hsw_load_param_line()
1823 int sst_hsw_launch_param_buf(struct sst_hsw *hsw) in sst_hsw_launch_param_buf() argument
1827 if (!sst_hsw_is_module_active(hsw, SST_HSW_MODULE_WAVES)) { in sst_hsw_launch_param_buf()
1828 dev_dbg(hsw->dev, "module waves is not active\n"); in sst_hsw_launch_param_buf()
1833 for (idx = 0; idx < hsw->param_idx_w; idx++) { in sst_hsw_launch_param_buf()
1834 ret = sst_hsw_module_set_param(hsw, in sst_hsw_launch_param_buf()
1835 SST_HSW_MODULE_WAVES, 0, hsw->param_buf[idx][0], in sst_hsw_launch_param_buf()
1836 WAVES_PARAM_COUNT, hsw->param_buf[idx]); in sst_hsw_launch_param_buf()
1843 int sst_hsw_module_load(struct sst_hsw *hsw, in sst_hsw_module_load() argument
1850 struct device *dev = hsw->dev; in sst_hsw_module_load()
1851 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_module_load()
1876 hsw_sst_fw = sst_fw_new(dsp, fw, hsw); in sst_hsw_module_load()
1898 int sst_hsw_module_enable(struct sst_hsw *hsw, in sst_hsw_module_enable() argument
1906 struct device *dev = hsw->dev; in sst_hsw_module_enable()
1907 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_module_enable()
1909 if (!sst_hsw_is_module_loaded(hsw, module_id)) { in sst_hsw_module_enable()
1914 if (sst_hsw_is_module_active(hsw, module_id)) { in sst_hsw_module_enable()
1956 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, in sst_hsw_module_enable()
1966 int sst_hsw_module_disable(struct sst_hsw *hsw, in sst_hsw_module_disable() argument
1972 struct device *dev = hsw->dev; in sst_hsw_module_disable()
1973 struct sst_dsp *dsp = hsw->dsp; in sst_hsw_module_disable()
1975 if (!sst_hsw_is_module_loaded(hsw, module_id)) { in sst_hsw_module_disable()
1980 if (!sst_hsw_is_module_active(hsw, module_id)) { in sst_hsw_module_disable()
1995 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, NULL, 0, NULL, 0); in sst_hsw_module_disable()
2004 int sst_hsw_module_set_param(struct sst_hsw *hsw, in sst_hsw_module_set_param() argument
2014 struct device *dev = hsw->dev; in sst_hsw_module_set_param()
2049 ret = sst_ipc_tx_message_wait(&hsw->ipc, header, in sst_hsw_module_set_param()
2057 dma_free_coherent(hsw->dsp->dma_dev, in sst_hsw_module_set_param()
2116 struct sst_hsw *hsw; in sst_hsw_dsp_init() local
2122 hsw = devm_kzalloc(dev, sizeof(*hsw), GFP_KERNEL); in sst_hsw_dsp_init()
2123 if (hsw == NULL) in sst_hsw_dsp_init()
2126 hsw->dev = dev; in sst_hsw_dsp_init()
2128 ipc = &hsw->ipc; in sst_hsw_dsp_init()
2143 INIT_LIST_HEAD(&hsw->stream_list); in sst_hsw_dsp_init()
2144 init_waitqueue_head(&hsw->boot_wait); in sst_hsw_dsp_init()
2145 hsw_dev.thread_context = hsw; in sst_hsw_dsp_init()
2148 hsw->dsp = sst_dsp_new(dev, &hsw_dev, pdata); in sst_hsw_dsp_init()
2149 if (hsw->dsp == NULL) { in sst_hsw_dsp_init()
2154 ipc->dsp = hsw->dsp; in sst_hsw_dsp_init()
2157 hsw->dx_context = dma_alloc_coherent(hsw->dsp->dma_dev, in sst_hsw_dsp_init()
2158 SST_HSW_DX_CONTEXT_SIZE, &hsw->dx_context_paddr, GFP_KERNEL); in sst_hsw_dsp_init()
2159 if (hsw->dx_context == NULL) { in sst_hsw_dsp_init()
2165 sst_dsp_reset(hsw->dsp); in sst_hsw_dsp_init()
2168 ret = sst_hsw_module_load(hsw, SST_HSW_MODULE_BASE_FW, 0, "Base"); in sst_hsw_dsp_init()
2173 sst_hsw_module_load(hsw, SST_HSW_MODULE_WAVES, 0, "intel/IntcPP01.bin"); in sst_hsw_dsp_init()
2176 ret = sst_block_alloc_scratch(hsw->dsp); in sst_hsw_dsp_init()
2181 sst_hsw_reset_param_buf(hsw); in sst_hsw_dsp_init()
2184 sst_dsp_boot(hsw->dsp); in sst_hsw_dsp_init()
2185 ret = wait_event_timeout(hsw->boot_wait, hsw->boot_complete, in sst_hsw_dsp_init()
2189 dev_err(hsw->dev, "error: audio DSP boot timeout IPCD 0x%x IPCX 0x%x\n", in sst_hsw_dsp_init()
2190 sst_dsp_shim_read_unlocked(hsw->dsp, SST_IPCD), in sst_hsw_dsp_init()
2191 sst_dsp_shim_read_unlocked(hsw->dsp, SST_IPCX)); in sst_hsw_dsp_init()
2196 sst_hsw_init_module_state(hsw); in sst_hsw_dsp_init()
2199 sst_hsw_fw_get_version(hsw, &version); in sst_hsw_dsp_init()
2202 ret = sst_hsw_mixer_get_info(hsw); in sst_hsw_dsp_init()
2204 dev_err(hsw->dev, "error: failed to get stream info\n"); in sst_hsw_dsp_init()
2208 pdata->dsp = hsw; in sst_hsw_dsp_init()
2212 sst_dsp_reset(hsw->dsp); in sst_hsw_dsp_init()
2213 sst_fw_free_all(hsw->dsp); in sst_hsw_dsp_init()
2215 dma_free_coherent(hsw->dsp->dma_dev, SST_HSW_DX_CONTEXT_SIZE, in sst_hsw_dsp_init()
2216 hsw->dx_context, hsw->dx_context_paddr); in sst_hsw_dsp_init()
2218 sst_dsp_free(hsw->dsp); in sst_hsw_dsp_init()
2228 struct sst_hsw *hsw = pdata->dsp; in sst_hsw_dsp_free() local
2230 sst_dsp_reset(hsw->dsp); in sst_hsw_dsp_free()
2231 sst_fw_free_all(hsw->dsp); in sst_hsw_dsp_free()
2232 dma_free_coherent(hsw->dsp->dma_dev, SST_HSW_DX_CONTEXT_SIZE, in sst_hsw_dsp_free()
2233 hsw->dx_context, hsw->dx_context_paddr); in sst_hsw_dsp_free()
2234 sst_dsp_free(hsw->dsp); in sst_hsw_dsp_free()
2235 sst_ipc_fini(&hsw->ipc); in sst_hsw_dsp_free()