@@ -305,42 +305,43 @@ irqreturn_t avs_dsp_irq_handler(int irq, void *dev_id)
305305{
306306 struct avs_dev * adev = dev_id ;
307307 struct avs_ipc * ipc = adev -> ipc ;
308+ const struct avs_spec * const spec = adev -> spec ;
308309 u32 adspis , hipc_rsp , hipc_ack ;
309310 irqreturn_t ret = IRQ_NONE ;
310311
311312 adspis = snd_hdac_adsp_readl (adev , AVS_ADSP_REG_ADSPIS );
312313 if (adspis == UINT_MAX || !(adspis & AVS_ADSP_ADSPIS_IPC ))
313314 return ret ;
314315
315- hipc_ack = snd_hdac_adsp_readl (adev , SKL_ADSP_REG_HIPCIE );
316- hipc_rsp = snd_hdac_adsp_readl (adev , SKL_ADSP_REG_HIPCT );
316+ hipc_ack = snd_hdac_adsp_readl (adev , spec -> hipc -> ack_offset );
317+ hipc_rsp = snd_hdac_adsp_readl (adev , spec -> hipc -> rsp_offset );
317318
318319 /* DSP acked host's request */
319- if (hipc_ack & SKL_ADSP_HIPCIE_DONE ) {
320+ if (hipc_ack & spec -> hipc -> ack_done_mask ) {
320321 /*
321322 * As an extra precaution, mask done interrupt. Code executed
322323 * due to complete() found below does not assume any masking.
323324 */
324- snd_hdac_adsp_updatel (adev , SKL_ADSP_REG_HIPCCTL ,
325+ snd_hdac_adsp_updatel (adev , spec -> hipc -> ctl_offset ,
325326 AVS_ADSP_HIPCCTL_DONE , 0 );
326327
327328 complete (& ipc -> done_completion );
328329
329330 /* tell DSP it has our attention */
330- snd_hdac_adsp_updatel (adev , SKL_ADSP_REG_HIPCIE ,
331- SKL_ADSP_HIPCIE_DONE ,
332- SKL_ADSP_HIPCIE_DONE );
331+ snd_hdac_adsp_updatel (adev , spec -> hipc -> ack_offset ,
332+ spec -> hipc -> ack_done_mask ,
333+ spec -> hipc -> ack_done_mask );
333334 /* unmask done interrupt */
334- snd_hdac_adsp_updatel (adev , SKL_ADSP_REG_HIPCCTL ,
335+ snd_hdac_adsp_updatel (adev , spec -> hipc -> ctl_offset ,
335336 AVS_ADSP_HIPCCTL_DONE ,
336337 AVS_ADSP_HIPCCTL_DONE );
337338 ret = IRQ_HANDLED ;
338339 }
339340
340341 /* DSP sent new response to process */
341- if (hipc_rsp & SKL_ADSP_HIPCT_BUSY ) {
342+ if (hipc_rsp & spec -> hipc -> rsp_busy_mask ) {
342343 /* mask busy interrupt */
343- snd_hdac_adsp_updatel (adev , SKL_ADSP_REG_HIPCCTL ,
344+ snd_hdac_adsp_updatel (adev , spec -> hipc -> ctl_offset ,
344345 AVS_ADSP_HIPCCTL_BUSY , 0 );
345346
346347 ret = IRQ_WAKE_THREAD ;
@@ -379,10 +380,11 @@ irqreturn_t avs_dsp_irq_thread(int irq, void *dev_id)
379380static bool avs_ipc_is_busy (struct avs_ipc * ipc )
380381{
381382 struct avs_dev * adev = to_avs_dev (ipc -> dev );
383+ const struct avs_spec * const spec = adev -> spec ;
382384 u32 hipc_rsp ;
383385
384- hipc_rsp = snd_hdac_adsp_readl (adev , SKL_ADSP_REG_HIPCT );
385- return hipc_rsp & SKL_ADSP_HIPCT_BUSY ;
386+ hipc_rsp = snd_hdac_adsp_readl (adev , spec -> hipc -> rsp_offset );
387+ return hipc_rsp & spec -> hipc -> rsp_busy_mask ;
386388}
387389
388390static int avs_ipc_wait_busy_completion (struct avs_ipc * ipc , int timeout )
@@ -440,18 +442,19 @@ static void avs_ipc_msg_init(struct avs_ipc *ipc, struct avs_ipc_msg *reply)
440442
441443static void avs_dsp_send_tx (struct avs_dev * adev , struct avs_ipc_msg * tx , bool read_fwregs )
442444{
445+ const struct avs_spec * const spec = adev -> spec ;
443446 u64 reg = ULONG_MAX ;
444447
445- tx -> header |= SKL_ADSP_HIPCI_BUSY ;
448+ tx -> header |= spec -> hipc -> req_busy_mask ;
446449 if (read_fwregs )
447450 reg = readq (avs_sram_addr (adev , AVS_FW_REGS_WINDOW ));
448451
449452 trace_avs_request (tx , reg );
450453
451454 if (tx -> size )
452455 memcpy_toio (avs_downlink_addr (adev ), tx -> data , tx -> size );
453- snd_hdac_adsp_writel (adev , SKL_ADSP_REG_HIPCIE , tx -> header >> 32 );
454- snd_hdac_adsp_writel (adev , SKL_ADSP_REG_HIPCI , tx -> header & UINT_MAX );
456+ snd_hdac_adsp_writel (adev , spec -> hipc -> req_ext_offset , tx -> header >> 32 );
457+ snd_hdac_adsp_writel (adev , spec -> hipc -> req_offset , tx -> header & UINT_MAX );
455458}
456459
457460static int avs_dsp_do_send_msg (struct avs_dev * adev , struct avs_ipc_msg * request ,
@@ -606,6 +609,7 @@ int avs_dsp_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request, cons
606609
607610void avs_dsp_interrupt_control (struct avs_dev * adev , bool enable )
608611{
612+ const struct avs_spec * const spec = adev -> spec ;
609613 u32 value , mask ;
610614
611615 /*
@@ -617,7 +621,7 @@ void avs_dsp_interrupt_control(struct avs_dev *adev, bool enable)
617621
618622 mask = AVS_ADSP_HIPCCTL_DONE | AVS_ADSP_HIPCCTL_BUSY ;
619623 value = enable ? mask : 0 ;
620- snd_hdac_adsp_updatel (adev , SKL_ADSP_REG_HIPCCTL , mask , value );
624+ snd_hdac_adsp_updatel (adev , spec -> hipc -> ctl_offset , mask , value );
621625}
622626
623627int avs_ipc_init (struct avs_ipc * ipc , struct device * dev )
0 commit comments