int dsp_stop( struct audiodsp_priv *priv) { mutex_lock(&priv->dsp_mutex); #ifdef AUDIODSP_RESET priv->dsp_is_started=0; #endif halt_dsp(priv); priv->dsp_end_time=jiffies; #if 0 if(priv->dsp_stack_start!=0) kfree((void*)priv->dsp_stack_start); priv->dsp_stack_start=0; if(priv->dsp_gstack_start!=0) kfree((void*)priv->dsp_gstack_start); priv->dsp_gstack_start=0; if(priv->dsp_heap_start!=0) kfree((void*)priv->dsp_heap_start); priv->dsp_heap_start=0; if(priv->stream_buffer_mem!=NULL) { kfree(priv->stream_buffer_mem); priv->stream_buffer_mem=NULL; } #endif mutex_unlock(&priv->dsp_mutex); return 0; }
void reset_dsp( struct audiodsp_priv *priv) { halt_dsp(priv); //flush_and_inv_dcache_all(); /* map DSP 0 address so that reset vector points to same vector table as ARC1 */ CLEAR_MPEG_REG_MASK(AUD_ARC_CTL, (0xfff << 4)); // SET_MPEG_REG_MASK(SDRAM_CTL0,1);//arc mapping to ddr memory SET_MPEG_REG_MASK(AUD_ARC_CTL, ((AUDIO_DSP_START_PHY_ADDR)>> 20) << 4); // decode option if(IEC958_mode_codec){ if(IEC958_mode_codec == 4){//dd+ DSP_WD(DSP_DECODE_OPTION, decopt|(3<<30)); }else{ DSP_WD(DSP_DECODE_OPTION, decopt|(1<<31));//dd,dts } } else{ DSP_WD(DSP_DECODE_OPTION, decopt&(~(1<<31))); } printk("reset dsp : dec opt=%x\n", DSP_RD(DSP_DECODE_OPTION)); if(!priv->dsp_is_started){ DSP_PRNT("dsp reset now\n"); enable_dsp(1); } else{ dsp_mailbox_send(priv,1,M2B_IRQ0_DSP_WAKEUP,0,0,0); DSP_WD(DSP_STATUS, DSP_STATUS_WAKEUP); msleep(1);/*waiting arc625 run again */ } return; }
int dsp_start( struct audiodsp_priv *priv, struct audiodsp_microcode *mcode) { int i; int res; mutex_lock(&priv->dsp_mutex); halt_dsp(priv); if(priv->stream_fmt!=priv->last_stream_fmt) // remove the trick, bug fixed on dsp side { if(audiodsp_microcode_load(audiodsp_privdata(),mcode)!=0) { printk("load microcode error\n"); res=-1; goto exit; } priv->last_stream_fmt=priv->stream_fmt; } if((res=dsp_set_stack(priv))) goto exit; if((res=dsp_set_heap(priv))) goto exit; if((res=dsp_set_stream_buffer(priv))) goto exit; if(!priv->dsp_is_started) reset_dsp(priv); else{ dsp_mailbox_send(priv,1,M2B_IRQ0_DSP_WAKEUP,0,0,0); msleep(1);/*waiting arc625 run again */ } priv->dsp_start_time=jiffies; for(i=0;i<1000;i++) { if(DSP_RD(DSP_STATUS)==DSP_STATUS_RUNING) break; msleep(1); } if(i>=1000) { DSP_PRNT("dsp not running \n"); res=-1; } else { DSP_PRNT("dsp status=%lx\n",DSP_RD(DSP_STATUS)); priv->dsp_is_started=1; res=0; } exit: mutex_unlock(&priv->dsp_mutex); return res; }