Lines Matching refs:sdev
18 void acp_mailbox_write(struct snd_sof_dev *sdev, u32 offset, void *message, size_t bytes) in acp_mailbox_write() argument
20 memcpy_to_scratch(sdev, offset, message, bytes); in acp_mailbox_write()
24 void acp_mailbox_read(struct snd_sof_dev *sdev, u32 offset, void *message, size_t bytes) in acp_mailbox_read() argument
26 memcpy_from_scratch(sdev, offset, message, bytes); in acp_mailbox_read()
32 struct snd_sof_dev *sdev = adata->dev; in acpbus_trigger_host_to_dsp_swintr() local
33 const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); in acpbus_trigger_host_to_dsp_swintr()
36 swintr_trigger = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->dsp_intr_base + in acpbus_trigger_host_to_dsp_swintr()
39 snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->dsp_intr_base + DSP_SW_INTR_TRIG_OFFSET, in acpbus_trigger_host_to_dsp_swintr()
43 static void acp_ipc_host_msg_set(struct snd_sof_dev *sdev) in acp_ipc_host_msg_set() argument
45 unsigned int host_msg = sdev->debug_box.offset + in acp_ipc_host_msg_set()
48 snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + host_msg, 1); in acp_ipc_host_msg_set()
51 static void acp_dsp_ipc_host_done(struct snd_sof_dev *sdev) in acp_dsp_ipc_host_done() argument
53 unsigned int dsp_msg = sdev->debug_box.offset + in acp_dsp_ipc_host_done()
56 snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_msg, 0); in acp_dsp_ipc_host_done()
59 static void acp_dsp_ipc_dsp_done(struct snd_sof_dev *sdev) in acp_dsp_ipc_dsp_done() argument
61 unsigned int dsp_ack = sdev->debug_box.offset + in acp_dsp_ipc_dsp_done()
64 snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_ack, 0); in acp_dsp_ipc_dsp_done()
67 int acp_sof_ipc_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) in acp_sof_ipc_send_msg() argument
69 struct acp_dev_data *adata = sdev->pdata->hw_pdata; in acp_sof_ipc_send_msg()
70 const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); in acp_sof_ipc_send_msg()
71 unsigned int offset = sdev->host_box.offset; in acp_sof_ipc_send_msg()
74 while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset)) { in acp_sof_ipc_send_msg()
78 dev_err(sdev->dev, "%s: Failed to acquire HW lock\n", __func__); in acp_sof_ipc_send_msg()
83 acp_mailbox_write(sdev, offset, msg->msg_data, msg->msg_size); in acp_sof_ipc_send_msg()
84 acp_ipc_host_msg_set(sdev); in acp_sof_ipc_send_msg()
90 snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset, 0x0); in acp_sof_ipc_send_msg()
96 static void acp_dsp_ipc_get_reply(struct snd_sof_dev *sdev) in acp_dsp_ipc_get_reply() argument
98 struct snd_sof_ipc_msg *msg = sdev->msg; in acp_dsp_ipc_get_reply()
101 unsigned int offset = sdev->host_box.offset; in acp_dsp_ipc_get_reply()
110 dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); in acp_dsp_ipc_get_reply()
128 acp_mailbox_read(sdev, offset, &reply, sizeof(reply)); in acp_dsp_ipc_get_reply()
136 dev_err(sdev->dev, "reply expected %zu got %u bytes\n", in acp_dsp_ipc_get_reply()
142 acp_mailbox_read(sdev, offset, msg->reply_data, msg->reply_size); in acp_dsp_ipc_get_reply()
150 struct snd_sof_dev *sdev = context; in acp_sof_ipc_irq_thread() local
151 unsigned int dsp_msg_write = sdev->debug_box.offset + in acp_sof_ipc_irq_thread()
153 unsigned int dsp_ack_write = sdev->debug_box.offset + in acp_sof_ipc_irq_thread()
158 if (sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE) { in acp_sof_ipc_irq_thread()
159 snd_sof_ipc_msgs_rx(sdev); in acp_sof_ipc_irq_thread()
160 acp_dsp_ipc_host_done(sdev); in acp_sof_ipc_irq_thread()
164 dsp_msg = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_msg_write); in acp_sof_ipc_irq_thread()
166 snd_sof_ipc_msgs_rx(sdev); in acp_sof_ipc_irq_thread()
167 acp_dsp_ipc_host_done(sdev); in acp_sof_ipc_irq_thread()
171 dsp_ack = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_ack_write); in acp_sof_ipc_irq_thread()
173 spin_lock_irq(&sdev->ipc_lock); in acp_sof_ipc_irq_thread()
175 acp_dsp_ipc_get_reply(sdev); in acp_sof_ipc_irq_thread()
176 snd_sof_ipc_reply(sdev, 0); in acp_sof_ipc_irq_thread()
178 acp_dsp_ipc_dsp_done(sdev); in acp_sof_ipc_irq_thread()
179 spin_unlock_irq(&sdev->ipc_lock); in acp_sof_ipc_irq_thread()
184 dev_dbg_ratelimited(sdev->dev, "nothing to do in IPC IRQ thread\n"); in acp_sof_ipc_irq_thread()
190 int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, in acp_sof_ipc_msg_data() argument
193 unsigned int offset = sdev->dsp_box.offset; in acp_sof_ipc_msg_data()
195 if (!substream || !sdev->stream_box.size) in acp_sof_ipc_msg_data()
196 acp_mailbox_read(sdev, offset, p, sz); in acp_sof_ipc_msg_data()
202 int acp_sof_ipc_get_mailbox_offset(struct snd_sof_dev *sdev) in acp_sof_ipc_get_mailbox_offset() argument
204 const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); in acp_sof_ipc_get_mailbox_offset()
210 int acp_sof_ipc_get_window_offset(struct snd_sof_dev *sdev, u32 id) in acp_sof_ipc_get_window_offset() argument